clang  20.0.0git
Compiler.h
Go to the documentation of this file.
1 //===--- Compiler.h - Code generator for expressions -----*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Defines the constexpr bytecode compiler.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CLANG_AST_INTERP_BYTECODEEXPRGEN_H
14 #define LLVM_CLANG_AST_INTERP_BYTECODEEXPRGEN_H
15 
16 #include "ByteCodeEmitter.h"
17 #include "EvalEmitter.h"
18 #include "Pointer.h"
19 #include "PrimType.h"
20 #include "Record.h"
21 #include "clang/AST/Decl.h"
22 #include "clang/AST/Expr.h"
23 #include "clang/AST/StmtVisitor.h"
24 #include "clang/Basic/TargetInfo.h"
25 
26 namespace clang {
27 class QualType;
28 
29 namespace interp {
30 
31 template <class Emitter> class LocalScope;
32 template <class Emitter> class DestructorScope;
33 template <class Emitter> class VariableScope;
34 template <class Emitter> class DeclScope;
35 template <class Emitter> class InitLinkScope;
36 template <class Emitter> class InitStackScope;
37 template <class Emitter> class OptionScope;
38 template <class Emitter> class ArrayIndexScope;
39 template <class Emitter> class SourceLocScope;
40 template <class Emitter> class LoopScope;
41 template <class Emitter> class LabelScope;
42 template <class Emitter> class SwitchScope;
43 template <class Emitter> class StmtExprScope;
44 
45 template <class Emitter> class Compiler;
46 struct InitLink {
47 public:
48  enum {
49  K_This = 0,
50  K_Field = 1,
51  K_Temp = 2,
52  K_Decl = 3,
53  K_Elem = 5,
54  };
55 
56  static InitLink This() { return InitLink{K_This}; }
57  static InitLink Field(unsigned Offset) {
58  InitLink IL{K_Field};
59  IL.Offset = Offset;
60  return IL;
61  }
62  static InitLink Temp(unsigned Offset) {
63  InitLink IL{K_Temp};
64  IL.Offset = Offset;
65  return IL;
66  }
67  static InitLink Decl(const ValueDecl *D) {
68  InitLink IL{K_Decl};
69  IL.D = D;
70  return IL;
71  }
72  static InitLink Elem(unsigned Index) {
73  InitLink IL{K_Elem};
74  IL.Offset = Index;
75  return IL;
76  }
77 
78  InitLink(uint8_t Kind) : Kind(Kind) {}
79  template <class Emitter>
80  bool emit(Compiler<Emitter> *Ctx, const Expr *E) const;
81 
83  union {
84  unsigned Offset;
85  const ValueDecl *D;
86  };
87 };
88 
89 /// State encapsulating if a the variable creation has been successful,
90 /// unsuccessful, or no variable has been created at all.
92  std::optional<bool> S = std::nullopt;
93  VarCreationState() = default;
94  VarCreationState(bool b) : S(b) {}
96 
97  operator bool() const { return S && *S; }
98  bool notCreated() const { return !S; }
99 };
100 
101 /// Compilation context for expressions.
102 template <class Emitter>
103 class Compiler : public ConstStmtVisitor<Compiler<Emitter>, bool>,
104  public Emitter {
105 protected:
106  // Aliases for types defined in the emitter.
107  using LabelTy = typename Emitter::LabelTy;
108  using AddrTy = typename Emitter::AddrTy;
109  using OptLabelTy = std::optional<LabelTy>;
110  using CaseMap = llvm::DenseMap<const SwitchCase *, LabelTy>;
111 
112  /// Current compilation context.
114  /// Program to link to.
116 
117 public:
118  /// Initializes the compiler and the backend emitter.
119  template <typename... Tys>
120  Compiler(Context &Ctx, Program &P, Tys &&...Args)
121  : Emitter(Ctx, P, Args...), Ctx(Ctx), P(P) {}
122 
123  // Expressions.
124  bool VisitCastExpr(const CastExpr *E);
125  bool VisitIntegerLiteral(const IntegerLiteral *E);
128  bool VisitParenExpr(const ParenExpr *E);
129  bool VisitBinaryOperator(const BinaryOperator *E);
130  bool VisitLogicalBinOp(const BinaryOperator *E);
132  bool VisitComplexBinOp(const BinaryOperator *E);
134  bool VisitCallExpr(const CallExpr *E);
135  bool VisitBuiltinCallExpr(const CallExpr *E);
139  bool VisitGNUNullExpr(const GNUNullExpr *E);
140  bool VisitCXXThisExpr(const CXXThisExpr *E);
141  bool VisitUnaryOperator(const UnaryOperator *E);
143  bool VisitDeclRefExpr(const DeclRefExpr *E);
147  bool VisitInitListExpr(const InitListExpr *E);
149  bool VisitConstantExpr(const ConstantExpr *E);
151  bool VisitMemberExpr(const MemberExpr *E);
156  bool VisitStringLiteral(const StringLiteral *E);
158  bool VisitObjCEncodeExpr(const ObjCEncodeExpr *E);
168  bool VisitTypeTraitExpr(const TypeTraitExpr *E);
170  bool VisitLambdaExpr(const LambdaExpr *E);
171  bool VisitPredefinedExpr(const PredefinedExpr *E);
172  bool VisitCXXThrowExpr(const CXXThrowExpr *E);
176  bool VisitSourceLocExpr(const SourceLocExpr *E);
177  bool VisitOffsetOfExpr(const OffsetOfExpr *E);
179  bool VisitSizeOfPackExpr(const SizeOfPackExpr *E);
181  bool VisitChooseExpr(const ChooseExpr *E);
182  bool VisitEmbedExpr(const EmbedExpr *E);
186  bool VisitCXXUuidofExpr(const CXXUuidofExpr *E);
187  bool VisitRequiresExpr(const RequiresExpr *E);
192  bool VisitRecoveryExpr(const RecoveryExpr *E);
193  bool VisitAddrLabelExpr(const AddrLabelExpr *E);
197  bool VisitObjCBoxedExpr(const ObjCBoxedExpr *E);
199  bool VisitStmtExpr(const StmtExpr *E);
200  bool VisitCXXNewExpr(const CXXNewExpr *E);
201  bool VisitCXXDeleteExpr(const CXXDeleteExpr *E);
202 
203  // Statements.
204  bool visitCompoundStmt(const CompoundStmt *S);
205  bool visitDeclStmt(const DeclStmt *DS);
206  bool visitReturnStmt(const ReturnStmt *RS);
207  bool visitIfStmt(const IfStmt *IS);
208  bool visitWhileStmt(const WhileStmt *S);
209  bool visitDoStmt(const DoStmt *S);
210  bool visitForStmt(const ForStmt *S);
211  bool visitCXXForRangeStmt(const CXXForRangeStmt *S);
212  bool visitBreakStmt(const BreakStmt *S);
213  bool visitContinueStmt(const ContinueStmt *S);
214  bool visitSwitchStmt(const SwitchStmt *S);
215  bool visitCaseStmt(const CaseStmt *S);
216  bool visitDefaultStmt(const DefaultStmt *S);
217  bool visitAttributedStmt(const AttributedStmt *S);
218  bool visitCXXTryStmt(const CXXTryStmt *S);
219 
220 protected:
221  bool visitStmt(const Stmt *S);
222  bool visitExpr(const Expr *E) override;
223  bool visitFunc(const FunctionDecl *F) override;
224 
225  bool visitDeclAndReturn(const VarDecl *VD, bool ConstantContext) override;
226 
227 protected:
228  /// Emits scope cleanup instructions.
229  void emitCleanup();
230 
231  /// Returns a record type from a record or pointer type.
232  const RecordType *getRecordTy(QualType Ty);
233 
234  /// Returns a record from a record or pointer type.
236  Record *getRecord(const RecordDecl *RD);
237 
238  /// Returns a function for the given FunctionDecl.
239  /// If the function does not exist yet, it is compiled.
240  const Function *getFunction(const FunctionDecl *FD);
241 
242  std::optional<PrimType> classify(const Expr *E) const {
243  return Ctx.classify(E);
244  }
245  std::optional<PrimType> classify(QualType Ty) const {
246  return Ctx.classify(Ty);
247  }
248 
249  /// Classifies a known primitive type.
251  if (auto T = classify(Ty)) {
252  return *T;
253  }
254  llvm_unreachable("not a primitive type");
255  }
256  /// Classifies a known primitive expression.
257  PrimType classifyPrim(const Expr *E) const {
258  if (auto T = classify(E))
259  return *T;
260  llvm_unreachable("not a primitive type");
261  }
262 
263  /// Evaluates an expression and places the result on the stack. If the
264  /// expression is of composite type, a local variable will be created
265  /// and a pointer to said variable will be placed on the stack.
266  bool visit(const Expr *E);
267  /// Compiles an initializer. This is like visit() but it will never
268  /// create a variable and instead rely on a variable already having
269  /// been created. visitInitializer() then relies on a pointer to this
270  /// variable being on top of the stack.
271  bool visitInitializer(const Expr *E);
272  /// Evaluates an expression for side effects and discards the result.
273  bool discard(const Expr *E);
274  /// Just pass evaluation on to \p E. This leaves all the parsing flags
275  /// intact.
276  bool delegate(const Expr *E);
277  /// Creates and initializes a variable from the given decl.
278  VarCreationState visitVarDecl(const VarDecl *VD, bool Toplevel = false);
280  /// Visit an APValue.
281  bool visitAPValue(const APValue &Val, PrimType ValType, const Expr *E);
282  bool visitAPValueInitializer(const APValue &Val, const Expr *E);
283  /// Visit the given decl as if we have a reference to it.
284  bool visitDeclRef(const ValueDecl *D, const Expr *E);
285 
286  /// Visits an expression and converts it to a boolean.
287  bool visitBool(const Expr *E);
288 
289  bool visitInitList(ArrayRef<const Expr *> Inits, const Expr *ArrayFiller,
290  const Expr *E);
291  bool visitArrayElemInit(unsigned ElemIndex, const Expr *Init);
292 
293  /// Creates a local primitive value.
294  unsigned allocateLocalPrimitive(DeclTy &&Decl, PrimType Ty, bool IsConst,
295  bool IsExtended = false);
296 
297  /// Allocates a space storing a local given its type.
298  std::optional<unsigned>
299  allocateLocal(DeclTy &&Decl, const ValueDecl *ExtendingDecl = nullptr);
300  unsigned allocateTemporary(const Expr *E);
301 
302 private:
303  friend class VariableScope<Emitter>;
304  friend class LocalScope<Emitter>;
305  friend class DestructorScope<Emitter>;
306  friend class DeclScope<Emitter>;
307  friend class InitLinkScope<Emitter>;
308  friend class InitStackScope<Emitter>;
309  friend class OptionScope<Emitter>;
310  friend class ArrayIndexScope<Emitter>;
311  friend class SourceLocScope<Emitter>;
312  friend struct InitLink;
313  friend class LoopScope<Emitter>;
314  friend class LabelScope<Emitter>;
315  friend class SwitchScope<Emitter>;
316  friend class StmtExprScope<Emitter>;
317 
318  /// Emits a zero initializer.
319  bool visitZeroInitializer(PrimType T, QualType QT, const Expr *E);
320  bool visitZeroRecordInitializer(const Record *R, const Expr *E);
321 
322  /// Emits an APSInt constant.
323  bool emitConst(const llvm::APSInt &Value, PrimType Ty, const Expr *E);
324  bool emitConst(const llvm::APSInt &Value, const Expr *E);
325  bool emitConst(const llvm::APInt &Value, const Expr *E) {
326  return emitConst(static_cast<llvm::APSInt>(Value), E);
327  }
328 
329  /// Emits an integer constant.
330  template <typename T> bool emitConst(T Value, PrimType Ty, const Expr *E);
331  template <typename T> bool emitConst(T Value, const Expr *E);
332 
333  llvm::RoundingMode getRoundingMode(const Expr *E) const {
334  FPOptions FPO = E->getFPFeaturesInEffect(Ctx.getLangOpts());
335 
336  if (FPO.getRoundingMode() == llvm::RoundingMode::Dynamic)
337  return llvm::RoundingMode::NearestTiesToEven;
338 
339  return FPO.getRoundingMode();
340  }
341 
342  bool emitPrimCast(PrimType FromT, PrimType ToT, QualType ToQT, const Expr *E);
343  PrimType classifyComplexElementType(QualType T) const {
344  assert(T->isAnyComplexType());
345 
346  QualType ElemType = T->getAs<ComplexType>()->getElementType();
347 
348  return *this->classify(ElemType);
349  }
350 
351  bool emitComplexReal(const Expr *SubExpr);
352  bool emitComplexBoolCast(const Expr *E);
353  bool emitComplexComparison(const Expr *LHS, const Expr *RHS,
354  const BinaryOperator *E);
355 
356  bool emitRecordDestruction(const Record *R);
357  bool emitDestruction(const Descriptor *Desc);
358  unsigned collectBaseOffset(const QualType BaseType,
359  const QualType DerivedType);
360  bool emitLambdaStaticInvokerBody(const CXXMethodDecl *MD);
361  bool compileConstructor(const CXXConstructorDecl *Ctor);
362  bool compileDestructor(const CXXDestructorDecl *Dtor);
363 
364  bool checkLiteralType(const Expr *E);
365 
366 protected:
367  /// Variable to storage mapping.
368  llvm::DenseMap<const ValueDecl *, Scope::Local> Locals;
369 
370  /// OpaqueValueExpr to location mapping.
371  llvm::DenseMap<const OpaqueValueExpr *, unsigned> OpaqueExprs;
372 
373  /// Current scope.
375 
376  /// Current argument index. Needed to emit ArrayInitIndexExpr.
377  std::optional<uint64_t> ArrayIndex;
378 
379  /// DefaultInit- or DefaultArgExpr, needed for SourceLocExpr.
380  const Expr *SourceLocDefaultExpr = nullptr;
381 
382  /// Flag indicating if return value is to be discarded.
383  bool DiscardResult = false;
384 
385  bool InStmtExpr = false;
386 
387  /// Flag inidicating if we're initializing an already created
388  /// variable. This is set in visitInitializer().
389  bool Initializing = false;
390  const ValueDecl *InitializingDecl = nullptr;
391 
393  bool InitStackActive = false;
394 
395  /// Type of the expression returned by the function.
396  std::optional<PrimType> ReturnType;
397 
398  /// Switch case mapping.
400 
401  /// Point to break to.
403  /// Point to continue to.
405  /// Default case label.
407 };
408 
409 extern template class Compiler<ByteCodeEmitter>;
410 extern template class Compiler<EvalEmitter>;
411 
412 /// Scope chain managing the variable lifetimes.
413 template <class Emitter> class VariableScope {
414 public:
416  : Ctx(Ctx), Parent(Ctx->VarScope), ValDecl(VD) {
417  Ctx->VarScope = this;
418  }
419 
420  virtual ~VariableScope() { Ctx->VarScope = this->Parent; }
421 
422  void add(const Scope::Local &Local, bool IsExtended) {
423  if (IsExtended)
424  this->addExtended(Local);
425  else
426  this->addLocal(Local);
427  }
428 
429  virtual void addLocal(const Scope::Local &Local) {
430  if (this->Parent)
431  this->Parent->addLocal(Local);
432  }
433 
434  virtual void addExtended(const Scope::Local &Local) {
435  if (this->Parent)
436  this->Parent->addExtended(Local);
437  }
438 
439  void addExtended(const Scope::Local &Local, const ValueDecl *ExtendingDecl) {
440  // Walk up the chain of scopes until we find the one for ExtendingDecl.
441  // If there is no such scope, attach it to the parent one.
442  VariableScope *P = this;
443  while (P) {
444  if (P->ValDecl == ExtendingDecl) {
445  P->addLocal(Local);
446  return;
447  }
448  P = P->Parent;
449  if (!P)
450  break;
451  }
452 
453  // Use the parent scope.
454  if (this->Parent)
455  this->Parent->addLocal(Local);
456  else
457  this->addLocal(Local);
458  }
459 
460  virtual void emitDestruction() {}
461  virtual bool emitDestructors(const Expr *E = nullptr) { return true; }
462  virtual bool destroyLocals(const Expr *E = nullptr) { return true; }
463  VariableScope *getParent() const { return Parent; }
464 
465 protected:
466  /// Compiler instance.
468  /// Link to the parent scope.
470  const ValueDecl *ValDecl = nullptr;
471 };
472 
473 /// Generic scope for local variables.
474 template <class Emitter> class LocalScope : public VariableScope<Emitter> {
475 public:
478  : VariableScope<Emitter>(Ctx, VD) {}
479 
480  /// Emit a Destroy op for this scope.
481  ~LocalScope() override {
482  if (!Idx)
483  return;
484  this->Ctx->emitDestroy(*Idx, SourceInfo{});
485  removeStoredOpaqueValues();
486  }
487 
488  /// Overriden to support explicit destruction.
489  void emitDestruction() override {
490  if (!Idx)
491  return;
492 
493  this->emitDestructors();
494  this->Ctx->emitDestroy(*Idx, SourceInfo{});
495  }
496 
497  /// Explicit destruction of local variables.
498  bool destroyLocals(const Expr *E = nullptr) override {
499  if (!Idx)
500  return true;
501 
502  bool Success = this->emitDestructors(E);
503  this->Ctx->emitDestroy(*Idx, E);
504  this->Idx = std::nullopt;
505  return Success;
506  }
507 
508  void addLocal(const Scope::Local &Local) override {
509  if (!Idx) {
510  Idx = this->Ctx->Descriptors.size();
511  this->Ctx->Descriptors.emplace_back();
512  this->Ctx->emitInitScope(*Idx, {});
513  }
514 
515  this->Ctx->Descriptors[*Idx].emplace_back(Local);
516  }
517 
518  bool emitDestructors(const Expr *E = nullptr) override {
519  if (!Idx)
520  return true;
521  // Emit destructor calls for local variables of record
522  // type with a destructor.
523  for (Scope::Local &Local : this->Ctx->Descriptors[*Idx]) {
524  if (!Local.Desc->isPrimitive() && !Local.Desc->isPrimitiveArray()) {
525  if (!this->Ctx->emitGetPtrLocal(Local.Offset, E))
526  return false;
527 
528  if (!this->Ctx->emitDestruction(Local.Desc))
529  return false;
530 
531  if (!this->Ctx->emitPopPtr(E))
532  return false;
533  removeIfStoredOpaqueValue(Local);
534  }
535  }
536  return true;
537  }
538 
540  if (!Idx)
541  return;
542 
543  for (const Scope::Local &Local : this->Ctx->Descriptors[*Idx]) {
544  removeIfStoredOpaqueValue(Local);
545  }
546  }
547 
549  if (const auto *OVE =
550  llvm::dyn_cast_if_present<OpaqueValueExpr>(Local.Desc->asExpr())) {
551  if (auto It = this->Ctx->OpaqueExprs.find(OVE);
552  It != this->Ctx->OpaqueExprs.end())
553  this->Ctx->OpaqueExprs.erase(It);
554  };
555  }
556 
557  /// Index of the scope in the chain.
558  std::optional<unsigned> Idx;
559 };
560 
561 /// Scope for storage declared in a compound statement.
562 template <class Emitter> class BlockScope final : public LocalScope<Emitter> {
563 public:
565 
566  void addExtended(const Scope::Local &Local) override {
567  // If we to this point, just add the variable as a normal local
568  // variable. It will be destroyed at the end of the block just
569  // like all others.
570  this->addLocal(Local);
571  }
572 };
573 
574 template <class Emitter> class ArrayIndexScope final {
575 public:
576  ArrayIndexScope(Compiler<Emitter> *Ctx, uint64_t Index) : Ctx(Ctx) {
577  OldArrayIndex = Ctx->ArrayIndex;
578  Ctx->ArrayIndex = Index;
579  }
580 
581  ~ArrayIndexScope() { Ctx->ArrayIndex = OldArrayIndex; }
582 
583 private:
584  Compiler<Emitter> *Ctx;
585  std::optional<uint64_t> OldArrayIndex;
586 };
587 
588 template <class Emitter> class SourceLocScope final {
589 public:
590  SourceLocScope(Compiler<Emitter> *Ctx, const Expr *DefaultExpr) : Ctx(Ctx) {
591  assert(DefaultExpr);
592  // We only switch if the current SourceLocDefaultExpr is null.
593  if (!Ctx->SourceLocDefaultExpr) {
594  Enabled = true;
595  Ctx->SourceLocDefaultExpr = DefaultExpr;
596  }
597  }
598 
600  if (Enabled)
601  Ctx->SourceLocDefaultExpr = nullptr;
602  }
603 
604 private:
605  Compiler<Emitter> *Ctx;
606  bool Enabled = false;
607 };
608 
609 template <class Emitter> class InitLinkScope final {
610 public:
612  Ctx->InitStack.push_back(std::move(Link));
613  }
614 
615  ~InitLinkScope() { this->Ctx->InitStack.pop_back(); }
616 
617 private:
618  Compiler<Emitter> *Ctx;
619 };
620 
621 template <class Emitter> class InitStackScope final {
622 public:
624  : Ctx(Ctx), OldValue(Ctx->InitStackActive) {
625  Ctx->InitStackActive = Active;
626  }
627 
628  ~InitStackScope() { this->Ctx->InitStackActive = OldValue; }
629 
630 private:
631  Compiler<Emitter> *Ctx;
632  bool OldValue;
633 };
634 
635 } // namespace interp
636 } // namespace clang
637 
638 #endif
NodeId Parent
Definition: ASTDiff.cpp:191
StringRef P
const Decl * D
Expr * E
llvm::APSInt APSInt
Definition: Compiler.cpp:22
llvm::MachO::Record Record
Definition: MachO.h:31
__device__ __2f16 b
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Definition: APValue.h:122
AbstractConditionalOperator - An abstract base class for ConditionalOperator and BinaryConditionalOpe...
Definition: Expr.h:4217
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:4414
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Definition: Expr.h:5787
Represents a loop initializing the elements of an array.
Definition: Expr.h:5734
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition: Expr.h:2726
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
Definition: ExprCXX.h:2852
Represents an attribute applied to a statement.
Definition: Stmt.h:2085
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3912
BreakStmt - This represents a break.
Definition: Stmt.h:2985
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1491
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition: ExprCXX.h:720
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1546
A default argument (C++ [dcl.fct.default]).
Definition: ExprCXX.h:1268
A use of a default initializer in a constructor or in aggregate initialization.
Definition: ExprCXX.h:1375
Represents a delete expression for memory deallocation and destructor calls, e.g.
Definition: ExprCXX.h:2497
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Definition: StmtCXX.h:135
Represents a call to an inherited base class constructor from an inheriting constructor.
Definition: ExprCXX.h:1737
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Definition: ExprCXX.h:2240
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
Definition: ExprCXX.h:4125
The null pointer literal (C++11 [lex.nullptr])
Definition: ExprCXX.h:765
Represents a list-initialization with parenthesis.
Definition: ExprCXX.h:4953
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
Definition: ExprCXX.h:523
A rewritten comparison expression that was originally written using operator syntax.
Definition: ExprCXX.h:283
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type.
Definition: ExprCXX.h:2181
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Definition: ExprCXX.h:797
Represents the this expression in C++.
Definition: ExprCXX.h:1152
A C++ throw-expression (C++ [except.throw]).
Definition: ExprCXX.h:1206
CXXTryStmt - A C++ try block, including all handlers.
Definition: StmtCXX.h:69
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
Definition: ExprCXX.h:1066
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2882
CaseStmt - Represent a case statement.
Definition: Stmt.h:1806
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:3550
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Definition: Expr.h:4634
Complex values, per C99 6.2.5p11.
Definition: Type.h:3144
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:4164
CompoundLiteralExpr - [C99 6.5.2.5].
Definition: Expr.h:3480
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition: Stmt.h:1606
Represents the specialization of a concept - evaluates to a prvalue of type bool.
Definition: ExprConcepts.h:42
ConstStmtVisitor - This class implements a simple visitor for Stmt subclasses.
Definition: StmtVisitor.h:195
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Definition: Expr.h:1077
ContinueStmt - This represents a continue.
Definition: Stmt.h:2955
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Definition: Expr.h:4575
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1265
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Definition: Stmt.h:1497
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86
DoStmt - This represents a 'do/while' stmt.
Definition: Stmt.h:2730
Represents a reference to #emded data.
Definition: Expr.h:4898
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
Definition: ExprCXX.h:3473
This represents one expression.
Definition: Expr.h:110
An expression trait intrinsic.
Definition: ExprCXX.h:2923
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition: Expr.h:6336
RoundingMode getRoundingMode() const
Definition: LangOptions.h:892
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Definition: Stmt.h:2786
Represents a function declaration or definition.
Definition: Decl.h:1933
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Definition: Expr.h:4709
Represents a C11 generic selection.
Definition: Expr.h:5948
IfStmt - This represents an if/then/else.
Definition: Stmt.h:2143
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
Definition: Expr.h:1717
Represents an implicitly-generated value initialization of an object of a given type.
Definition: Expr.h:5823
Describes an C or C++ initializer list.
Definition: Expr.h:5070
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition: ExprCXX.h:1954
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
Definition: ExprCXX.h:4727
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:3239
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition: ExprObjC.h:87
ObjCBoxedExpr - used for generalized expression boxing.
Definition: ExprObjC.h:127
ObjCEncodeExpr, used for @encode in Objective-C.
Definition: ExprObjC.h:410
ObjCStringLiteral, used for Objective-C string literals i.e.
Definition: ExprObjC.h:51
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type,...
Definition: Expr.h:2527
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Definition: Expr.h:1173
ParenExpr - This represents a parenthesized expression, e.g.
Definition: Expr.h:2187
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1991
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition: Expr.h:6528
A (possibly-)qualified type.
Definition: Type.h:941
Represents a struct/union/class.
Definition: Decl.h:4146
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition: Type.h:5975
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Definition: Expr.h:7132
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
Definition: ExprConcepts.h:510
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
Definition: Stmt.h:3024
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Definition: Expr.h:4507
Represents an expression that computes the length of a parameter pack.
Definition: ExprCXX.h:4257
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
Definition: Expr.h:4803
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Definition: Expr.h:4459
Stmt - This represents one statement.
Definition: Stmt.h:84
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1778
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Definition: ExprCXX.h:4483
SwitchStmt - This represents a 'switch' stmt.
Definition: Stmt.h:2393
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Definition: ExprCXX.h:2767
bool isAnyComplexType() const
Definition: Type.h:8121
const T * getAs() const
Member-template getAs<specific type>'.
Definition: Type.h:8568
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
Definition: Expr.h:2630
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Definition: Expr.h:2240
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:668
Represents a variable declaration or definition.
Definition: Decl.h:880
WhileStmt - This represents a 'while' stmt.
Definition: Stmt.h:2589
ArrayIndexScope(Compiler< Emitter > *Ctx, uint64_t Index)
Definition: Compiler.h:576
Scope for storage declared in a compound statement.
Definition: Compiler.h:562
BlockScope(Compiler< Emitter > *Ctx)
Definition: Compiler.h:564
void addExtended(const Scope::Local &Local) override
Definition: Compiler.h:566
Compilation context for expressions.
Definition: Compiler.h:104
llvm::SmallVector< InitLink > InitStack
Definition: Compiler.h:392
OptLabelTy BreakLabel
Point to break to.
Definition: Compiler.h:402
bool VisitArrayInitIndexExpr(const ArrayInitIndexExpr *E)
Definition: Compiler.cpp:1785
bool VisitCXXDeleteExpr(const CXXDeleteExpr *E)
Definition: Compiler.cpp:2904
bool VisitOffsetOfExpr(const OffsetOfExpr *E)
Definition: Compiler.cpp:2655
bool visitContinueStmt(const ContinueStmt *S)
Definition: Compiler.cpp:4571
bool VisitCharacterLiteral(const CharacterLiteral *E)
Definition: Compiler.cpp:2000
PrimType classifyPrim(const Expr *E) const
Classifies a known primitive expression.
Definition: Compiler.h:257
bool VisitCXXParenListInitExpr(const CXXParenListInitExpr *E)
Definition: Compiler.cpp:1586
bool VisitConceptSpecializationExpr(const ConceptSpecializationExpr *E)
Definition: Compiler.cpp:2966
bool VisitCompoundLiteralExpr(const CompoundLiteralExpr *E)
Definition: Compiler.cpp:2328
bool visitBool(const Expr *E)
Visits an expression and converts it to a boolean.
Definition: Compiler.cpp:3282
bool VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *E)
Definition: Compiler.cpp:4166
bool visitDeclAndReturn(const VarDecl *VD, bool ConstantContext) override
Toplevel visitDeclAndReturn().
Definition: Compiler.cpp:3665
PrimType classifyPrim(QualType Ty) const
Classifies a known primitive type.
Definition: Compiler.h:250
bool visitExpr(const Expr *E) override
Definition: Compiler.cpp:3598
bool VisitTypeTraitExpr(const TypeTraitExpr *E)
Definition: Compiler.cpp:2393
bool VisitLambdaExpr(const LambdaExpr *E)
Definition: Compiler.cpp:2409
bool VisitMemberExpr(const MemberExpr *E)
Definition: Compiler.cpp:1733
llvm::DenseMap< const OpaqueValueExpr *, unsigned > OpaqueExprs
OpaqueValueExpr to location mapping.
Definition: Compiler.h:371
bool VisitBinaryOperator(const BinaryOperator *E)
Definition: Compiler.cpp:693
bool visitAttributedStmt(const AttributedStmt *S)
Definition: Compiler.cpp:4662
bool VisitPackIndexingExpr(const PackIndexingExpr *E)
Definition: Compiler.cpp:3005
bool VisitArraySubscriptExpr(const ArraySubscriptExpr *E)
Definition: Compiler.cpp:1289
bool VisitCallExpr(const CallExpr *E)
Definition: Compiler.cpp:3980
std::optional< uint64_t > ArrayIndex
Current argument index. Needed to emit ArrayInitIndexExpr.
Definition: Compiler.h:377
bool VisitPseudoObjectExpr(const PseudoObjectExpr *E)
Definition: Compiler.cpp:2981
bool VisitCXXReinterpretCastExpr(const CXXReinterpretCastExpr *E)
Definition: Compiler.cpp:2464
const Function * getFunction(const FunctionDecl *FD)
Returns a function for the given FunctionDecl.
Definition: Compiler.cpp:3594
void emitCleanup()
Emits scope cleanup instructions.
Definition: Compiler.cpp:5416
bool VisitCastExpr(const CastExpr *E)
Definition: Compiler.cpp:178
bool VisitObjCEncodeExpr(const ObjCEncodeExpr *E)
Definition: Compiler.cpp:1965
bool VisitComplexUnaryOperator(const UnaryOperator *E)
Definition: Compiler.cpp:5173
llvm::DenseMap< const SwitchCase *, LabelTy > CaseMap
Definition: Compiler.h:110
bool visitDeclStmt(const DeclStmt *DS)
Definition: Compiler.cpp:4306
bool visitAPValue(const APValue &Val, PrimType ValType, const Expr *E)
Visit an APValue.
Definition: Compiler.cpp:3835
bool VisitCXXScalarValueInitExpr(const CXXScalarValueInitExpr *E)
Definition: Compiler.cpp:2690
bool VisitLogicalBinOp(const BinaryOperator *E)
Definition: Compiler.cpp:921
bool visitCompoundStmt(const CompoundStmt *S)
Definition: Compiler.cpp:4297
std::optional< PrimType > ReturnType
Type of the expression returned by the function.
Definition: Compiler.h:396
Context & Ctx
Current compilation context.
Definition: Compiler.h:113
bool visitDeclRef(const ValueDecl *D, const Expr *E)
Visit the given decl as if we have a reference to it.
Definition: Compiler.cpp:5280
bool visitBreakStmt(const BreakStmt *S)
Definition: Compiler.cpp:4562
bool visitForStmt(const ForStmt *S)
Definition: Compiler.cpp:4459
bool VisitDeclRefExpr(const DeclRefExpr *E)
Definition: Compiler.cpp:5411
bool VisitOpaqueValueExpr(const OpaqueValueExpr *E)
Definition: Compiler.cpp:1824
bool VisitArrayInitLoopExpr(const ArrayInitLoopExpr *E)
Definition: Compiler.cpp:1794
OptLabelTy DefaultLabel
Default case label.
Definition: Compiler.h:406
bool VisitStmtExpr(const StmtExpr *E)
Definition: Compiler.cpp:3203
bool VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *E)
Definition: Compiler.cpp:4185
VariableScope< Emitter > * VarScope
Current scope.
Definition: Compiler.h:374
bool VisitCXXNewExpr(const CXXNewExpr *E)
Definition: Compiler.cpp:2804
const ValueDecl * InitializingDecl
Definition: Compiler.h:390
bool VisitCompoundAssignOperator(const CompoundAssignOperator *E)
Definition: Compiler.cpp:2118
bool visitArrayElemInit(unsigned ElemIndex, const Expr *Init)
Pointer to the array(not the element!) must be on the stack when calling this.
Definition: Compiler.cpp:1559
bool delegate(const Expr *E)
Just pass evaluation on to E.
Definition: Compiler.cpp:3231
bool discard(const Expr *E)
Evaluates an expression for side effects and discards the result.
Definition: Compiler.cpp:3225
bool VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *E)
Definition: Compiler.cpp:4173
CaseMap CaseLabels
Switch case mapping.
Definition: Compiler.h:399
Record * getRecord(QualType Ty)
Returns a record from a record or pointer type.
Definition: Compiler.cpp:3582
bool visit(const Expr *E)
Evaluates an expression and places the result on the stack.
Definition: Compiler.cpp:3241
const RecordType * getRecordTy(QualType Ty)
Returns a record type from a record or pointer type.
Definition: Compiler.cpp:3576
bool VisitCXXStdInitializerListExpr(const CXXStdInitializerListExpr *E)
Definition: Compiler.cpp:3170
std::optional< unsigned > allocateLocal(DeclTy &&Decl, const ValueDecl *ExtendingDecl=nullptr)
Allocates a space storing a local given its type.
Definition: Compiler.cpp:3514
bool visitInitList(ArrayRef< const Expr * > Inits, const Expr *ArrayFiller, const Expr *E)
Definition: Compiler.cpp:1319
bool VisitSizeOfPackExpr(const SizeOfPackExpr *E)
Definition: Compiler.cpp:2749
bool VisitPredefinedExpr(const PredefinedExpr *E)
Definition: Compiler.cpp:2448
bool VisitSourceLocExpr(const SourceLocExpr *E)
Definition: Compiler.cpp:2599
Compiler(Context &Ctx, Program &P, Tys &&...Args)
Initializes the compiler and the backend emitter.
Definition: Compiler.h:120
bool VisitExtVectorElementExpr(const ExtVectorElementExpr *E)
Definition: Compiler.cpp:3099
bool VisitObjCStringLiteral(const ObjCStringLiteral *E)
Definition: Compiler.cpp:1960
bool VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr *E)
Definition: Compiler.cpp:2402
bool visitInitializer(const Expr *E)
Compiles an initializer.
Definition: Compiler.cpp:3268
const Expr * SourceLocDefaultExpr
DefaultInit- or DefaultArgExpr, needed for SourceLocExpr.
Definition: Compiler.h:380
bool VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *E)
Definition: Compiler.cpp:2322
bool VisitPointerArithBinOp(const BinaryOperator *E)
Perform addition/subtraction of a pointer and an integer or subtraction of two pointers.
Definition: Compiler.cpp:873
bool VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *E)
Definition: Compiler.cpp:2765
bool visitDefaultStmt(const DefaultStmt *S)
Definition: Compiler.cpp:4656
typename Emitter::LabelTy LabelTy
Definition: Compiler.h:107
VarCreationState visitDecl(const VarDecl *VD)
Definition: Compiler.cpp:3637
bool visitStmt(const Stmt *S)
Definition: Compiler.cpp:4247
bool VisitExpressionTraitExpr(const ExpressionTraitExpr *E)
Definition: Compiler.cpp:2915
bool visitAPValueInitializer(const APValue &Val, const Expr *E)
Definition: Compiler.cpp:3862
bool VisitCXXConstructExpr(const CXXConstructExpr *E)
Definition: Compiler.cpp:2485
bool VisitCXXNullPtrLiteralExpr(const CXXNullPtrLiteralExpr *E)
Definition: Compiler.cpp:4193
bool VisitObjCBoxedExpr(const ObjCBoxedExpr *E)
Definition: Compiler.cpp:3161
bool VisitCXXInheritedCtorInitExpr(const CXXInheritedCtorInitExpr *E)
Definition: Compiler.cpp:2773
bool VisitRecoveryExpr(const RecoveryExpr *E)
Definition: Compiler.cpp:3010
bool VisitRequiresExpr(const RequiresExpr *E)
Definition: Compiler.cpp:2958
bool Initializing
Flag inidicating if we're initializing an already created variable.
Definition: Compiler.h:389
bool visitReturnStmt(const ReturnStmt *RS)
Definition: Compiler.cpp:4323
bool VisitCXXThrowExpr(const CXXThrowExpr *E)
Definition: Compiler.cpp:2456
bool VisitSubstNonTypeTemplateParmExpr(const SubstNonTypeTemplateParmExpr *E)
Definition: Compiler.cpp:1592
bool VisitChooseExpr(const ChooseExpr *E)
Definition: Compiler.cpp:2760
bool visitFunc(const FunctionDecl *F) override
Definition: Compiler.cpp:4928
bool visitCXXForRangeStmt(const CXXForRangeStmt *S)
Definition: Compiler.cpp:4506
bool visitCaseStmt(const CaseStmt *S)
Definition: Compiler.cpp:4650
bool VisitComplexBinOp(const BinaryOperator *E)
Definition: Compiler.cpp:982
llvm::DenseMap< const ValueDecl *, Scope::Local > Locals
Variable to storage mapping.
Definition: Compiler.h:368
bool VisitAbstractConditionalOperator(const AbstractConditionalOperator *E)
Definition: Compiler.cpp:1860
OptLabelTy ContinueLabel
Point to continue to.
Definition: Compiler.h:404
bool VisitImplicitValueInitExpr(const ImplicitValueInitExpr *E)
Definition: Compiler.cpp:1205
typename Emitter::AddrTy AddrTy
Definition: Compiler.h:108
std::optional< PrimType > classify(QualType Ty) const
Definition: Compiler.h:245
bool VisitCXXRewrittenBinaryOperator(const CXXRewrittenBinaryOperator *E)
Definition: Compiler.cpp:2975
bool VisitUnaryOperator(const UnaryOperator *E)
Definition: Compiler.cpp:4954
bool VisitFloatCompoundAssignOperator(const CompoundAssignOperator *E)
Definition: Compiler.cpp:2007
bool VisitGenericSelectionExpr(const GenericSelectionExpr *E)
Definition: Compiler.cpp:2754
bool visitDoStmt(const DoStmt *S)
Definition: Compiler.cpp:4431
bool VisitIntegerLiteral(const IntegerLiteral *E)
Definition: Compiler.cpp:650
std::optional< PrimType > classify(const Expr *E) const
Definition: Compiler.h:242
bool VisitInitListExpr(const InitListExpr *E)
Definition: Compiler.cpp:1581
bool VisitStringLiteral(const StringLiteral *E)
Definition: Compiler.cpp:1903
bool VisitParenExpr(const ParenExpr *E)
Definition: Compiler.cpp:688
bool VisitCXXNoexceptExpr(const CXXNoexceptExpr *E)
Definition: Compiler.cpp:2476
bool VisitShuffleVectorExpr(const ShuffleVectorExpr *E)
Definition: Compiler.cpp:3057
bool VisitPointerCompoundAssignOperator(const CompoundAssignOperator *E)
Definition: Compiler.cpp:2081
std::optional< LabelTy > OptLabelTy
Definition: Compiler.h:109
bool DiscardResult
Flag indicating if return value is to be discarded.
Definition: Compiler.h:383
bool VisitEmbedExpr(const EmbedExpr *E)
Definition: Compiler.cpp:1614
bool VisitConvertVectorExpr(const ConvertVectorExpr *E)
Definition: Compiler.cpp:3025
bool VisitCXXThisExpr(const CXXThisExpr *E)
Definition: Compiler.cpp:4213
bool VisitConstantExpr(const ConstantExpr *E)
Definition: Compiler.cpp:1598
unsigned allocateTemporary(const Expr *E)
Definition: Compiler.cpp:3555
bool VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *E)
Definition: Compiler.cpp:1643
bool visitSwitchStmt(const SwitchStmt *S)
Definition: Compiler.cpp:4580
bool VisitCXXUuidofExpr(const CXXUuidofExpr *E)
Definition: Compiler.cpp:2921
unsigned allocateLocalPrimitive(DeclTy &&Decl, PrimType Ty, bool IsConst, bool IsExtended=false)
Creates a local primitive value.
Definition: Compiler.cpp:3489
bool VisitExprWithCleanups(const ExprWithCleanups *E)
Definition: Compiler.cpp:2239
bool visitWhileStmt(const WhileStmt *S)
Definition: Compiler.cpp:4400
bool visitIfStmt(const IfStmt *IS)
Definition: Compiler.cpp:4357
bool VisitAddrLabelExpr(const AddrLabelExpr *E)
Definition: Compiler.cpp:3015
bool VisitFloatingLiteral(const FloatingLiteral *E)
Definition: Compiler.cpp:658
Program & P
Program to link to.
Definition: Compiler.h:115
bool VisitBuiltinCallExpr(const CallExpr *E)
Definition: Compiler.cpp:3925
bool VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *E)
Definition: Compiler.cpp:2249
bool VisitGNUNullExpr(const GNUNullExpr *E)
Definition: Compiler.cpp:4202
bool VisitImaginaryLiteral(const ImaginaryLiteral *E)
Definition: Compiler.cpp:666
bool VisitSYCLUniqueStableNameExpr(const SYCLUniqueStableNameExpr *E)
Definition: Compiler.cpp:1976
VarCreationState visitVarDecl(const VarDecl *VD, bool Toplevel=false)
Creates and initializes a variable from the given decl.
Definition: Compiler.cpp:3725
bool visitCXXTryStmt(const CXXTryStmt *S)
Definition: Compiler.cpp:4693
Holds all information required to evaluate constexpr code in a module.
Definition: Context.h:40
const LangOptions & getLangOpts() const
Returns the language options.
Definition: Context.cpp:128
std::optional< PrimType > classify(QualType T) const
Classifies a type.
Definition: Context.cpp:130
Scope used to handle temporaries in toplevel variable declarations.
Definition: Compiler.cpp:28
Bytecode function.
Definition: Function.h:77
InitLinkScope(Compiler< Emitter > *Ctx, InitLink &&Link)
Definition: Compiler.h:611
InitStackScope(Compiler< Emitter > *Ctx, bool Active)
Definition: Compiler.h:623
Scope managing label targets.
Definition: Compiler.cpp:99
Generic scope for local variables.
Definition: Compiler.h:474
LocalScope(Compiler< Emitter > *Ctx)
Definition: Compiler.h:476
~LocalScope() override
Emit a Destroy op for this scope.
Definition: Compiler.h:481
bool destroyLocals(const Expr *E=nullptr) override
Explicit destruction of local variables.
Definition: Compiler.h:498
LocalScope(Compiler< Emitter > *Ctx, const ValueDecl *VD)
Definition: Compiler.h:477
bool emitDestructors(const Expr *E=nullptr) override
Definition: Compiler.h:518
void emitDestruction() override
Overriden to support explicit destruction.
Definition: Compiler.h:489
void removeIfStoredOpaqueValue(const Scope::Local &Local)
Definition: Compiler.h:548
void addLocal(const Scope::Local &Local) override
Definition: Compiler.h:508
std::optional< unsigned > Idx
Index of the scope in the chain.
Definition: Compiler.h:558
Sets the context for break/continue statements.
Definition: Compiler.cpp:110
Scope used to handle initialization methods.
Definition: Compiler.cpp:52
The program contains and links the bytecode for all functions.
Definition: Program.h:39
Structure/Class descriptor.
Definition: Record.h:25
Describes the statement/declaration an opcode was generated from.
Definition: Source.h:77
SourceLocScope(Compiler< Emitter > *Ctx, const Expr *DefaultExpr)
Definition: Compiler.h:590
Scope chain managing the variable lifetimes.
Definition: Compiler.h:413
virtual void addExtended(const Scope::Local &Local)
Definition: Compiler.h:434
void addExtended(const Scope::Local &Local, const ValueDecl *ExtendingDecl)
Definition: Compiler.h:439
void add(const Scope::Local &Local, bool IsExtended)
Definition: Compiler.h:422
Compiler< Emitter > * Ctx
Compiler instance.
Definition: Compiler.h:467
virtual bool emitDestructors(const Expr *E=nullptr)
Definition: Compiler.h:461
virtual bool destroyLocals(const Expr *E=nullptr)
Definition: Compiler.h:462
VariableScope * getParent() const
Definition: Compiler.h:463
VariableScope * Parent
Link to the parent scope.
Definition: Compiler.h:469
virtual void addLocal(const Scope::Local &Local)
Definition: Compiler.h:429
VariableScope(Compiler< Emitter > *Ctx, const ValueDecl *VD)
Definition: Compiler.h:415
virtual void emitDestruction()
Definition: Compiler.h:460
Defines the clang::TargetInfo interface.
llvm::APInt APInt
Definition: Integral.h:29
unsigned llvm::PointerUnion< const Decl *, const Expr * > DeclTy
Definition: Descriptor.h:28
PrimType
Enumeration of the primitive types of the VM.
Definition: PrimType.h:33
bool Init(InterpState &S, CodePtr OpPC)
Definition: Interp.h:1745
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
unsigned long uint64_t
unsigned int uint32_t
#define bool
Definition: stdbool.h:24
Information about a local's storage.
Definition: Function.h:38
State encapsulating if a the variable creation has been successful, unsuccessful, or no variable has ...
Definition: Compiler.h:91
static VarCreationState NotCreated()
Definition: Compiler.h:95
std::optional< bool > S
Definition: Compiler.h:92