13#ifndef LLVM_CLANG_AST_STMT_H
14#define LLVM_CLANG_AST_STMT_H
30#include "llvm/ADT/APFloat.h"
31#include "llvm/ADT/ArrayRef.h"
32#include "llvm/ADT/BitmaskEnum.h"
33#include "llvm/ADT/PointerIntPair.h"
34#include "llvm/ADT/StringRef.h"
35#include "llvm/ADT/iterator.h"
36#include "llvm/ADT/iterator_range.h"
37#include "llvm/Support/Casting.h"
38#include "llvm/Support/Compiler.h"
39#include "llvm/Support/ErrorHandling.h"
49class FoldingSetNodeID;
84class alignas(void *)
Stmt {
88#define STMT(CLASS, PARENT) CLASS##Class,
89#define STMT_RANGE(BASE, FIRST, LAST) \
90 first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class,
91#define LAST_STMT_RANGE(BASE, FIRST, LAST) \
92 first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class
93#define ABSTRACT_STMT(STMT)
94#include "clang/AST/StmtNodes.inc"
102 void *
operator new(
size_t bytes)
noexcept {
103 llvm_unreachable(
"Stmts cannot be allocated with regular 'new'.");
106 void operator delete(
void *data)
noexcept {
107 llvm_unreachable(
"Stmts cannot be released with regular 'delete'.");
136 LLVM_PREFERRED_TYPE(
bool)
137 unsigned HasLeadingEmptyMacro : 1;
152 LLVM_PREFERRED_TYPE(
bool)
153 unsigned HasFPFeatures : 1;
193 LLVM_PREFERRED_TYPE(
bool)
194 unsigned HasElse : 1;
197 LLVM_PREFERRED_TYPE(
bool)
201 LLVM_PREFERRED_TYPE(
bool)
202 unsigned HasInit : 1;
215 LLVM_PREFERRED_TYPE(
bool)
216 unsigned HasInit : 1;
219 LLVM_PREFERRED_TYPE(
bool)
225 LLVM_PREFERRED_TYPE(
bool)
226 unsigned AllEnumCasesCovered : 1;
240 LLVM_PREFERRED_TYPE(
bool)
305 LLVM_PREFERRED_TYPE(
bool)
306 unsigned HasNRVOCandidate : 1;
321 LLVM_PREFERRED_TYPE(
bool)
322 unsigned CaseStmtIsGNURange : 1;
358 unsigned ValueKind : 2;
360 unsigned ObjectKind : 3;
362 unsigned Dependent : llvm::BitWidth<ExprDependence>;
376 unsigned ResultKind : 2;
380 unsigned APValueKind : 4;
384 LLVM_PREFERRED_TYPE(
bool)
385 unsigned IsUnsigned : 1;
391 unsigned BitWidth : 7;
395 LLVM_PREFERRED_TYPE(
bool)
396 unsigned HasCleanup : 1;
399 LLVM_PREFERRED_TYPE(
bool)
400 unsigned IsImmediateInvocation : 1;
415 LLVM_PREFERRED_TYPE(
bool)
416 unsigned HasFunctionName : 1;
420 LLVM_PREFERRED_TYPE(
bool)
421 unsigned IsTransparent : 1;
434 LLVM_PREFERRED_TYPE(
bool)
435 unsigned HasQualifier : 1;
436 LLVM_PREFERRED_TYPE(
bool)
437 unsigned HasTemplateKWAndArgsInfo : 1;
438 LLVM_PREFERRED_TYPE(
bool)
439 unsigned HasFoundDecl : 1;
440 LLVM_PREFERRED_TYPE(
bool)
441 unsigned HadMultipleCandidates : 1;
442 LLVM_PREFERRED_TYPE(
bool)
443 unsigned RefersToEnclosingVariableOrCapture : 1;
444 LLVM_PREFERRED_TYPE(
bool)
445 unsigned CapturedByCopyInLambdaWithExplicitObjectParameter : 1;
448 LLVM_PREFERRED_TYPE(
bool)
449 unsigned IsImmediateEscalating : 1;
463 llvm::APFloat::S_MaxSemantics < 16,
464 "Too many Semantics enum values to fit in bitfield of size 4");
465 LLVM_PREFERRED_TYPE(llvm::APFloat::Semantics)
466 unsigned Semantics : 4;
467 LLVM_PREFERRED_TYPE(
bool)
468 unsigned IsExact : 1;
486 unsigned CharByteWidth : 3;
488 LLVM_PREFERRED_TYPE(
bool)
489 unsigned IsPascal : 1;
493 unsigned NumConcatenated;
514 LLVM_PREFERRED_TYPE(
bool)
515 unsigned CanOverflow : 1;
520 LLVM_PREFERRED_TYPE(
bool)
521 unsigned HasFPFeatures : 1;
534 LLVM_PREFERRED_TYPE(
bool)
554 unsigned NumPreArgs : 1;
557 LLVM_PREFERRED_TYPE(
bool)
558 unsigned UsesADL : 1;
561 LLVM_PREFERRED_TYPE(
bool)
562 unsigned HasFPFeatures : 1;
570 unsigned OffsetToTrailingObjects : 8;
582 LLVM_PREFERRED_TYPE(
bool)
583 unsigned IsArrow : 1;
589 LLVM_PREFERRED_TYPE(
bool)
590 unsigned HasQualifierOrFoundDecl : 1;
597 LLVM_PREFERRED_TYPE(
bool)
598 unsigned HasTemplateKWAndArgsInfo : 1;
602 LLVM_PREFERRED_TYPE(
bool)
603 unsigned HadMultipleCandidates : 1;
624 LLVM_PREFERRED_TYPE(
bool)
625 unsigned PartOfExplicitCast : 1;
628 LLVM_PREFERRED_TYPE(
bool)
629 unsigned HasFPFeatures : 1;
633 unsigned BasePathSize;
648 LLVM_PREFERRED_TYPE(
bool)
649 unsigned HasFPFeatures : 1;
662 LLVM_PREFERRED_TYPE(
bool)
663 unsigned HadArrayRangeDesignator : 1;
695 unsigned NumSubExprs : 16;
696 unsigned ResultIndex : 16;
722 unsigned TemplateDepth;
737 unsigned OperatorKind : 6;
747 LLVM_PREFERRED_TYPE(
bool)
748 unsigned IsReversed : 1;
758 LLVM_PREFERRED_TYPE(
bool)
782 LLVM_PREFERRED_TYPE(
bool)
783 unsigned IsImplicit : 1;
797 LLVM_PREFERRED_TYPE(
bool)
798 unsigned IsThrownVariableInScope : 1;
812 LLVM_PREFERRED_TYPE(
bool)
813 unsigned HasRewrittenInit : 1;
828 LLVM_PREFERRED_TYPE(
bool)
829 unsigned HasRewrittenInit : 1;
854 LLVM_PREFERRED_TYPE(
bool)
855 unsigned IsGlobalNew : 1;
859 LLVM_PREFERRED_TYPE(
bool)
860 unsigned IsArray : 1;
863 LLVM_PREFERRED_TYPE(
bool)
864 unsigned ShouldPassAlignment : 1;
868 LLVM_PREFERRED_TYPE(
bool)
869 unsigned UsualArrayDeleteWantsSize : 1;
875 unsigned StoredInitializationStyle : 2;
878 LLVM_PREFERRED_TYPE(
bool)
879 unsigned IsParenTypeId : 1;
882 unsigned NumPlacementArgs;
893 LLVM_PREFERRED_TYPE(
bool)
894 unsigned GlobalDelete : 1;
897 LLVM_PREFERRED_TYPE(
bool)
898 unsigned ArrayForm : 1;
903 LLVM_PREFERRED_TYPE(
bool)
904 unsigned ArrayFormAsWritten : 1;
908 LLVM_PREFERRED_TYPE(
bool)
909 unsigned UsualArrayDeleteWantsSize : 1;
929 LLVM_PREFERRED_TYPE(
bool)
948 LLVM_PREFERRED_TYPE(
bool)
949 unsigned HasTemplateKWAndArgsInfo : 1;
959 LLVM_PREFERRED_TYPE(
bool)
960 unsigned Elidable : 1;
961 LLVM_PREFERRED_TYPE(
bool)
962 unsigned HadMultipleCandidates : 1;
963 LLVM_PREFERRED_TYPE(
bool)
964 unsigned ListInitialization : 1;
965 LLVM_PREFERRED_TYPE(
bool)
966 unsigned StdInitListInitialization : 1;
967 LLVM_PREFERRED_TYPE(
bool)
968 unsigned ZeroInitialization : 1;
970 unsigned ConstructionKind : 3;
971 LLVM_PREFERRED_TYPE(
bool)
972 unsigned IsImmediateEscalating : 1;
985 LLVM_PREFERRED_TYPE(
bool)
986 unsigned CleanupsHaveSideEffects : 1;
1011 LLVM_PREFERRED_TYPE(
bool)
1012 unsigned IsArrow : 1;
1016 LLVM_PREFERRED_TYPE(
bool)
1017 unsigned HasTemplateKWAndArgsInfo : 1;
1021 LLVM_PREFERRED_TYPE(
bool)
1022 unsigned HasFirstQualifierFoundInScope : 1;
1037 LLVM_PREFERRED_TYPE(
bool)
1038 unsigned HasTemplateKWAndArgsInfo : 1;
1046 unsigned NumResults;
1059 LLVM_PREFERRED_TYPE(
bool)
1060 unsigned RequiresADL : 1;
1064 LLVM_PREFERRED_TYPE(
bool)
1065 unsigned Overloaded : 1;
1068 "UnresolvedLookupExprBitfields must be <= than 4 bytes to"
1069 "avoid trashing OverloadExprBitfields::NumResults!");
1080 LLVM_PREFERRED_TYPE(
bool)
1081 unsigned IsArrow : 1;
1084 LLVM_PREFERRED_TYPE(
bool)
1085 unsigned HasUnresolvedUsing : 1;
1088 "UnresolvedMemberExprBitfields must be <= than 4 bytes to"
1089 "avoid trashing OverloadExprBitfields::NumResults!");
1098 LLVM_PREFERRED_TYPE(
bool)
1124 unsigned CaptureDefault : 2;
1128 LLVM_PREFERRED_TYPE(
bool)
1129 unsigned ExplicitParams : 1;
1132 LLVM_PREFERRED_TYPE(
bool)
1133 unsigned ExplicitResultType : 1;
1136 unsigned NumCaptures : 16;
1147 LLVM_PREFERRED_TYPE(
bool)
1148 unsigned IsSatisfied : 1;
1160 LLVM_PREFERRED_TYPE(
bool)
1161 unsigned IsImplicit : 1;
1172 LLVM_PREFERRED_TYPE(
bool)
1173 unsigned ShouldCopy : 1;
1187 LLVM_PREFERRED_TYPE(
bool)
1188 unsigned IsUnique : 1;
1276 unsigned alignment = 8);
1279 unsigned alignment = 8) {
1280 return operator new(
bytes, *
C, alignment);
1283 void *
operator new(
size_t bytes,
void *mem)
noexcept {
return mem; }
1287 void operator delete(
void *,
size_t)
noexcept {}
1288 void operator delete(
void *,
void *)
noexcept {}
1309 template<
typename T,
typename TPtr = T *,
typename StmtPtr = Stmt *>
1311 : llvm::iterator_adaptor_base<CastIterator<T, TPtr, StmtPtr>, StmtPtr *,
1312 std::random_access_iterator_tag, TPtr> {
1313 using Base =
typename CastIterator::iterator_adaptor_base;
1319 return cast_or_null<T>(*this->I);
1324 template <
typename T>
1332 static bool StatisticsEnabled;
1346 static_assert(
sizeof(*this) <= 8,
1347 "changing bitfields changed sizeof(Stmt)");
1348 static_assert(
sizeof(*this) %
alignof(
void *) == 0,
1349 "Insufficient alignment!");
1389 static
std::tuple<
bool, const
Attr *, const
Attr *>
1408 StringRef NewlineSymbol = "\n",
1412 unsigned Indentation = 0,
1413 StringRef NewlineSymbol = "\n",
1433 return const_cast<Stmt*
>(
1477 bool Canonical,
bool ProfileLambdaExpr =
false)
const;
1499 :
Stmt(DeclStmtClass), DG(dg), StartLoc(startLoc), EndLoc(endLoc) {}
1568 :
Stmt(NullStmtClass) {
1602 private llvm::TrailingObjects<CompoundStmt, Stmt *, FPOptionsOverride> {
1604 friend TrailingObjects;
1621 *getTrailingObjects<FPOptionsOverride>() = F;
1624 size_t numTrailingObjects(OverloadToken<Stmt *>)
const {
1629 static CompoundStmt *
Create(
const ASTContext &
C, ArrayRef<Stmt *> Stmts,
1630 FPOptionsOverride FPFeatures, SourceLocation LB,
1635 :
Stmt(CompoundStmtClass), LBraceLoc(Loc), RBraceLoc(Loc) {
1642 bool HasFPFeatures);
1652 return *getTrailingObjects<FPOptionsOverride>();
1675 return getTrailingObjects<Stmt *>();
1699 std::reverse_iterator<const_body_iterator>;
1718 for (
auto *B : llvm::reverse(
body())) {
1719 if (!isa<NullStmt>(B))
1786 return T->getStmtClass() == CaseStmtClass ||
1787 T->getStmtClass() == DefaultStmtClass;
1795 private llvm::TrailingObjects<CaseStmt, Stmt *, SourceLocation> {
1796 friend TrailingObjects;
1813 enum { LhsOffset = 0, SubStmtOffsetFromRhs = 1 };
1814 enum { NumMandatoryStmtPtr = 2 };
1816 unsigned numTrailingObjects(OverloadToken<Stmt *>)
const {
1820 unsigned numTrailingObjects(OverloadToken<SourceLocation>)
const {
1824 unsigned lhsOffset()
const {
return LhsOffset; }
1826 unsigned subStmtOffset()
const {
return rhsOffset() + SubStmtOffsetFromRhs; }
1832 :
SwitchCase(CaseStmtClass, caseLoc, colonLoc) {
1834 bool IsGNURange = rhs !=
nullptr;
1878 "setEllipsisLoc but this is not a case stmt of the form LHS ... RHS!");
1879 *getTrailingObjects<SourceLocation>() = L;
1883 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[lhsOffset()]);
1887 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[lhsOffset()]);
1891 getTrailingObjects<Stmt *>()[lhsOffset()] =
reinterpret_cast<Stmt *
>(Val);
1896 getTrailingObjects<Stmt *>()[rhsOffset()])
1902 getTrailingObjects<Stmt *>()[rhsOffset()])
1908 "setRHS but this is not a case stmt of the form LHS ... RHS!");
1909 getTrailingObjects<Stmt *>()[rhsOffset()] =
reinterpret_cast<Stmt *
>(Val);
1914 return getTrailingObjects<Stmt *>()[subStmtOffset()];
1918 getTrailingObjects<Stmt *>()[subStmtOffset()] = S;
1925 while (
const auto *CS2 = dyn_cast<CaseStmt>(CS->
getSubStmt()))
1938 getTrailingObjects<Stmt *>() +
1939 numTrailingObjects(OverloadToken<Stmt *>()));
1944 getTrailingObjects<Stmt *>() +
1945 numTrailingObjects(OverloadToken<Stmt *>()));
1954 :
SwitchCase(DefaultStmtClass, DL, CL), SubStmt(substmt) {}
1985 if (
const auto *CS = dyn_cast<CaseStmt>(
this))
1986 return CS->getEndLoc();
1987 else if (
const auto *DS = dyn_cast<DefaultStmt>(
this))
1988 return DS->getEndLoc();
1989 llvm_unreachable(
"SwitchCase is neither a CaseStmt nor a DefaultStmt!");
1993 if (
auto *CS = dyn_cast<CaseStmt>(
this))
1994 return CS->getSubStmt();
1995 else if (
auto *DS = dyn_cast<DefaultStmt>(
this))
1996 return DS->getSubStmt();
1997 llvm_unreachable(
"SwitchCase is neither a CaseStmt nor a DefaultStmt!");
2028 bool SideEntry =
false;
2033 :
ValueStmt(LabelStmtClass), TheDecl(D), SubStmt(substmt) {
2074 private llvm::TrailingObjects<AttributedStmt, const Attr *> {
2076 friend TrailingObjects;
2082 :
ValueStmt(AttributedStmtClass), SubStmt(SubStmt) {
2085 std::copy(Attrs.begin(), Attrs.end(), getAttrArrayPtr());
2089 :
ValueStmt(AttributedStmtClass, Empty) {
2092 std::fill_n(getAttrArrayPtr(), NumAttrs,
nullptr);
2095 const Attr *
const *getAttrArrayPtr()
const {
2096 return getTrailingObjects<const Attr *>();
2098 const Attr **getAttrArrayPtr() {
return getTrailingObjects<const Attr *>(); }
2101 static AttributedStmt *
Create(
const ASTContext &
C, SourceLocation Loc,
2102 ArrayRef<const Attr *> Attrs,
Stmt *SubStmt);
2105 static AttributedStmt *
CreateEmpty(
const ASTContext &
C,
unsigned NumAttrs);
2132 private llvm::TrailingObjects<IfStmt, Stmt *, SourceLocation> {
2133 friend TrailingObjects;
2157 enum { InitOffset = 0, ThenOffsetFromCond = 1, ElseOffsetFromCond = 2 };
2158 enum { NumMandatoryStmtPtr = 2 };
2162 unsigned numTrailingObjects(OverloadToken<Stmt *>)
const {
2167 unsigned numTrailingObjects(OverloadToken<SourceLocation>)
const {
2171 unsigned initOffset()
const {
return InitOffset; }
2172 unsigned varOffset()
const {
return InitOffset +
hasInitStorage(); }
2173 unsigned condOffset()
const {
2176 unsigned thenOffset()
const {
return condOffset() + ThenOffsetFromCond; }
2177 unsigned elseOffset()
const {
return condOffset() + ElseOffsetFromCond; }
2185 explicit IfStmt(
EmptyShell Empty,
bool HasElse,
bool HasVar,
bool HasInit);
2193 Stmt *Else =
nullptr);
2210 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[condOffset()]);
2214 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[condOffset()]);
2218 getTrailingObjects<Stmt *>()[condOffset()] =
reinterpret_cast<Stmt *
>(Cond);
2221 Stmt *
getThen() {
return getTrailingObjects<Stmt *>()[thenOffset()]; }
2223 return getTrailingObjects<Stmt *>()[thenOffset()];
2227 getTrailingObjects<Stmt *>()[thenOffset()] = Then;
2231 return hasElseStorage() ? getTrailingObjects<Stmt *>()[elseOffset()]
2236 return hasElseStorage() ? getTrailingObjects<Stmt *>()[elseOffset()]
2242 "This if statement has no storage for an else statement!");
2243 getTrailingObjects<Stmt *>()[elseOffset()] = Else;
2267 getTrailingObjects<Stmt *>()[varOffset()])
2273 getTrailingObjects<Stmt *>()[varOffset()])
2279 getTrailingObjects<Stmt *>()[varOffset()] = CondVar;
2283 return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
2288 return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
2294 "This if statement has no storage for an init statement!");
2295 getTrailingObjects<Stmt *>()[initOffset()] =
Init;
2308 "This if statement has no storage for an else statement!");
2309 *getTrailingObjects<SourceLocation>() = ElseLoc;
2330 IfStmtBits.Kind =
static_cast<unsigned>(Kind);
2362 getTrailingObjects<Stmt *>() +
2363 numTrailingObjects(OverloadToken<Stmt *>()));
2371 getTrailingObjects<Stmt *>() +
2372 numTrailingObjects(OverloadToken<Stmt *>()));
2382 private llvm::TrailingObjects<SwitchStmt, Stmt *> {
2383 friend TrailingObjects;
2405 enum { InitOffset = 0, BodyOffsetFromCond = 1 };
2406 enum { NumMandatoryStmtPtr = 2 };
2410 unsigned numTrailingObjects(OverloadToken<Stmt *>)
const {
2414 unsigned initOffset()
const {
return InitOffset; }
2415 unsigned varOffset()
const {
return InitOffset +
hasInitStorage(); }
2416 unsigned condOffset()
const {
2419 unsigned bodyOffset()
const {
return condOffset() + BodyOffsetFromCond; }
2446 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[condOffset()]);
2450 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[condOffset()]);
2454 getTrailingObjects<Stmt *>()[condOffset()] =
reinterpret_cast<Stmt *
>(Cond);
2457 Stmt *
getBody() {
return getTrailingObjects<Stmt *>()[bodyOffset()]; }
2459 return getTrailingObjects<Stmt *>()[bodyOffset()];
2463 getTrailingObjects<Stmt *>()[bodyOffset()] = Body;
2467 return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
2472 return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
2478 "This switch statement has no storage for an init statement!");
2479 getTrailingObjects<Stmt *>()[initOffset()] =
Init;
2504 getTrailingObjects<Stmt *>()[varOffset()])
2510 getTrailingObjects<Stmt *>()[varOffset()])
2516 getTrailingObjects<Stmt *>()[varOffset()] = CondVar;
2537 "case/default already added to a switch");
2561 getTrailingObjects<Stmt *>() +
2562 numTrailingObjects(OverloadToken<Stmt *>()));
2567 getTrailingObjects<Stmt *>() +
2568 numTrailingObjects(OverloadToken<Stmt *>()));
2578 private llvm::TrailingObjects<WhileStmt, Stmt *> {
2579 friend TrailingObjects;
2596 enum { VarOffset = 0, BodyOffsetFromCond = 1 };
2597 enum { NumMandatoryStmtPtr = 2 };
2601 unsigned varOffset()
const {
return VarOffset; }
2602 unsigned condOffset()
const {
return VarOffset +
hasVarStorage(); }
2603 unsigned bodyOffset()
const {
return condOffset() + BodyOffsetFromCond; }
2605 unsigned numTrailingObjects(OverloadToken<Stmt *>)
const {
2631 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[condOffset()]);
2635 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[condOffset()]);
2639 getTrailingObjects<Stmt *>()[condOffset()] =
reinterpret_cast<Stmt *
>(Cond);
2642 Stmt *
getBody() {
return getTrailingObjects<Stmt *>()[bodyOffset()]; }
2644 return getTrailingObjects<Stmt *>()[bodyOffset()];
2648 getTrailingObjects<Stmt *>()[bodyOffset()] = Body;
2672 getTrailingObjects<Stmt *>()[varOffset()])
2678 getTrailingObjects<Stmt *>()[varOffset()])
2684 getTrailingObjects<Stmt *>()[varOffset()] = CondVar;
2707 getTrailingObjects<Stmt *>() +
2708 numTrailingObjects(OverloadToken<Stmt *>()));
2713 getTrailingObjects<Stmt *>() +
2714 numTrailingObjects(OverloadToken<Stmt *>()));
2720 enum { BODY, COND, END_EXPR };
2721 Stmt *SubExprs[END_EXPR];
2728 :
Stmt(DoStmtClass), WhileLoc(WL), RParenLoc(RP) {
2739 return reinterpret_cast<Expr *
>(SubExprs[COND]);
2764 return child_range(&SubExprs[0], &SubExprs[0] + END_EXPR);
2778 enum { INIT, CONDVAR, COND, INC, BODY, END_EXPR };
2779 Stmt* SubExprs[END_EXPR];
2806 return reinterpret_cast<DeclStmt*
>(SubExprs[CONDVAR]);
2810 return reinterpret_cast<DeclStmt*
>(SubExprs[CONDVAR]);
2814 SubExprs[CONDVAR] = CondVar;
2847 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
2862 :
Stmt(GotoStmtClass),
Label(label), LabelLoc(LL) {
2901 :
Stmt(IndirectGotoStmtClass), StarLoc(starLoc) {
2908 :
Stmt(IndirectGotoStmtClass, Empty) {}
2917 return reinterpret_cast<const Expr *
>(
Target);
3013 private llvm::TrailingObjects<ReturnStmt, const VarDecl *> {
3014 friend TrailingObjects;
3023 bool hasNRVOCandidate()
const {
return ReturnStmtBits.HasNRVOCandidate; }
3025 unsigned numTrailingObjects(OverloadToken<const VarDecl *>)
const {
3026 return hasNRVOCandidate();
3038 const VarDecl *NRVOCandidate);
3054 return hasNRVOCandidate() ? *getTrailingObjects<const VarDecl *>()
3062 assert(hasNRVOCandidate() &&
3063 "This return statement has no storage for an NRVO candidate!");
3064 *getTrailingObjects<const VarDecl *>() = Var;
3115 unsigned numoutputs,
unsigned numinputs,
unsigned numclobbers)
3263 unsigned NumLabels = 0;
3267 bool isvolatile,
unsigned numoutputs,
unsigned numinputs,
3307 : MyKind(
Operand), Str(S), OperandNo(OpNo),
3321 assert(
isOperand() &&
"Range is currently used only for Operands.");
3347 return II->getName();
3355 return Constraints[i];
3358 return Constraints[i];
3375 return II->getName();
3399 return NumLabels > 0;
3442 void setOutputsAndInputsAndClobbers(
const ASTContext &
C,
3482 unsigned NumAsmToks = 0;
3484 Token *AsmToks =
nullptr;
3485 StringRef *Constraints =
nullptr;
3486 StringRef *Clobbers =
nullptr;
3519 return Constraints[i];
3560 void initialize(
const ASTContext &
C, StringRef AsmString,
3587 enum { FILTER_EXPR,
BLOCK };
3593 static SEHExceptStmt*
Create(
const ASTContext &
C,
3594 SourceLocation ExceptLoc,
3604 return reinterpret_cast<Expr*
>(Children[FILTER_EXPR]);
3608 return cast<CompoundStmt>(Children[
BLOCK]);
3667 enum { TRY = 0, HANDLER = 1 };
3677 static SEHTryStmt*
Create(
const ASTContext &
C,
bool isCXXTry,
3678 SourceLocation TryLoc,
Stmt *TryBlock,
3689 return cast<CompoundStmt>(Children[TRY]);
3717 :
Stmt(SEHLeaveStmtClass), LeaveLoc(LL) {}
3765 llvm::PointerIntPair<VarDecl *, 2, VariableCaptureKind> VarAndKind;
3816 unsigned NumCaptures;
3820 llvm::PointerIntPair<CapturedDecl *, 2, CapturedRegionKind> CapDeclAndKind;
3832 Stmt **getStoredStmts() {
return reinterpret_cast<Stmt **
>(
this + 1); }
3834 Stmt *
const *getStoredStmts()
const {
3835 return reinterpret_cast<Stmt *
const *
>(
this + 1);
3838 Capture *getStoredCaptures()
const;
3840 void setCapturedStmt(
Stmt *S) { getStoredStmts()[NumCaptures] = S; }
3852 unsigned NumCaptures);
3876 assert(D &&
"null RecordDecl");
3903 return getStoredCaptures() + NumCaptures;
3917 llvm::iterator_range<const_capture_init_iterator>;
3929 return reinterpret_cast<Expr **
>(getStoredStmts());
3933 return reinterpret_cast<Expr *
const *
>(getStoredStmts());
static StringRef bytes(const std::vector< T, Allocator > &v)
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines several types used to describe C++ lambda expressions that are shared between the parser and ...
Defines the clang::LangOptions interface.
Defines an enumeration for C++ overloaded operators.
Defines the clang::SourceLocation class and associated facilities.
Defines various enumerations that describe declaration and type specifiers.
#define BLOCK(DERIVED, BASE)
Defines enumerations for the type traits support.
__device__ __2f16 float __ockl_bool s
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Reads an AST files chain containing the contents of a translation unit.
AddrLabelExpr - The GNU address of label extension, representing &&label.
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
outputs_iterator begin_outputs()
void setAsmLoc(SourceLocation L)
const_outputs_iterator end_outputs() const
outputs_iterator end_outputs()
const_inputs_iterator begin_inputs() const
unsigned getNumPlusOperands() const
getNumPlusOperands - Return the number of output operands that have a "+" constraint.
AsmStmt(StmtClass SC, SourceLocation asmloc, bool issimple, bool isvolatile, unsigned numoutputs, unsigned numinputs, unsigned numclobbers)
static bool classof(const Stmt *T)
StringRef getOutputConstraint(unsigned i) const
getOutputConstraint - Return the constraint string for the specified output operand.
inputs_const_range inputs() const
SourceLocation getAsmLoc() const
const Expr * getInputExpr(unsigned i) const
SourceLocation getEndLoc() const LLVM_READONLY
llvm::iterator_range< inputs_iterator > inputs_range
bool isOutputPlusConstraint(unsigned i) const
isOutputPlusConstraint - Return true if the specified output constraint is a "+" constraint (which is...
unsigned getNumClobbers() const
const_inputs_iterator end_inputs() const
llvm::iterator_range< const_inputs_iterator > inputs_const_range
const_child_range children() const
bool IsSimple
True if the assembly statement does not have any input or output operands.
const Expr * getOutputExpr(unsigned i) const
StringRef getInputConstraint(unsigned i) const
getInputConstraint - Return the specified input constraint.
outputs_const_range outputs() const
inputs_iterator end_inputs()
unsigned getNumOutputs() const
SourceLocation getBeginLoc() const LLVM_READONLY
inputs_iterator begin_inputs()
AsmStmt(StmtClass SC, EmptyShell Empty)
Build an empty inline-assembly statement.
std::string generateAsmString(const ASTContext &C) const
Assemble final IR asm string.
bool IsVolatile
If true, treat this inline assembly as having side effects.
unsigned getNumInputs() const
llvm::iterator_range< outputs_iterator > outputs_range
StringRef getClobber(unsigned i) const
const_outputs_iterator begin_outputs() const
llvm::iterator_range< const_outputs_iterator > outputs_const_range
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Attr - This represents one attribute.
Represents an attribute applied to a statement.
static AttributedStmt * CreateEmpty(const ASTContext &C, unsigned NumAttrs)
const Stmt * getSubStmt() const
SourceLocation getAttrLoc() const
ArrayRef< const Attr * > getAttrs() const
const_child_range children() const
static AttributedStmt * Create(const ASTContext &C, SourceLocation Loc, ArrayRef< const Attr * > Attrs, Stmt *SubStmt)
static bool classof(const Stmt *T)
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const
A builtin binary operation expression such as "x + y" or "x <= y".
BreakStmt - This represents a break.
SourceLocation getBreakLoc() const
SourceLocation getEndLoc() const
SourceLocation getBeginLoc() const
BreakStmt(SourceLocation BL)
const_child_range children() const
static bool classof(const Stmt *T)
void setBreakLoc(SourceLocation L)
BreakStmt(EmptyShell Empty)
Build an empty break statement.
A boolean literal, per ([C++ lex.bool] Boolean literals).
Represents a call to a C++ constructor.
A default argument (C++ [dcl.fct.default]).
A use of a default initializer in a constructor or in aggregate initialization.
Represents a delete expression for memory deallocation and destructor calls, e.g.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
The null pointer literal (C++11 [lex.nullptr])
A call to an overloaded operator written using operator syntax.
A rewritten comparison expression that was originally written using operator syntax.
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type.
Represents the this expression in C++.
A C++ throw-expression (C++ [except.throw]).
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Represents the body of a CapturedStmt, and serves as its DeclContext.
Describes the capture of either a variable, or 'this', or variable-length array type.
bool capturesVariableByCopy() const
Determine whether this capture handles a variable by copy.
VariableCaptureKind getCaptureKind() const
Determine the kind of capture.
VarDecl * getCapturedVar() const
Retrieve the declaration of the variable being captured.
bool capturesVariableArrayType() const
Determine whether this capture handles a variable-length array type.
bool capturesThis() const
Determine whether this capture handles the C++ 'this' pointer.
bool capturesVariable() const
Determine whether this capture handles a variable (by reference).
SourceLocation getLocation() const
Retrieve the source location at which the variable or 'this' was first used.
This captures a statement into a function.
unsigned capture_size() const
Retrieve the number of captures, including 'this'.
const_capture_iterator capture_begin() const
static CapturedStmt * CreateDeserialized(const ASTContext &Context, unsigned NumCaptures)
SourceLocation getEndLoc() const LLVM_READONLY
capture_init_range capture_inits()
void setCapturedRegionKind(CapturedRegionKind Kind)
Set the captured region kind.
const_capture_init_iterator capture_init_begin() const
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
SourceRange getSourceRange() const LLVM_READONLY
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of captures.
const RecordDecl * getCapturedRecordDecl() const
Retrieve the record declaration for captured variables.
Stmt * getCapturedStmt()
Retrieve the statement being captured.
llvm::iterator_range< capture_init_iterator > capture_init_range
llvm::iterator_range< capture_iterator > capture_range
bool capturesVariable(const VarDecl *Var) const
True if this variable has been captured.
static bool classof(const Stmt *T)
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument.
void setCapturedDecl(CapturedDecl *D)
Set the outlined function declaration.
capture_iterator capture_begin()
Retrieve an iterator pointing to the first capture.
llvm::iterator_range< const_capture_init_iterator > const_capture_init_range
static CapturedStmt * Create(const ASTContext &Context, Stmt *S, CapturedRegionKind Kind, ArrayRef< Capture > Captures, ArrayRef< Expr * > CaptureInits, CapturedDecl *CD, RecordDecl *RD)
const_capture_init_iterator capture_init_end() const
SourceLocation getBeginLoc() const LLVM_READONLY
void setCapturedRecordDecl(RecordDecl *D)
Set the record declaration for captured variables.
llvm::iterator_range< const_capture_iterator > capture_const_range
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument.
Expr *const * const_capture_init_iterator
Const iterator that walks over the capture initialization arguments.
const Stmt * getCapturedStmt() const
capture_const_range captures() const
CapturedRegionKind getCapturedRegionKind() const
Retrieve the captured region kind.
VariableCaptureKind
The different capture forms: by 'this', by reference, capture for variable-length array type etc.
const_capture_init_range capture_inits() const
CaseStmt - Represent a case statement.
const Expr * getRHS() const
const_child_range children() const
SourceLocation getBeginLoc() const
void setEllipsisLoc(SourceLocation L)
Set the location of the ... in a case statement of the form LHS ... RHS.
static bool classof(const Stmt *T)
bool caseStmtIsGNURange() const
True if this case statement is of the form case LHS ... RHS, which is a GNU extension.
const Expr * getLHS() const
SourceLocation getEllipsisLoc() const
Get the location of the ... in a case statement of the form LHS ... RHS.
static CaseStmt * Create(const ASTContext &Ctx, Expr *lhs, Expr *rhs, SourceLocation caseLoc, SourceLocation ellipsisLoc, SourceLocation colonLoc)
Build a case statement.
void setCaseLoc(SourceLocation L)
SourceLocation getCaseLoc() const
static CaseStmt * CreateEmpty(const ASTContext &Ctx, bool CaseStmtIsGNURange)
Build an empty case statement.
const Stmt * getSubStmt() const
SourceLocation getEndLoc() const LLVM_READONLY
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Represents a character-granular source range.
Represents a 'co_await' expression.
CompoundStmt - This represents a group of statements like { stmt stmt }.
static bool classof(const Stmt *T)
std::reverse_iterator< const_body_iterator > const_reverse_body_iterator
body_const_range body() const
Stmt *const * const_body_iterator
const_reverse_body_iterator body_rend() const
llvm::iterator_range< const_body_iterator > body_const_range
std::reverse_iterator< body_iterator > reverse_body_iterator
reverse_body_iterator body_rbegin()
llvm::iterator_range< body_iterator > body_range
const Stmt * getStmtExprResult() const
FPOptionsOverride getStoredFPFeatures() const
Get FPOptionsOverride from trailing storage.
const Stmt * body_front() const
SourceLocation getBeginLoc() const
static CompoundStmt * CreateEmpty(const ASTContext &C, unsigned NumStmts, bool HasFPFeatures)
SourceLocation getLBracLoc() const
body_iterator body_begin()
SourceLocation getEndLoc() const
bool hasStoredFPFeatures() const
const_child_range children() const
reverse_body_iterator body_rend()
CompoundStmt(SourceLocation Loc)
const_body_iterator body_begin() const
static CompoundStmt * Create(const ASTContext &C, ArrayRef< Stmt * > Stmts, FPOptionsOverride FPFeatures, SourceLocation LB, SourceLocation RB)
Stmt * getStmtExprResult()
const Stmt * body_back() const
const_reverse_body_iterator body_rbegin() const
SourceLocation getRBracLoc() const
const_body_iterator body_end() const
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
ContinueStmt - This represents a continue.
ContinueStmt(EmptyShell Empty)
Build an empty continue statement.
ContinueStmt(SourceLocation CL)
static bool classof(const Stmt *T)
void setContinueLoc(SourceLocation L)
SourceLocation getContinueLoc() const
SourceLocation getEndLoc() const
const_child_range children() const
SourceLocation getBeginLoc() const
Decl *const * const_iterator
bool isSingleDecl() const
A reference to a declared variable, function, enum, etc.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
std::reverse_iterator< decl_iterator > reverse_decl_iterator
llvm::iterator_range< decl_iterator > decl_range
const_child_range children() const
SourceLocation getEndLoc() const
const DeclGroupRef getDeclGroup() const
DeclStmt(EmptyShell Empty)
Build an empty declaration statement.
bool isSingleDecl() const
isSingleDecl - This method returns true if this DeclStmt refers to a single Decl.
const_decl_iterator decl_begin() const
void setStartLoc(SourceLocation L)
DeclGroupRef::const_iterator const_decl_iterator
static bool classof(const Stmt *T)
void setEndLoc(SourceLocation L)
decl_iterator decl_begin()
void setDeclGroup(DeclGroupRef DGR)
const Decl * getSingleDecl() const
decl_const_range decls() const
const_decl_iterator decl_end() const
SourceLocation getBeginLoc() const LLVM_READONLY
DeclGroupRef getDeclGroup()
reverse_decl_iterator decl_rend()
llvm::iterator_range< const_decl_iterator > decl_const_range
reverse_decl_iterator decl_rbegin()
DeclStmt(DeclGroupRef dg, SourceLocation startLoc, SourceLocation endLoc)
Decl - This represents one declaration (or definition), e.g.
const Stmt * getSubStmt() const
SourceLocation getEndLoc() const LLVM_READONLY
void setDefaultLoc(SourceLocation L)
SourceLocation getDefaultLoc() const
DefaultStmt(EmptyShell Empty)
Build an empty default statement.
static bool classof(const Stmt *T)
DefaultStmt(SourceLocation DL, SourceLocation CL, Stmt *substmt)
const_child_range children() const
SourceLocation getBeginLoc() const
A qualified reference to a name whose declaration cannot yet be resolved.
Represents a C99 designated initializer expression.
DoStmt - This represents a 'do/while' stmt.
void setWhileLoc(SourceLocation L)
SourceLocation getBeginLoc() const
void setDoLoc(SourceLocation L)
SourceLocation getEndLoc() const
SourceLocation getWhileLoc() const
static bool classof(const Stmt *T)
const_child_range children() const
DoStmt(EmptyShell Empty)
Build an empty do-while statement.
SourceLocation getDoLoc() const
void setRParenLoc(SourceLocation L)
SourceLocation getRParenLoc() const
const Stmt * getBody() const
DoStmt(Stmt *Body, Expr *Cond, SourceLocation DL, SourceLocation WL, SourceLocation RP)
const Expr * getCond() const
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
This represents one expression.
Represents difference between two FPOptions values.
ForStmt - This represents a 'for (init;cond;inc)' stmt.