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 "DeclOrExpr.h"
18#include "EvalEmitter.h"
19#include "Pointer.h"
20#include "PrimType.h"
21#include "Record.h"
22#include "clang/AST/Decl.h"
23#include "clang/AST/Expr.h"
24#include "clang/AST/StmtVisitor.h"
25
26namespace clang {
27class QualType;
28
29namespace interp {
30
31template <class Emitter> class LocalScope;
32template <class Emitter> class VariableScope;
33template <class Emitter> class DeclScope;
34template <class Emitter> class InitLinkScope;
35template <class Emitter> class InitStackScope;
36template <class Emitter> class OptionScope;
37template <class Emitter> class ArrayIndexScope;
38template <class Emitter> class SourceLocScope;
39template <class Emitter> class LoopScope;
40template <class Emitter> class SwitchScope;
41template <class Emitter> class LocOverrideScope;
42
43template <class Emitter> class Compiler;
44struct InitLink {
45public:
46 enum {
47 K_This = 0,
48 K_Field = 1,
49 K_Base = 2,
50 K_Temp = 3,
51 K_Decl = 4,
52 K_Elem = 6,
53 K_RVO = 7,
54 K_InitList = 8,
55 K_DIE = 9,
56 };
57
58 static InitLink This() { return InitLink{K_This}; }
59 static InitLink InitList() { return InitLink{K_InitList}; }
60 static InitLink RVO() { return InitLink{K_RVO}; }
61 static InitLink DIE() { return InitLink{K_DIE}; }
62 static InitLink Field(unsigned Offset) {
63 InitLink IL{K_Field};
64 IL.Offset = Offset;
65 return IL;
66 }
67 static InitLink Base(unsigned Offset) {
68 InitLink IL{K_Base};
69 IL.Offset = Offset;
70 return IL;
71 }
72 static InitLink Temp(unsigned Offset) {
73 InitLink IL{K_Temp};
74 IL.Offset = Offset;
75 return IL;
76 }
77 static InitLink Decl(const ValueDecl *D) {
78 InitLink IL{K_Decl};
79 IL.D = D;
80 return IL;
81 }
82 static InitLink Elem(unsigned Index) {
83 InitLink IL{K_Elem};
84 IL.Offset = Index;
85 return IL;
86 }
87
88 InitLink(uint8_t Kind) : Kind(Kind) {}
89 template <class Emitter>
90 bool emit(Compiler<Emitter> *Ctx, const Expr *E) const;
91
92 uint32_t Kind;
93 union {
94 unsigned Offset;
95 const ValueDecl *D;
96 };
97};
98
99/// State encapsulating if a the variable creation has been successful,
100/// unsuccessful, or no variable has been created at all.
101struct VarCreationState {
102 std::optional<bool> S = std::nullopt;
103 VarCreationState() = default;
104 VarCreationState(bool b) : S(b) {}
105 static VarCreationState NotCreated() { return VarCreationState(); }
106
107 operator bool() const { return S && *S; }
108 bool notCreated() const { return !S; }
109};
110
111enum class ScopeKind { Block, FullExpression, Call };
112
113/// Compilation context for expressions.
114template <class Emitter>
115class Compiler final : public ConstStmtVisitor<Compiler<Emitter>, bool>,
116 public Emitter {
117protected:
118 // Aliases for types defined in the emitter.
119 using LabelTy = typename Emitter::LabelTy;
120 using AddrTy = typename Emitter::AddrTy;
121 using OptLabelTy = UnsignedOrNone;
122 using CaseMap = llvm::DenseMap<const SwitchCase *, LabelTy>;
123
124 struct LabelInfo {
125 const Stmt *Name;
126 const VariableScope<Emitter> *BreakOrContinueScope;
127 OptLabelTy BreakLabel;
128 OptLabelTy ContinueLabel;
129 OptLabelTy DefaultLabel;
130 LabelInfo(const Stmt *Name, OptLabelTy BreakLabel, OptLabelTy ContinueLabel,
131 OptLabelTy DefaultLabel,
132 const VariableScope<Emitter> *BreakOrContinueScope)
133 : Name(Name), BreakOrContinueScope(BreakOrContinueScope),
134 BreakLabel(BreakLabel), ContinueLabel(ContinueLabel),
135 DefaultLabel(DefaultLabel) {}
136 };
137
138 /// Current compilation context.
139 Context &Ctx;
140 /// Program to link to.
141 Program &P;
142
143public:
144 /// Initializes the compiler and the backend emitter.
145 template <typename... Tys>
146 Compiler(Context &Ctx, Program &P, Tys &&...Args)
147 : Emitter(Ctx, P, Args...), Ctx(Ctx), P(P) {}
148
149 // Expressions.
150 bool VisitCastExpr(const CastExpr *E);
151 bool VisitBuiltinBitCastExpr(const BuiltinBitCastExpr *E);
152 bool VisitIntegerLiteral(const IntegerLiteral *E);
153 bool VisitFloatingLiteral(const FloatingLiteral *E);
154 bool VisitImaginaryLiteral(const ImaginaryLiteral *E);
155 bool VisitFixedPointLiteral(const FixedPointLiteral *E);
156 bool VisitParenExpr(const ParenExpr *E);
157 bool VisitBinaryOperator(const BinaryOperator *E);
158 bool VisitLogicalBinOp(const BinaryOperator *E);
159 bool VisitPointerArithBinOp(const BinaryOperator *E);
160 bool VisitComplexBinOp(const BinaryOperator *E);
161 bool VisitVectorBinOp(const BinaryOperator *E);
162 bool VisitFixedPointBinOp(const BinaryOperator *E);
163 bool VisitFixedPointUnaryOperator(const UnaryOperator *E);
164 bool VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *E);
165 bool VisitCallExpr(const CallExpr *E);
166 bool VisitBuiltinCallExpr(const CallExpr *E, unsigned BuiltinID);
167 bool VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *E);
168 bool VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *E);
169 bool VisitCXXNullPtrLiteralExpr(const CXXNullPtrLiteralExpr *E);
170 bool VisitGNUNullExpr(const GNUNullExpr *E);
171 bool VisitCXXThisExpr(const CXXThisExpr *E);
172 bool VisitUnaryOperator(const UnaryOperator *E);
173 bool VisitVectorUnaryOperator(const UnaryOperator *E);
174 bool VisitComplexUnaryOperator(const UnaryOperator *E);
175 bool VisitDeclRefExpr(const DeclRefExpr *E);
176 bool VisitImplicitValueInitExpr(const ImplicitValueInitExpr *E);
177 bool VisitSubstNonTypeTemplateParmExpr(const SubstNonTypeTemplateParmExpr *E);
178 bool VisitArraySubscriptExpr(const ArraySubscriptExpr *E);
179 bool VisitInitListExpr(const InitListExpr *E);
180 bool VisitCXXParenListInitExpr(const CXXParenListInitExpr *E);
181 bool VisitConstantExpr(const ConstantExpr *E);
182 bool VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *E);
183 bool VisitMemberExpr(const MemberExpr *E);
184 bool VisitArrayInitIndexExpr(const ArrayInitIndexExpr *E);
185 bool VisitArrayInitLoopExpr(const ArrayInitLoopExpr *E);
186 bool VisitOpaqueValueExpr(const OpaqueValueExpr *E);
187 bool VisitAbstractConditionalOperator(const AbstractConditionalOperator *E);
188 bool VisitStringLiteral(const StringLiteral *E);
189 bool VisitObjCStringLiteral(const ObjCStringLiteral *E);
190 bool VisitObjCEncodeExpr(const ObjCEncodeExpr *E);
191 bool VisitSYCLUniqueStableNameExpr(const SYCLUniqueStableNameExpr *E);
192 bool VisitCharacterLiteral(const CharacterLiteral *E);
193 bool VisitCompoundAssignOperator(const CompoundAssignOperator *E);
194 bool VisitFloatCompoundAssignOperator(const CompoundAssignOperator *E);
195 bool VisitPointerCompoundAssignOperator(const CompoundAssignOperator *E);
196 bool VisitExprWithCleanups(const ExprWithCleanups *E);
197 bool VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *E);
198 bool VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *E);
199 bool VisitCompoundLiteralExpr(const CompoundLiteralExpr *E);
200 bool VisitTypeTraitExpr(const TypeTraitExpr *E);
201 bool VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr *E);
202 bool VisitLambdaExpr(const LambdaExpr *E);
203 bool VisitPredefinedExpr(const PredefinedExpr *E);
204 bool VisitCXXThrowExpr(const CXXThrowExpr *E);
205 bool VisitCXXReinterpretCastExpr(const CXXReinterpretCastExpr *E);
206 bool VisitCXXDynamicCastExpr(const CXXDynamicCastExpr *E);
207 bool VisitCXXNoexceptExpr(const CXXNoexceptExpr *E);
208 bool VisitCXXConstructExpr(const CXXConstructExpr *E);
209 bool VisitSourceLocExpr(const SourceLocExpr *E);
210 bool VisitOffsetOfExpr(const OffsetOfExpr *E);
211 bool VisitCXXScalarValueInitExpr(const CXXScalarValueInitExpr *E);
212 bool VisitSizeOfPackExpr(const SizeOfPackExpr *E);
213 bool VisitGenericSelectionExpr(const GenericSelectionExpr *E);
214 bool VisitChooseExpr(const ChooseExpr *E);
215 bool VisitEmbedExpr(const EmbedExpr *E);
216 bool VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *E);
217 bool VisitCXXInheritedCtorInitExpr(const CXXInheritedCtorInitExpr *E);
218 bool VisitExpressionTraitExpr(const ExpressionTraitExpr *E);
219 bool VisitCXXUuidofExpr(const CXXUuidofExpr *E);
220 bool VisitRequiresExpr(const RequiresExpr *E);
221 bool VisitConceptSpecializationExpr(const ConceptSpecializationExpr *E);
222 bool VisitCXXRewrittenBinaryOperator(const CXXRewrittenBinaryOperator *E);
223 bool VisitPseudoObjectExpr(const PseudoObjectExpr *E);
224 bool VisitPackIndexingExpr(const PackIndexingExpr *E);
225 bool VisitRecoveryExpr(const RecoveryExpr *E);
226 bool VisitAddrLabelExpr(const AddrLabelExpr *E);
227 bool VisitConvertVectorExpr(const ConvertVectorExpr *E);
228 bool VisitShuffleVectorExpr(const ShuffleVectorExpr *E);
229 bool VisitExtVectorElementExpr(const ExtVectorElementExpr *E);
230 bool VisitObjCBoxedExpr(const ObjCBoxedExpr *E);
231 bool VisitCXXStdInitializerListExpr(const CXXStdInitializerListExpr *E);
232 bool VisitStmtExpr(const StmtExpr *E);
233 bool VisitCXXNewExpr(const CXXNewExpr *E);
234 bool VisitCXXDeleteExpr(const CXXDeleteExpr *E);
235 bool VisitBlockExpr(const BlockExpr *E);
236 bool VisitCXXTypeidExpr(const CXXTypeidExpr *E);
237 bool VisitObjCDictionaryLiteral(const ObjCDictionaryLiteral *E);
238 bool VisitObjCArrayLiteral(const ObjCArrayLiteral *E);
239 bool VisitCXXReflectExpr(const CXXReflectExpr *E);
240 bool VisitDesignatedInitUpdateExpr(const DesignatedInitUpdateExpr *E);
241
242 // Statements.
243 bool visitCompoundStmt(const CompoundStmt *S);
244 bool visitDeclStmt(const DeclStmt *DS, bool EvaluateConditionDecl = false);
245 bool visitReturnStmt(const ReturnStmt *RS);
246 bool visitIfStmt(const IfStmt *IS);
247 bool visitWhileStmt(const WhileStmt *S);
248 bool visitDoStmt(const DoStmt *S);
249 bool visitForStmt(const ForStmt *S);
250 bool visitCXXForRangeStmt(const CXXForRangeStmt *S);
251 bool visitBreakStmt(const BreakStmt *S);
252 bool visitContinueStmt(const ContinueStmt *S);
253 bool visitSwitchStmt(const SwitchStmt *S);
254 bool visitCaseStmt(const CaseStmt *S);
255 bool visitDefaultStmt(const DefaultStmt *S);
256 bool visitAttributedStmt(const AttributedStmt *S);
257 bool visitCXXTryStmt(const CXXTryStmt *S);
258 bool
259 visitCXXExpansionStmtInstantiation(const CXXExpansionStmtInstantiation *S);
260
261 bool registerRedecl(const VarDecl *VD, const APValue &V);
262
263protected:
264 bool visitStmt(const Stmt *S);
265 bool visitExpr(const Expr *E, bool DestroyToplevelScope) override;
266 bool visitLValueExpr(const Expr *E, bool DestroyToplevelScope) override;
267 bool visitFunc(const FunctionDecl *F) override;
268
269 bool visitDeclAndReturn(const VarDecl *VD, const Expr *Init,
270 bool ConstantContext) override;
271 bool visitDtorCall(const VarDecl *VD, const APValue &Value) override;
272 bool visitWithSubstitutions(const FunctionDecl *Callee,
273 ArrayRef<const Expr *> Args, const Expr *This,
274 const Expr *Condition) override;
275
276protected:
277 /// Emits scope cleanup instructions.
278 bool emitCleanup();
279
280 /// Returns a record type from a record or pointer type.
281 const RecordType *getRecordTy(QualType Ty);
282
283 /// Returns a record from a record or pointer type.
284 Record *getRecord(QualType Ty);
285 Record *getRecord(const RecordDecl *RD);
286
287 /// Returns a function for the given FunctionDecl.
288 /// If the function does not exist yet, it is compiled.
289 const Function *getFunction(const FunctionDecl *FD);
290
291 OptPrimType classify(const Expr *E) const { return Ctx.classify(E); }
292 OptPrimType classify(QualType Ty) const { return Ctx.classify(T: Ty); }
293 bool canClassify(const Expr *E) const { return Ctx.canClassify(E); }
294 bool canClassify(QualType T) const { return Ctx.canClassify(T); }
295
296 /// Classifies a known primitive type.
297 PrimType classifyPrim(QualType Ty) const {
298 if (auto T = classify(Ty)) {
299 return *T;
300 }
301 llvm_unreachable("not a primitive type");
302 }
303 /// Classifies a known primitive expression.
304 PrimType classifyPrim(const Expr *E) const {
305 if (auto T = classify(E))
306 return *T;
307 llvm_unreachable("not a primitive type");
308 }
309
310 /// Evaluates an expression and places the result on the stack. If the
311 /// expression is of composite type, a local variable will be created
312 /// and a pointer to said variable will be placed on the stack.
313 bool visit(const Expr *E) override;
314 /// Compiles an initializer. This is like visit() but it will never
315 /// create a variable and instead rely on a variable already having
316 /// been created. visitInitializer() then relies on a pointer to this
317 /// variable being on top of the stack.
318 bool visitInitializer(const Expr *E);
319 /// Similar, but will also pop the pointer.
320 bool visitInitializerPop(const Expr *E);
321 bool visitAsLValue(const Expr *E);
322 /// Evaluates an expression for side effects and discards the result.
323 bool discard(const Expr *E);
324 /// Just pass evaluation on to \p E. This leaves all the parsing flags
325 /// intact.
326 bool delegate(const Expr *E);
327 /// Creates and initializes a variable from the given decl.
328 VarCreationState visitVarDecl(const VarDecl *VD, const Expr *Init,
329 bool Toplevel = false);
330 VarCreationState visitDecl(const VarDecl *VD);
331 /// Visit an APValue.
332 bool visitAPValue(const APValue &Val, PrimType ValType, SourceInfo Info);
333 bool visitAPValueInitializer(const APValue &Val, SourceInfo Info, QualType T,
334 bool IsCompleteClass = true);
335 /// Visit the given decl as if we have a reference to it.
336 bool visitDeclRef(const ValueDecl *D, const Expr *E);
337
338 /// Visits an expression and converts it to a boolean.
339 bool visitBool(const Expr *E);
340
341 bool visitInitList(ArrayRef<const Expr *> Inits, const Expr *ArrayFiller,
342 const Expr *E);
343 bool visitArrayElemInit(unsigned ElemIndex, const Expr *Init,
344 OptPrimType InitT);
345 bool visitCallArgs(ArrayRef<const Expr *> Args, const FunctionDecl *FuncDecl,
346 bool Activate, bool IsOperatorCall);
347
348 /// Creates a local primitive value.
349 unsigned allocateLocalPrimitive(DeclOrExpr Decl, PrimType Ty, bool IsConst,
350 bool IsVolatile = false,
351 ScopeKind SC = ScopeKind::Block);
352
353 /// Allocates a space storing a local given its type.
354 UnsignedOrNone allocateLocal(DeclOrExpr Decl, QualType Ty = QualType(),
355 ScopeKind = ScopeKind::Block);
356 UnsignedOrNone allocateTemporary(const Expr *E);
357
358private:
359 friend class VariableScope<Emitter>;
360 friend class LocalScope<Emitter>;
361 friend class DeclScope<Emitter>;
362 friend class InitLinkScope<Emitter>;
363 friend class InitStackScope<Emitter>;
364 friend class OptionScope<Emitter>;
365 friend class ArrayIndexScope<Emitter>;
366 friend class SourceLocScope<Emitter>;
367 friend struct InitLink;
368 friend class LoopScope<Emitter>;
369 friend class SwitchScope<Emitter>;
370 friend class LocOverrideScope<Emitter>;
371
372 /// Emits a zero initializer.
373 bool visitZeroInitializer(PrimType T, QualType QT, const Expr *E);
374 bool visitZeroRecordInitializer(const Record *R, const Expr *E,
375 bool IsCompleteClass = true);
376 bool visitZeroArrayInitializer(QualType T, const Expr *E);
377 bool visitAssignment(const Expr *LHS, const Expr *RHS, const Expr *E);
378
379 /// Emits an APSInt constant.
380 bool emitConst(const llvm::APSInt &Value, PrimType Ty, SourceInfo Info);
381 bool emitConst(const llvm::APInt &Value, PrimType Ty, SourceInfo Info);
382 bool emitConst(const llvm::APSInt &Value, const Expr *E);
383 bool emitConst(const llvm::APInt &Value, const Expr *E) {
384 return emitConst(Value, classifyPrim(E), E);
385 }
386
387 /// Emits an integer constant.
388 template <typename T> bool emitConst(T Value, PrimType Ty, SourceInfo Info);
389 template <typename T> bool emitConst(T Value, const Expr *E);
390 bool emitBool(bool V, const Expr *E) override {
391 return this->emitConst(V, E);
392 }
393
394 llvm::RoundingMode getRoundingMode(const Expr *E) const {
395 FPOptions FPO = E->getFPFeaturesInEffect(LO: Ctx.getLangOpts());
396
397 if (FPO.getRoundingMode() == llvm::RoundingMode::Dynamic)
398 return llvm::RoundingMode::NearestTiesToEven;
399
400 return FPO.getRoundingMode();
401 }
402
403 uint32_t getFPOptions(const Expr *E) const {
404 return E->getFPFeaturesInEffect(LO: Ctx.getLangOpts()).getAsOpaqueInt();
405 }
406
407 bool emitPrimCast(PrimType FromT, PrimType ToT, QualType ToQT, const Expr *E);
408 bool emitIntegralCast(PrimType FromT, PrimType ToT, QualType ToQT,
409 const Expr *E);
410 PrimType classifyComplexElementType(QualType T) const {
411 assert(T->isAnyComplexType());
412
413 QualType ElemType = T->getAs<ComplexType>()->getElementType();
414
415 return *this->classify(ElemType);
416 }
417
418 PrimType classifyVectorElementType(QualType T) const {
419 assert(T->isVectorType());
420 return *this->classify(T->getAs<VectorType>()->getElementType());
421 }
422
423 PrimType classifyMatrixElementType(QualType T) const {
424 assert(T->isMatrixType());
425 return *this->classify(T->getAs<MatrixType>()->getElementType());
426 }
427
428 bool emitComplexReal(const Expr *SubExpr);
429 bool emitComplexBoolCast(const Expr *E);
430 bool emitComplexComparison(const Expr *LHS, const Expr *RHS,
431 const BinaryOperator *E);
432 bool emitRecordDestructionPop(const Record *R, SourceInfo Loc);
433 bool emitDestructionPop(const Descriptor *Desc, SourceInfo Loc);
434 bool emitDummyPtr(DeclOrExpr D, const Expr *E, bool CU = false);
435 bool emitFloat(const APFloat &F, SourceInfo Info);
436 unsigned collectBaseOffset(const QualType BaseType,
437 const QualType DerivedType);
438 bool emitLambdaStaticInvokerBody(const CXXMethodDecl *MD);
439 bool emitBuiltinBitCast(const CastExpr *E);
440
441 bool emitHLSLAggregateSplat(PrimType SrcT, unsigned SrcOffset,
442 QualType DestType, const Expr *E);
443 bool emitVectorConversion(const Expr *Src, const Expr *E);
444
445 /// A scalar element extracted during HLSL aggregate flattening.
446 struct HLSLFlatElement {
447 unsigned LocalOffset;
448 PrimType Type;
449 };
450 unsigned countHLSLFlatElements(QualType Ty);
451 bool emitHLSLFlattenAggregate(QualType SrcType, unsigned SrcPtrOffset,
452 SmallVectorImpl<HLSLFlatElement> &Elements,
453 unsigned MaxElements, const Expr *E);
454 bool emitHLSLConstructAggregate(QualType DestType,
455 ArrayRef<HLSLFlatElement> Elements,
456 unsigned &ElemIdx, const Expr *E);
457 bool emitHLSLConstructAggregate(QualType DestType,
458 ArrayRef<HLSLFlatElement> Elements,
459 const Expr *E) {
460 unsigned ElemIdx = 0;
461 return emitHLSLConstructAggregate(DestType, Elements, ElemIdx, E);
462 }
463
464 bool compileConstructor(const CXXConstructorDecl *Ctor);
465 bool compileDestructor(const CXXDestructorDecl *Dtor);
466 bool compileUnionAssignmentOperator(const CXXMethodDecl *MD);
467
468 bool checkLiteralType(const Expr *E);
469 bool maybeEmitDeferredVarInit(const VarDecl *VD);
470
471 bool refersToUnion(const Expr *E);
472
473protected:
474 /// Variable to storage mapping.
475 llvm::DenseMap<const ValueDecl *, Scope::Local> Locals;
476
477 /// OpaqueValueExpr to location mapping.
478 llvm::DenseMap<const OpaqueValueExpr *, unsigned> OpaqueExprs;
479
480 /// Current scope.
481 VariableScope<Emitter> *VarScope = nullptr;
482
483 /// Current argument index. Needed to emit ArrayInitIndexExpr.
484 std::optional<uint64_t> ArrayIndex;
485
486 /// DefaultInit- or DefaultArgExpr, needed for SourceLocExpr.
487 const Expr *SourceLocDefaultExpr = nullptr;
488
489 /// Flag indicating if return value is to be discarded.
490 bool DiscardResult = false;
491
492 bool SwitchInStmtExpr = false;
493 bool InStmtExpr = false;
494 bool ToLValue = false;
495
496 bool VariablesAreConstexprUnknown = false;
497
498 /// Flag inidicating if we're initializing an already created
499 /// variable. This is set in visitInitializer().
500 bool Initializing = false;
501 const VarDecl *InitializingDecl = nullptr;
502
503 llvm::SmallVector<InitLink> InitStack;
504 bool InitStackActive = false;
505
506 /// Type of the expression returned by the function.
507 OptPrimType ReturnType;
508
509 /// Switch case mapping.
510 CaseMap CaseLabels;
511 /// Stack of label information for loops and switch statements.
512 llvm::SmallVector<LabelInfo> LabelInfoStack;
513
514 const FunctionDecl *CompilingFunction = nullptr;
515};
516
517extern template class Compiler<ByteCodeEmitter>;
518extern template class Compiler<EvalEmitter>;
519
520} // namespace interp
521} // namespace clang
522
523#endif
524