13 #ifndef LLVM_CLANG_AST_STMT_H 14 #define LLVM_CLANG_AST_STMT_H 22 #include "llvm/ADT/ArrayRef.h" 23 #include "llvm/ADT/PointerIntPair.h" 24 #include "llvm/ADT/StringRef.h" 25 #include "llvm/ADT/iterator.h" 26 #include "llvm/ADT/iterator_range.h" 27 #include "llvm/Support/Casting.h" 28 #include "llvm/Support/Compiler.h" 29 #include "llvm/Support/ErrorHandling.h" 38 class FoldingSetNodeID;
53 struct PrintingPolicy;
66 class alignas(void *)
Stmt {
70 #define STMT(CLASS, PARENT) CLASS##Class, 71 #define STMT_RANGE(BASE, FIRST, LAST) \ 72 first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class, 73 #define LAST_STMT_RANGE(BASE, FIRST, LAST) \ 74 first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class 75 #define ABSTRACT_STMT(STMT) 76 #include "clang/AST/StmtNodes.inc" 84 void *
operator new(
size_t bytes) noexcept {
85 llvm_unreachable(
"Stmts cannot be allocated with regular 'new'.");
88 void operator delete(
void *data) noexcept {
89 llvm_unreachable(
"Stmts cannot be released with regular 'delete'.");
106 unsigned IsOMPStructuredBlock : 1;
108 enum { NumStmtBits = 9 };
115 unsigned : NumStmtBits;
122 unsigned HasLeadingEmptyMacro : 1;
132 unsigned : NumStmtBits;
134 unsigned NumStmts : 32 - NumStmtBits;
143 unsigned : NumStmtBits;
152 unsigned : NumStmtBits;
155 unsigned NumAttrs : 32 - NumStmtBits;
165 unsigned : NumStmtBits;
168 unsigned IsConstexpr : 1;
171 unsigned HasElse : 1;
177 unsigned HasInit : 1;
186 unsigned : NumStmtBits;
189 unsigned HasInit : 1;
197 unsigned AllEnumCasesCovered : 1;
207 unsigned : NumStmtBits;
219 unsigned : NumStmtBits;
228 unsigned : NumStmtBits;
238 unsigned : NumStmtBits;
247 unsigned : NumStmtBits;
256 unsigned : NumStmtBits;
265 unsigned : NumStmtBits;
268 unsigned HasNRVOCandidate : 1;
278 unsigned : NumStmtBits;
282 unsigned CaseStmtIsGNURange : 1;
293 friend class BlockDeclRefExpr;
314 unsigned : NumStmtBits;
316 unsigned ValueKind : 2;
317 unsigned ObjectKind : 3;
318 unsigned TypeDependent : 1;
319 unsigned ValueDependent : 1;
320 unsigned InstantiationDependent : 1;
321 unsigned ContainsUnexpandedParameterPack : 1;
323 enum { NumExprBits = NumStmtBits + 9 };
330 unsigned : NumExprBits;
333 unsigned ResultKind : 2;
336 unsigned APValueKind : 4;
340 unsigned IsUnsigned : 1;
345 unsigned BitWidth : 7;
349 unsigned HasCleanup : 1;
356 unsigned : NumExprBits;
364 unsigned HasFunctionName : 1;
374 unsigned : NumExprBits;
376 unsigned HasQualifier : 1;
377 unsigned HasTemplateKWAndArgsInfo : 1;
378 unsigned HasFoundDecl : 1;
379 unsigned HadMultipleCandidates : 1;
380 unsigned RefersToEnclosingVariableOrCapture : 1;
391 unsigned : NumExprBits;
393 unsigned Semantics : 3;
394 unsigned IsExact : 1;
401 unsigned : NumExprBits;
410 unsigned CharByteWidth : 3;
412 unsigned IsPascal : 1;
416 unsigned NumConcatenated;
422 unsigned : NumExprBits;
430 unsigned : NumExprBits;
433 unsigned CanOverflow : 1;
441 unsigned : NumExprBits;
450 unsigned : NumExprBits;
458 unsigned : NumExprBits;
460 unsigned NumPreArgs : 1;
463 unsigned UsesADL : 1;
466 unsigned : 24 - 2 - NumExprBits;
471 unsigned OffsetToTrailingObjects : 8;
473 enum { NumCallExprBits = 32 };
479 unsigned : NumExprBits;
482 unsigned IsArrow : 1;
488 unsigned HasQualifierOrFoundDecl : 1;
495 unsigned HasTemplateKWAndArgsInfo : 1;
499 unsigned HadMultipleCandidates : 1;
514 unsigned : NumExprBits;
517 unsigned PartOfExplicitCast : 1;
521 unsigned BasePathSize;
527 unsigned : NumExprBits;
533 unsigned FPFeatures : 3;
541 unsigned : NumExprBits;
545 unsigned HadArrayRangeDesignator : 1;
552 unsigned : NumExprBits;
562 unsigned : NumExprBits;
572 unsigned : NumExprBits;
576 unsigned NumSubExprs : 8;
577 unsigned ResultIndex : 32 - 8 - NumExprBits;
584 unsigned : NumExprBits;
597 unsigned : NumCallExprBits;
601 unsigned OperatorKind : 6;
604 unsigned FPFeatures : 3;
610 unsigned : NumExprBits;
622 unsigned : NumExprBits;
631 unsigned : NumExprBits;
634 unsigned IsImplicit : 1;
644 unsigned : NumExprBits;
647 unsigned IsThrownVariableInScope : 1;
657 unsigned : NumExprBits;
667 unsigned : NumExprBits;
677 unsigned : NumExprBits;
687 unsigned : NumExprBits;
690 unsigned IsGlobalNew : 1;
694 unsigned IsArray : 1;
697 unsigned ShouldPassAlignment : 1;
701 unsigned UsualArrayDeleteWantsSize : 1;
706 unsigned StoredInitializationStyle : 2;
709 unsigned IsParenTypeId : 1;
712 unsigned NumPlacementArgs;
719 unsigned : NumExprBits;
722 unsigned GlobalDelete : 1;
725 unsigned ArrayForm : 1;
730 unsigned ArrayFormAsWritten : 1;
734 unsigned UsualArrayDeleteWantsSize : 1;
745 unsigned : NumExprBits;
755 unsigned NumArgs : 32 - 8 - 1 - NumExprBits;
763 unsigned : NumExprBits;
767 unsigned HasTemplateKWAndArgsInfo : 1;
774 unsigned : NumExprBits;
776 unsigned Elidable : 1;
777 unsigned HadMultipleCandidates : 1;
778 unsigned ListInitialization : 1;
779 unsigned StdInitListInitialization : 1;
780 unsigned ZeroInitialization : 1;
781 unsigned ConstructionKind : 3;
790 unsigned : NumExprBits;
793 unsigned CleanupsHaveSideEffects : 1;
795 unsigned NumObjects : 32 - 1 - NumExprBits;
802 unsigned : NumExprBits;
812 unsigned : NumExprBits;
816 unsigned IsArrow : 1;
820 unsigned HasTemplateKWAndArgsInfo : 1;
824 unsigned HasFirstQualifierFoundInScope : 1;
834 unsigned : NumExprBits;
838 unsigned HasTemplateKWAndArgsInfo : 1;
843 unsigned : 32 - NumExprBits - 1;
848 enum { NumOverloadExprBits = NumExprBits + 1 };
854 unsigned : NumOverloadExprBits;
858 unsigned RequiresADL : 1;
862 unsigned Overloaded : 1;
865 "UnresolvedLookupExprBitfields must be <= than 4 bytes to" 866 "avoid trashing OverloadExprBitfields::NumResults!");
872 unsigned : NumOverloadExprBits;
876 unsigned IsArrow : 1;
879 unsigned HasUnresolvedUsing : 1;
882 "UnresolvedMemberExprBitfields must be <= than 4 bytes to" 883 "avoid trashing OverloadExprBitfields::NumResults!");
889 unsigned : NumExprBits;
898 unsigned : NumExprBits;
909 unsigned : NumExprBits;
911 unsigned IsImplicit : 1;
919 unsigned : NumExprBits;
921 unsigned ShouldCopy : 1;
930 unsigned : NumExprBits;
934 unsigned IsUnique : 1;
1016 unsigned alignment = 8);
1019 unsigned alignment = 8) {
1020 return operator new(
bytes, *C, alignment);
1023 void *
operator new(
size_t bytes,
void *mem) noexcept {
return mem; }
1025 void operator delete(
void *,
const ASTContext &, unsigned) noexcept {}
1026 void operator delete(
void *,
const ASTContext *, unsigned) noexcept {}
1027 void operator delete(
void *,
size_t) noexcept {}
1028 void operator delete(
void *,
void *) noexcept {}
1041 template<
typename T,
typename TPtr = T *,
typename StmtPtr = Stmt *>
1043 : llvm::iterator_adaptor_base<CastIterator<T, TPtr, StmtPtr>, StmtPtr *,
1044 std::random_access_iterator_tag, TPtr> {
1045 using Base =
typename CastIterator::iterator_adaptor_base;
1051 return cast_or_null<T>(*this->I);
1056 template <
typename T>
1064 static bool StatisticsEnabled;
1074 Stmt &operator=(
const Stmt &) =
delete;
1078 static_assert(
sizeof(*
this) <= 8,
1079 "changing bitfields changed sizeof(Stmt)");
1080 static_assert(
sizeof(*
this) %
alignof(
void *) == 0,
1081 "Insufficient alignment!");
1082 StmtBits.sClass = SC;
1083 StmtBits.IsOMPStructuredBlock =
false;
1084 if (StatisticsEnabled) Stmt::addStmtClass(SC);
1088 return static_cast<StmtClass>(StmtBits.sClass);
1091 const char *getStmtClassName()
const;
1095 StmtBits.IsOMPStructuredBlock = IsOMPStructuredBlock;
1106 static void addStmtClass(
const StmtClass s);
1107 static void EnableStatistics();
1108 static void PrintStats();
1115 void dump(raw_ostream &OS)
const;
1118 int64_t getID(
const ASTContext &Context)
const;
1121 void dumpColor()
const;
1125 void dumpPretty(
const ASTContext &Context)
const;
1128 StringRef NewlineSymbol =
"\n",
1129 const ASTContext *Context =
nullptr)
const;
1137 void viewAST()
const;
1141 Stmt *IgnoreContainers(
bool IgnoreCaptured =
false);
1143 return const_cast<Stmt *
>(
this)->IgnoreContainers(IgnoreCaptured);
1146 const Stmt *stripLabelLikeStatements()
const;
1148 return const_cast<Stmt*
>(
1149 const_cast<const Stmt*
>(
this)->stripLabelLikeStatements());
1186 void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
1187 bool Canonical)
const;
1196 void ProcessODRHash(llvm::FoldingSetNodeID &ID,
ODRHash& Hash)
const;
1209 :
Stmt(DeclStmtClass), DG(dg), StartLoc(startLoc), EndLoc(endLoc) {}
1278 :
Stmt(NullStmtClass) {
1279 NullStmtBits.HasLeadingEmptyMacro = hasLeadingEmptyMacro;
1290 return NullStmtBits.HasLeadingEmptyMacro;
1329 :
Stmt(CompoundStmtClass), RBraceLoc(Loc) {
1330 CompoundStmtBits.NumStmts = 0;
1331 CompoundStmtBits.LBraceLoc = Loc;
1337 bool body_empty()
const {
return CompoundStmtBits.NumStmts == 0; }
1338 unsigned size()
const {
return CompoundStmtBits.NumStmts; }
1349 return !body_empty() ? body_begin()[size() - 1] :
nullptr;
1360 return getTrailingObjects<Stmt *>();
1366 return !body_empty() ? body_begin()[0] :
nullptr;
1370 return !body_empty() ? body_begin()[size() - 1] :
nullptr;
1384 std::reverse_iterator<const_body_iterator>;
1403 for (
auto *B : llvm::reverse(body())) {
1404 if (!isa<NullStmt>(B))
1411 return const_cast<CompoundStmt *
>(
this)->getStmtExprResult();
1446 :
Stmt(SC), ColonLoc(ColonLoc) {
1447 setKeywordLoc(KWLoc);
1462 inline Stmt *getSubStmt();
1464 return const_cast<SwitchCase *
>(
this)->getSubStmt();
1498 enum { LhsOffset = 0, SubStmtOffsetFromRhs = 1 };
1499 enum { NumMandatoryStmtPtr = 2 };
1501 unsigned numTrailingObjects(OverloadToken<Stmt *>)
const {
1502 return NumMandatoryStmtPtr + caseStmtIsGNURange();
1505 unsigned numTrailingObjects(OverloadToken<SourceLocation>)
const {
1506 return caseStmtIsGNURange();
1509 unsigned lhsOffset()
const {
return LhsOffset; }
1510 unsigned rhsOffset()
const {
return LhsOffset + caseStmtIsGNURange(); }
1511 unsigned subStmtOffset()
const {
return rhsOffset() + SubStmtOffsetFromRhs; }
1517 :
SwitchCase(CaseStmtClass, caseLoc, colonLoc) {
1519 bool IsGNURange = rhs !=
nullptr;
1520 SwitchCaseBits.CaseStmtIsGNURange = IsGNURange;
1522 setSubStmt(
nullptr);
1525 setEllipsisLoc(ellipsisLoc);
1532 SwitchCaseBits.CaseStmtIsGNURange = CaseStmtIsGNURange;
1554 return caseStmtIsGNURange() ? *getTrailingObjects<SourceLocation>()
1562 caseStmtIsGNURange() &&
1563 "setEllipsisLoc but this is not a case stmt of the form LHS ... RHS!");
1564 *getTrailingObjects<SourceLocation>() = L;
1568 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[lhsOffset()]);
1572 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[lhsOffset()]);
1576 getTrailingObjects<Stmt *>()[lhsOffset()] =
reinterpret_cast<Stmt *
>(Val);
1580 return caseStmtIsGNURange() ?
reinterpret_cast<Expr *
>(
1581 getTrailingObjects<Stmt *>()[rhsOffset()])
1586 return caseStmtIsGNURange() ?
reinterpret_cast<Expr *
>(
1587 getTrailingObjects<Stmt *>()[rhsOffset()])
1592 assert(caseStmtIsGNURange() &&
1593 "setRHS but this is not a case stmt of the form LHS ... RHS!");
1594 getTrailingObjects<Stmt *>()[rhsOffset()] =
reinterpret_cast<Stmt *
>(Val);
1599 return getTrailingObjects<Stmt *>()[subStmtOffset()];
1603 getTrailingObjects<Stmt *>()[subStmtOffset()] = S;
1610 while (
const auto *CS2 = dyn_cast<CaseStmt>(CS->
getSubStmt()))
1623 getTrailingObjects<Stmt *>() +
1624 numTrailingObjects(OverloadToken<Stmt *>()));
1629 getTrailingObjects<Stmt *>() +
1630 numTrailingObjects(OverloadToken<Stmt *>()));
1639 :
SwitchCase(DefaultStmtClass, DL, CL), SubStmt(substmt) {}
1670 if (
const auto *CS = dyn_cast<CaseStmt>(
this))
1671 return CS->getEndLoc();
1672 else if (
const auto *DS = dyn_cast<DefaultStmt>(
this))
1673 return DS->getEndLoc();
1674 llvm_unreachable(
"SwitchCase is neither a CaseStmt nor a DefaultStmt!");
1678 if (
auto *CS = dyn_cast<CaseStmt>(
this))
1679 return CS->getSubStmt();
1680 else if (
auto *DS = dyn_cast<DefaultStmt>(
this))
1681 return DS->getSubStmt();
1682 llvm_unreachable(
"SwitchCase is neither a CaseStmt nor a DefaultStmt!");
1696 const Expr *getExprStmt()
const;
1717 :
ValueStmt(LabelStmtClass), TheDecl(D), SubStmt(substmt) {
1764 :
ValueStmt(AttributedStmtClass), SubStmt(SubStmt) {
1765 AttributedStmtBits.NumAttrs = Attrs.size();
1766 AttributedStmtBits.AttrLoc = Loc;
1767 std::copy(Attrs.begin(), Attrs.end(), getAttrArrayPtr());
1771 :
ValueStmt(AttributedStmtClass, Empty) {
1772 AttributedStmtBits.NumAttrs = NumAttrs;
1774 std::fill_n(getAttrArrayPtr(), NumAttrs,
nullptr);
1777 const Attr *
const *getAttrArrayPtr()
const {
1778 return getTrailingObjects<const Attr *>();
1780 const Attr **getAttrArrayPtr() {
return getTrailingObjects<const Attr *>(); }
1791 return llvm::makeArrayRef(getAttrArrayPtr(), AttributedStmtBits.NumAttrs);
1839 enum { InitOffset = 0, ThenOffsetFromCond = 1, ElseOffsetFromCond = 2 };
1840 enum { NumMandatoryStmtPtr = 2 };
1842 unsigned numTrailingObjects(OverloadToken<Stmt *>)
const {
1843 return NumMandatoryStmtPtr + hasElseStorage() + hasVarStorage() +
1847 unsigned numTrailingObjects(OverloadToken<SourceLocation>)
const {
1848 return hasElseStorage();
1851 unsigned initOffset()
const {
return InitOffset; }
1852 unsigned varOffset()
const {
return InitOffset + hasInitStorage(); }
1853 unsigned condOffset()
const {
1854 return InitOffset + hasInitStorage() + hasVarStorage();
1856 unsigned thenOffset()
const {
return condOffset() + ThenOffsetFromCond; }
1857 unsigned elseOffset()
const {
return condOffset() + ElseOffsetFromCond; }
1864 explicit IfStmt(
EmptyShell Empty,
bool HasElse,
bool HasVar,
bool HasInit);
1871 Stmt *Else =
nullptr);
1888 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[condOffset()]);
1892 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[condOffset()]);
1896 getTrailingObjects<Stmt *>()[condOffset()] =
reinterpret_cast<Stmt *
>(Cond);
1899 Stmt *
getThen() {
return getTrailingObjects<Stmt *>()[thenOffset()]; }
1901 return getTrailingObjects<Stmt *>()[thenOffset()];
1905 getTrailingObjects<Stmt *>()[thenOffset()] = Then;
1909 return hasElseStorage() ? getTrailingObjects<Stmt *>()[elseOffset()]
1914 return hasElseStorage() ? getTrailingObjects<Stmt *>()[elseOffset()]
1919 assert(hasElseStorage() &&
1920 "This if statement has no storage for an else statement!");
1921 getTrailingObjects<Stmt *>()[elseOffset()] = Else;
1932 VarDecl *getConditionVariable();
1934 return const_cast<IfStmt *
>(
this)->getConditionVariable();
1944 return hasVarStorage() ?
static_cast<DeclStmt *
>(
1945 getTrailingObjects<Stmt *>()[varOffset()])
1950 return hasVarStorage() ?
static_cast<DeclStmt *
>(
1951 getTrailingObjects<Stmt *>()[varOffset()])
1956 return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
1961 return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
1966 assert(hasInitStorage() &&
1967 "This if statement has no storage for an init statement!");
1968 getTrailingObjects<Stmt *>()[initOffset()] = Init;
1975 return hasElseStorage() ? *getTrailingObjects<SourceLocation>()
1980 assert(hasElseStorage() &&
1981 "This if statement has no storage for an else statement!");
1982 *getTrailingObjects<SourceLocation>() = ElseLoc;
1988 bool isObjCAvailabilityCheck()
const;
1993 return getElse()->getEndLoc();
1994 return getThen()->getEndLoc();
2001 getTrailingObjects<Stmt *>() +
2002 numTrailingObjects(OverloadToken<Stmt *>()));
2007 getTrailingObjects<Stmt *>() +
2008 numTrailingObjects(OverloadToken<Stmt *>()));
2041 enum { InitOffset = 0, BodyOffsetFromCond = 1 };
2042 enum { NumMandatoryStmtPtr = 2 };
2044 unsigned numTrailingObjects(OverloadToken<Stmt *>)
const {
2045 return NumMandatoryStmtPtr + hasInitStorage() + hasVarStorage();
2048 unsigned initOffset()
const {
return InitOffset; }
2049 unsigned varOffset()
const {
return InitOffset + hasInitStorage(); }
2050 unsigned condOffset()
const {
2051 return InitOffset + hasInitStorage() + hasVarStorage();
2053 unsigned bodyOffset()
const {
return condOffset() + BodyOffsetFromCond; }
2078 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[condOffset()]);
2082 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[condOffset()]);
2086 getTrailingObjects<Stmt *>()[condOffset()] =
reinterpret_cast<Stmt *
>(Cond);
2089 Stmt *
getBody() {
return getTrailingObjects<Stmt *>()[bodyOffset()]; }
2091 return getTrailingObjects<Stmt *>()[bodyOffset()];
2095 getTrailingObjects<Stmt *>()[bodyOffset()] = Body;
2099 return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
2104 return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
2109 assert(hasInitStorage() &&
2110 "This switch statement has no storage for an init statement!");
2111 getTrailingObjects<Stmt *>()[initOffset()] = Init;
2123 VarDecl *getConditionVariable();
2125 return const_cast<SwitchStmt *
>(
this)->getConditionVariable();
2135 return hasVarStorage() ?
static_cast<DeclStmt *
>(
2136 getTrailingObjects<Stmt *>()[varOffset()])
2141 return hasVarStorage() ?
static_cast<DeclStmt *
>(
2142 getTrailingObjects<Stmt *>()[varOffset()])
2160 "case/default already added to a switch");
2172 return SwitchStmtBits.AllEnumCasesCovered;
2177 return getBody() ? getBody()->getEndLoc()
2178 :
reinterpret_cast<const Stmt *
>(getCond())->getEndLoc();
2184 getTrailingObjects<Stmt *>() +
2185 numTrailingObjects(OverloadToken<Stmt *>()));
2190 getTrailingObjects<Stmt *>() +
2191 numTrailingObjects(OverloadToken<Stmt *>()));
2219 enum { VarOffset = 0, BodyOffsetFromCond = 1 };
2220 enum { NumMandatoryStmtPtr = 2 };
2222 unsigned varOffset()
const {
return VarOffset; }
2223 unsigned condOffset()
const {
return VarOffset + hasVarStorage(); }
2224 unsigned bodyOffset()
const {
return condOffset() + BodyOffsetFromCond; }
2226 unsigned numTrailingObjects(OverloadToken<Stmt *>)
const {
2227 return NumMandatoryStmtPtr + hasVarStorage();
2250 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[condOffset()]);
2254 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[condOffset()]);
2258 getTrailingObjects<Stmt *>()[condOffset()] =
reinterpret_cast<Stmt *
>(Cond);
2261 Stmt *
getBody() {
return getTrailingObjects<Stmt *>()[bodyOffset()]; }
2263 return getTrailingObjects<Stmt *>()[bodyOffset()];
2267 getTrailingObjects<Stmt *>()[bodyOffset()] = Body;
2278 VarDecl *getConditionVariable();
2280 return const_cast<WhileStmt *
>(
this)->getConditionVariable();
2290 return hasVarStorage() ?
static_cast<DeclStmt *
>(
2291 getTrailingObjects<Stmt *>()[varOffset()])
2296 return hasVarStorage() ?
static_cast<DeclStmt *
>(
2297 getTrailingObjects<Stmt *>()[varOffset()])
2306 return getBody()->getEndLoc();
2316 getTrailingObjects<Stmt *>() +
2317 numTrailingObjects(OverloadToken<Stmt *>()));
2322 getTrailingObjects<Stmt *>() +
2323 numTrailingObjects(OverloadToken<Stmt *>()));
2329 enum { BODY, COND, END_EXPR };
2330 Stmt *SubExprs[END_EXPR];
2337 :
Stmt(DoStmtClass), WhileLoc(WL), RParenLoc(RP) {
2348 return reinterpret_cast<Expr *
>(SubExprs[COND]);
2373 return child_range(&SubExprs[0], &SubExprs[0] + END_EXPR);
2385 enum { INIT, CONDVAR, COND, INC, BODY, END_EXPR };
2386 Stmt* SubExprs[END_EXPR];
2407 VarDecl *getConditionVariable()
const;
2413 return reinterpret_cast<DeclStmt*
>(SubExprs[CONDVAR]);
2446 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
2461 :
Stmt(GotoStmtClass), Label(label), LabelLoc(LL) {
2500 :
Stmt(IndirectGotoStmtClass), StarLoc(starLoc) {
2502 setGotoLoc(gotoLoc);
2507 :
Stmt(IndirectGotoStmtClass, Empty) {}
2516 return reinterpret_cast<const Expr *
>(Target);
2622 bool hasNRVOCandidate()
const {
return ReturnStmtBits.HasNRVOCandidate; }
2624 unsigned numTrailingObjects(OverloadToken<const VarDecl *>)
const {
2625 return hasNRVOCandidate();
2637 const VarDecl *NRVOCandidate);
2653 return hasNRVOCandidate() ? *getTrailingObjects<const VarDecl *>()
2661 assert(hasNRVOCandidate() &&
2662 "This return statement has no storage for an NRVO candidate!");
2663 *getTrailingObjects<const VarDecl *>() = Var;
2671 return RetExpr ? RetExpr->
getEndLoc() : getReturnLoc();
2714 unsigned numoutputs,
unsigned numinputs,
unsigned numclobbers)
2715 :
Stmt (SC), AsmLoc(asmloc), IsSimple(issimple), IsVolatile(isvolatile),
2716 NumOutputs(numoutputs), NumInputs(numinputs),
2717 NumClobbers(numclobbers) {}
2738 std::string generateAsmString(
const ASTContext &
C)
const;
2747 StringRef getOutputConstraint(
unsigned i)
const;
2753 return getOutputConstraint(i)[0] ==
'+';
2756 const Expr *getOutputExpr(
unsigned i)
const;
2760 unsigned getNumPlusOperands()
const;
2768 StringRef getInputConstraint(
unsigned i)
const;
2770 const Expr *getInputExpr(
unsigned i)
const;
2775 StringRef getClobber(
unsigned i)
const;
2790 return &Exprs[0] + NumOutputs;
2794 return &Exprs[0] + NumOutputs + NumInputs;
2800 return &Exprs[0] + NumOutputs;
2804 return &Exprs[0] + NumOutputs + NumInputs;
2823 return &Exprs[0] + NumOutputs;
2835 return &Exprs[0] + NumOutputs;
2843 return child_range(&Exprs[0], &Exprs[0] + NumOutputs + NumInputs);
2862 unsigned NumLabels = 0;
2866 bool isvolatile,
unsigned numoutputs,
unsigned numinputs,
2906 : MyKind(Operand), Str(S), OperandNo(OpNo),
2915 assert(isOperand());
2920 assert(isOperand() &&
"Range is currently used only for Operands.");
2935 const ASTContext &C,
unsigned &DiagOffs)
const;
2938 std::string generateAsmString(
const ASTContext &C)
const;
2946 return II->getName();
2951 StringRef getOutputConstraint(
unsigned i)
const;
2954 return Constraints[
i];
2957 return Constraints[
i];
2960 Expr *getOutputExpr(
unsigned i);
2963 return const_cast<GCCAsmStmt*
>(
this)->getOutputExpr(i);
2969 return Names[i + NumOutputs];
2974 return II->getName();
2979 StringRef getInputConstraint(
unsigned i)
const;
2982 return Constraints[i + NumOutputs];
2985 return Constraints[i + NumOutputs];
2988 Expr *getInputExpr(
unsigned i);
2989 void setInputExpr(
unsigned i,
Expr *E);
2992 return const_cast<GCCAsmStmt*
>(
this)->getInputExpr(i);
2998 return NumLabels > 0;
3006 return Names[i + NumInputs];
3010 StringRef getLabelName(
unsigned i)
const;
3017 return &Exprs[0] + NumInputs;
3021 return &Exprs[0] + NumInputs + NumLabels;
3029 return &Exprs[0] + NumInputs;
3033 return &Exprs[0] + NumInputs + NumLabels;
3041 void setOutputsAndInputsAndClobbers(
const ASTContext &C,
3045 unsigned NumOutputs,
3049 unsigned NumClobbers);
3057 int getNamedOperand(StringRef SymbolicName)
const;
3059 StringRef getClobber(
unsigned i)
const;
3081 unsigned NumAsmToks = 0;
3083 Token *AsmToks =
nullptr;
3084 StringRef *Constraints =
nullptr;
3085 StringRef *Clobbers =
nullptr;
3112 std::string generateAsmString(
const ASTContext &
C)
const;
3117 assert(i < NumOutputs);
3118 return Constraints[
i];
3121 Expr *getOutputExpr(
unsigned i);
3124 return const_cast<MSAsmStmt*
>(
this)->getOutputExpr(i);
3130 assert(i < NumInputs);
3131 return Constraints[i + NumOutputs];
3134 Expr *getInputExpr(
unsigned i);
3135 void setInputExpr(
unsigned i,
Expr *E);
3138 return const_cast<MSAsmStmt*
>(
this)->getInputExpr(i);
3144 return llvm::makeArrayRef(Constraints, NumInputs + NumOutputs);
3148 return llvm::makeArrayRef(Clobbers, NumClobbers);
3152 return llvm::makeArrayRef(reinterpret_cast<Expr**>(Exprs),
3153 NumInputs + NumOutputs);
3171 return child_range(&Exprs[0], &Exprs[NumInputs + NumOutputs]);
3186 enum { FILTER_EXPR,
BLOCK };
3203 return reinterpret_cast<Expr*
>(Children[FILTER_EXPR]);
3207 return cast<CompoundStmt>(Children[
BLOCK]);
3266 enum { TRY = 0, HANDLER = 1 };
3288 return cast<CompoundStmt>(Children[TRY]);
3316 :
Stmt(SEHLeaveStmtClass), LeaveLoc(LL) {}
3364 llvm::PointerIntPair<VarDecl *, 2, VariableCaptureKind> VarAndKind;
3395 return getCaptureKind() == VCK_ByCopy;
3401 return getCaptureKind() == VCK_VLAType;
3407 VarDecl *getCapturedVar()
const;
3412 unsigned NumCaptures;
3416 llvm::PointerIntPair<CapturedDecl *, 2, CapturedRegionKind> CapDeclAndKind;
3428 Stmt **getStoredStmts() {
return reinterpret_cast<Stmt **
>(
this + 1); }
3430 Stmt *
const *getStoredStmts()
const {
3431 return reinterpret_cast<Stmt *
const *
>(
this + 1);
3434 Capture *getStoredCaptures()
const;
3436 void setCapturedStmt(
Stmt *S) { getStoredStmts()[NumCaptures] = S; }
3448 unsigned NumCaptures);
3472 assert(D &&
"null RecordDecl");
3477 bool capturesVariable(
const VarDecl *Var)
const;
3499 return getStoredCaptures() + NumCaptures;
3513 llvm::iterator_range<const_capture_init_iterator>;
3525 return reinterpret_cast<Expr **
>(getStoredStmts());
3529 return reinterpret_cast<Expr *
const *
>(getStoredStmts());
3535 return capture_init_begin() + NumCaptures;
3539 return capture_init_begin() + NumCaptures;
3543 return getCapturedStmt()->getBeginLoc();
3547 return getCapturedStmt()->getEndLoc();
3551 return getCapturedStmt()->getSourceRange();
3565 #endif // LLVM_CLANG_AST_STMT_H SourceLocation getRParenLoc() const
child_iterator child_begin()
SourceLocation getEndLoc() const LLVM_READONLY
labels_iterator end_labels()
static std::enable_if< std::is_base_of< Attr, AttrInfo >::value, SourceLocation >::type getAttrLoc(const AttrInfo &AL)
A helper function to provide Attribute Location for the Attr types AND the ParsedAttr.
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
A call to an overloaded operator written using operator syntax.
GotoStmt(EmptyShell Empty)
Build an empty goto statement.
SourceLocation getRBracLoc() const
void setIsOMPStructuredBlock(bool IsOMPStructuredBlock)
IdentifierInfo * getInputIdentifier(unsigned i) const
ConstantExprBitfields ConstantExprBits
static bool classof(const Stmt *T)
SourceLocation getRParenLoc() const
The null pointer literal (C++11 [lex.nullptr])
This represents a GCC inline-assembly statement extension.
SourceLocation getBeginLoc() const
const Stmt * getElse() const
IdentifierInfo * getLabelIdentifier(unsigned i) const
unsigned getNumInputs() const
SourceLocation getBeginLoc() const
UnresolvedMemberExprBitfields UnresolvedMemberExprBits
CompoundStmt * getBlock() const
SourceLocation getForLoc() const
SourceLocation getEndLoc() const
const Stmt * getBody() const
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument.
capture_const_range captures() const
const_child_iterator child_end() const
CXXDeleteExprBitfields CXXDeleteExprBits
DefaultStmt(SourceLocation DL, SourceLocation CL, Stmt *substmt)
SourceLocation getEllipsisLoc() const
Get the location of the ... in a case statement of the form LHS ... RHS.
void setNRVOCandidate(const VarDecl *Var)
Set the variable that might be used for the named return value optimization.
static bool classof(const Stmt *T)
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
bool hasVarStorage() const
True if this IfStmt has storage for a variable declaration.
const_labels_iterator end_labels() const
Specialize PointerLikeTypeTraits to allow LazyGenerationalUpdatePtr to be placed into a PointerUnion...
const_reverse_body_iterator body_rbegin() const
outputs_iterator end_outputs()
const DeclStmt * getConditionVariableDeclStmt() const
If this ForStmt has a condition variable, return the faux DeclStmt associated with the creation of th...
CXXThisExprBitfields CXXThisExprBits
IndirectGotoStmt(EmptyShell Empty)
Build an empty indirect goto statement.
std::reverse_iterator< const_body_iterator > const_reverse_body_iterator
CXXUnresolvedConstructExprBitfields CXXUnresolvedConstructExprBits
Stmt - This represents one statement.
SourceLocation getEndLoc() const
IfStmt - This represents an if/then/else.
AsmStmt(StmtClass SC, EmptyShell Empty)
Build an empty inline-assembly statement.
bool capturesThis() const
Determine whether this capture handles the C++ 'this' pointer.
unsigned getNumOutputs() const
llvm::iterator_range< body_iterator > body_range
ContinueStmt(EmptyShell Empty)
Build an empty continue statement.
llvm::iterator_range< labels_iterator > labels_range
const StringLiteral * getAsmString() const
void setRParenLoc(SourceLocation L)
void setContinueLoc(SourceLocation L)
const_child_range children() const
Decl - This represents one declaration (or definition), e.g.
void setDeclGroup(DeclGroupRef DGR)
bool hasLeadingEmptyMacro() const
LabelStmtBitfields LabelStmtBits
FloatingLiteralBitfields FloatingLiteralBits
NullStmt(EmptyShell Empty)
Build an empty null statement.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
const Expr * getOutputExpr(unsigned i) const
SourceLocation getIdentLoc() const
Represents an attribute applied to a statement.
const_child_range children() const
const Expr * getOutputExpr(unsigned i) const
llvm::iterator_range< child_iterator > child_range
const RecordDecl * getCapturedRecordDecl() const
Retrieve the record declaration for captured variables.
DeclRefExprBitfields DeclRefExprBits
Represents a call to a C++ constructor.
SourceLocation getBeginLoc() const LLVM_READONLY
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
void setSwitchCaseList(SwitchCase *SC)
NullStmt(SourceLocation L, bool hasLeadingEmptyMacro=false)
bool hasVarStorage() const
True if this SwitchStmt has storage for a condition variable.
void setStartLoc(SourceLocation L)
SourceLocation getGotoLoc() const
void setForLoc(SourceLocation L)
const_child_iterator child_begin() const
Represents a variable declaration or definition.
const VarDecl * getNRVOCandidate() const
Retrieve the variable that might be used for the named return value optimization. ...
SourceLocation getLParenLoc() const
const_child_range children() const
const_child_range children() const
static bool classof(const Stmt *T)
void setAsmLoc(SourceLocation L)
AttributedStmtBitfields AttributedStmtBits
bool hasInitStorage() const
True if this SwitchStmt has storage for an init statement.
const_outputs_iterator begin_outputs() const
const Expr * getCond() const
SourceLocation getIfLoc() const
const Expr * getExprStmt() const
Describes how types, statements, expressions, and declarations should be printed. ...
capture_iterator capture_begin()
Retrieve an iterator pointing to the first capture.
static StringRef bytes(const std::vector< T, Allocator > &v)
A C++ throw-expression (C++ [except.throw]).
Represents an expression – generally a full-expression – that introduces cleanups to be run at the ...
llvm::iterator_range< decl_iterator > decl_range
StringRef getInputName(unsigned i) const
void setBody(Stmt *S, SourceLocation SL)
Stmt(StmtClass SC, EmptyShell)
Construct an empty statement.
CoawaitExprBitfields CoawaitBits
static bool classof(const Stmt *T)
ArraySubscriptExprBitfields ArraySubscriptExprBits
LabelStmt - Represents a label, which has a substatement.
Represents a struct/union/class.
Represents a C99 designated initializer expression.
const Expr * getTarget() const
inputs_iterator begin_inputs()
One of these records is kept for each identifier that is lexed.
Represents a statement that could possibly have a value and type.
const_outputs_iterator end_outputs() const
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(), or __builtin_FILE().
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
SourceLocation ColonLoc
The location of the ":".
DeclGroupRef::const_iterator const_decl_iterator
DeclStmt * getConditionVariableDeclStmt()
If this SwitchStmt has a condition variable, return the faux DeclStmt associated with the creation of...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const_body_iterator body_begin() const
SourceLocation getEndLoc() const
SourceLocation getBeginLoc() const LLVM_READONLY
LabelStmt(SourceLocation IL, LabelDecl *D, Stmt *substmt)
Build a label statement.
CharSourceRange getRange() const
CharacterLiteralBitfields CharacterLiteralBits
ArrayRef< Expr * > getAllExprs() const
SourceLocation getBeginLoc() const LLVM_READONLY
Stmt * getStmtExprResult()
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const
SourceLocation getEndLoc() const
Token - This structure provides full information about a lexed token.
ObjCIndirectCopyRestoreExprBitfields ObjCIndirectCopyRestoreExprBits
__SIZE_TYPE__ size_t
The unsigned integer type of the result of the sizeof operator.
Stmt *const * const_body_iterator
void setReturnLoc(SourceLocation L)
llvm::iterator_range< const_inputs_iterator > inputs_const_range
MSAsmStmt(EmptyShell Empty)
Build an empty MS-style inline-assembly statement.
const VarDecl * getConditionVariable() const
Represents a C++ member access expression for which lookup produced a set of overloaded functions...
const DeclGroupRef getDeclGroup() const
void setIfLoc(SourceLocation IfLoc)
bool isAllEnumCasesCovered() const
Returns true if the SwitchStmt is a switch of an enum value and all cases have been explicitly covere...
static bool classof(const Stmt *T)
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp, [NSNumber numberWithInt:42]];.
SwitchCase(StmtClass SC, SourceLocation KWLoc, SourceLocation ColonLoc)
WhileStmtBitfields WhileStmtBits
const Stmt * getSubStmt() const
void addSwitchCase(SwitchCase *SC)
SourceLocation getEndLoc() const LLVM_READONLY
static bool classof(const Stmt *T)
IndirectGotoStmt - This represents an indirect goto.
Describes an C or C++ initializer list.
SwitchCase(StmtClass SC, EmptyShell)
Expr *const * const_capture_init_iterator
Const iterator that walks over the capture initialization arguments.
GCCAsmStmt(EmptyShell Empty)
Build an empty inline-assembly statement.
ForStmt - This represents a 'for (init;cond;inc)' stmt.
SourceLocation getBeginLoc() const
outputs_iterator begin_outputs()
CXXScalarValueInitExprBitfields CXXScalarValueInitExprBits
SourceLocation getEndLoc() const LLVM_READONLY
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
LabelDecl * getDecl() const
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
SourceLocation getLBracLoc() const
void setEndLoc(SourceLocation L)
DeclStmt(EmptyShell Empty)
Build an empty declaration statement.
static bool classof(const Stmt *T)
SwitchCaseBitfields SwitchCaseBits
llvm::iterator_range< const_outputs_iterator > outputs_const_range
A builtin binary operation expression such as "x + y" or "x <= y".
DoStmt(Stmt *Body, Expr *Cond, SourceLocation DL, SourceLocation WL, SourceLocation RP)
const_child_range children() const
SwitchStmtBitfields SwitchStmtBits
const StringLiteral * getInputConstraintLiteral(unsigned i) const
SourceLocation getBeginLoc() const LLVM_READONLY
bool hasElseStorage() const
True if this IfStmt has storage for an else statement.
SourceLocation getEndLoc() const LLVM_READONLY
void setAsmString(StringLiteral *E)
static bool classof(const Stmt *T)
AsmStmt(StmtClass SC, SourceLocation asmloc, bool issimple, bool isvolatile, unsigned numoutputs, unsigned numinputs, unsigned numclobbers)
const Stmt * getInit() const
SourceLocation getEndLoc() const
const VarDecl * getConditionVariable() const
const Expr * getInc() const
CaseStmt - Represent a case statement.
SourceLocation getContinueLoc() const
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
StringLiteral * getClobberStringLiteral(unsigned i)
StringRef getOutputName(unsigned i) const
ReturnStmtBitfields ReturnStmtBits
SourceLocation getEndLoc() const LLVM_READONLY
bool isOutputPlusConstraint(unsigned i) const
isOutputPlusConstraint - Return true if the specified output constraint is a "+" constraint (which is...
const Expr * getCond() const
SourceLocation getTryLoc() const
void setEndLoc(SourceLocation L)
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Represents the body of a CapturedStmt, and serves as its DeclContext.
const Expr * getLHS() const
A default argument (C++ [dcl.fct.default]).
const_child_range children() const
const_body_iterator body_end() const
SourceLocation getEndLoc() const LLVM_READONLY
const_labels_iterator begin_labels() const
Represents the this expression in C++.
PredefinedExprBitfields PredefinedExprBits
const_decl_iterator decl_begin() const
StringLiteral * getAsmString()
llvm::iterator_range< const_child_iterator > const_child_range
const_child_range children() const
void setBreakLoc(SourceLocation L)
CompoundStmt - This represents a group of statements like { stmt stmt }.
const_child_range children() const
Describes the capture of either a variable, or 'this', or variable-length array type.
Stmt * stripLabelLikeStatements()
static bool classof(const Stmt *T)
const_inputs_iterator begin_inputs() const
void setSemiLoc(SourceLocation L)
const Expr * getRetValue() const
SourceLocation getBeginLoc() const LLVM_READONLY
bool IsVolatile
If true, treat this inline assembly as having side effects.
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
BreakStmtBitfields BreakStmtBits
static bool classof(const Stmt *T)
static bool classof(const Stmt *T)
SourceLocation getEndLoc() const LLVM_READONLY
unsigned getOperandNo() const
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
const DeclStmt * getConditionVariableDeclStmt() const
SourceLocation getBeginLoc() const
SourceLocation getLabelLoc() const
llvm::iterator_range< const_capture_iterator > capture_const_range
void setLeaveLoc(SourceLocation L)
const Stmt * getSubStmt() const
SubstNonTypeTemplateParmExprBitfields SubstNonTypeTemplateParmExprBits
const Stmt * getSubStmt() const
void setRParenLoc(SourceLocation L)
SourceLocation getFinallyLoc() const
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type...
GotoStmt(LabelDecl *label, SourceLocation GL, SourceLocation LL)
This represents one expression.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation getElseLoc() const
void setWhileLoc(SourceLocation L)
Represents a character-granular source range.
inputs_const_range inputs() const
llvm::iterator_range< const_capture_init_iterator > const_capture_init_range
ArrayRef< StringRef > getClobbers() const
InitListExprBitfields InitListExprBits
static bool classof(const Stmt *T)
StringRef getClobber(unsigned i) const
SourceLocation getDefaultLoc() const
void setLParenLoc(SourceLocation L)
const StringLiteral * getClobberStringLiteral(unsigned i) const
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getWhileLoc() const
const Stmt * getThen() const
SourceLocation getEndLoc() const
AsmStringPiece - this is part of a decomposed asm string specification (for use with the AnalyzeAsmSt...
const Expr * getInputExpr(unsigned i) const
const Stmt * getCapturedStmt() const
void setRetValue(Expr *E)
GotoStmtBitfields GotoStmtBits
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
CXXDefaultInitExprBitfields CXXDefaultInitExprBits
SourceLocation getBeginLoc() const
ExprWithCleanupsBitfields ExprWithCleanupsBits
std::reverse_iterator< body_iterator > reverse_body_iterator
bool isOMPStructuredBlock() const
static bool classof(const Stmt *T)
CompoundStmtBitfields CompoundStmtBits
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
capture_init_range capture_inits()
StringLiteralBitfields StringLiteralBits
static OMPLinearClause * CreateEmpty(const ASTContext &C, unsigned NumVars)
Creates an empty clause with the place for NumVars variables.
AsmStringPiece(const std::string &S)
ForStmt(EmptyShell Empty)
Build an empty for statement.
SourceLocation getSwitchLoc() const
StringLiteral * getOutputConstraintLiteral(unsigned i)
LabelDecl * getLabel() const
ReturnStmt - This represents a return, optionally of an expression: return; return 4;...
const_child_range children() const
An expression that sends a message to the given Objective-C object or class.
This represents a Microsoft inline-assembly statement extension.
void setColonLoc(SourceLocation L)
SourceLocation getDoLoc() const
SwitchCase * getSwitchCaseList()
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
llvm::iterator_range< const_decl_iterator > decl_const_range
Represents a reference to a non-type template parameter that has been substituted with a template arg...
SourceLocation getEndLoc() const
SourceLocation getBeginLoc() const
static bool classof(const Stmt *T)
SourceLocation getEndLoc() const
const_child_range children() const
const_inputs_iterator end_inputs() const
const Expr * getCond() const
SourceLocation getEndLoc() const LLVM_READONLY
DoStmt - This represents a 'do/while' stmt.
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
const_child_range children() const
std::reverse_iterator< decl_iterator > reverse_decl_iterator
const_child_range children() const
const Stmt * IgnoreContainers(bool IgnoreCaptured=false) const
SourceLocation getEndLoc() const
OpaqueValueExprBitfields OpaqueValueExprBits
const_child_range children() const
decl_const_range decls() const
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
const_child_range children() const
void setDecl(LabelDecl *D)
ParenListExprBitfields ParenListExprBits
static bool classof(const Stmt *T)
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr...
This captures a statement into a function.
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
SourceLocation getBeginLoc() const
void setGotoLoc(SourceLocation L)
ContinueStmtBitfields ContinueStmtBits
Encodes a location in the source.
StringRef getOutputConstraint(unsigned i) const
bool hasVarStorage() const
True if this WhileStmt has storage for a condition variable.
PseudoObjectExprBitfields PseudoObjectExprBits
UnresolvedLookupExprBitfields UnresolvedLookupExprBits
IfStmtBitfields IfStmtBits
CXXThrowExprBitfields CXXThrowExprBits
SEHLeaveStmt(EmptyShell Empty)
Build an empty __leave statement.
const SwitchCase * getSwitchCaseList() const
void setDoLoc(SourceLocation L)
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
void setConstexpr(bool C)
SourceLocation getExceptLoc() const
const_capture_iterator capture_begin() const
void setIdentLoc(SourceLocation L)
const_child_range children() const
GenericSelectionExprBitfields GenericSelectionExprBits
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
Represents the declaration of a label.
bool capturesVariable() const
Determine whether this capture handles a variable (by reference).
reverse_body_iterator body_rend()
ForStmtBitfields ForStmtBits
SourceLocation getLBraceLoc() const
const std::string & getString() const
labels_const_range labels() const
void setAllEnumCasesCovered()
Set a flag in the SwitchStmt indicating that if the 'switch (X)' is a switch over an enum value then ...
typename CastIterator::iterator_adaptor_base Base
CompoundStmt(SourceLocation Loc)
const_child_range children() const
const_child_range children() const
static bool classof(const Stmt *T)
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load, __atomic_store, and __atomic_compare_exchange_*, for the similarly-named C++11 instructions, and __c11 variants for <stdatomic.h>, and corresponding __opencl_atomic_* for OpenCL 2.0.
SourceLocation getBeginLoc() const LLVM_READONLY
decl_iterator decl_begin()
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getGotoLoc() const
const_child_range children() const
reverse_decl_iterator decl_rbegin()
SEHLeaveStmt(SourceLocation LL)
const StringLiteral * getOutputConstraintLiteral(unsigned i) const
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Stmt * getCapturedStmt()
Retrieve the statement being captured.
const Stmt * body_front() const
const VarDecl * getConditionVariable() const
unsigned capture_size() const
Retrieve the number of captures, including 'this'.
const Stmt * getBody() const
void setCaseLoc(SourceLocation L)
SourceLocation getEndLoc() const
Base::value_type operator*() const
DoStmtBitfields DoStmtBits
NullStmtBitfields NullStmtBits
LabelStmt(EmptyShell Empty)
Build an empty label statement.
const_capture_init_range capture_inits() const
DeclStmt * getConditionVariableDeclStmt()
If this WhileStmt has a condition variable, return the faux DeclStmt associated with the creation of ...
SourceLocation getKeywordLoc() const
MemberExprBitfields MemberExprBits
SourceLocation getBeginLoc() const
SourceLocation getStarLoc() const
const DeclStmt * getConditionVariableDeclStmt() const
void setCapturedRecordDecl(RecordDecl *D)
Set the record declaration for captured variables.
A placeholder type used to construct an empty shell of a type, that will be filled in later (e...
A qualified reference to a name whose declaration cannot yet be resolved.
Represents a C11 generic selection.
AddrLabelExpr - The GNU address of label extension, representing &&label.
const_child_range children() const
void setGotoLoc(SourceLocation L)
NullStmt - This is the null statement ";": C99 6.8.3p3.
llvm::iterator_range< const_labels_iterator > labels_const_range
StringRef getInputConstraint(unsigned i) const
Dataflow Directional Tag Classes.
bool isValid() const
Return true if this is a valid SourceLocation object.
[C99 6.4.2.2] - A predefined identifier such as func.
CXXNullPtrLiteralExprBitfields CXXNullPtrLiteralExprBits
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
IdentifierInfo * getOutputIdentifier(unsigned i) const
static std::string getName(const CallEvent &Call)
llvm::iterator_range< outputs_iterator > outputs_range
ArrayRef< const Attr * > getAttrs() const
bool hasInitStorage() const
True if this IfStmt has the storage for an init statement.
const Stmt * body_back() const
Reads an AST files chain containing the contents of a translation unit.
SourceLocation getEndLoc() const LLVM_READONLY
static bool classof(const Stmt *T)
DoStmt(EmptyShell Empty)
Build an empty do-while statement.
Stmt * getHandler() const
SourceLocation getSemiLoc() const
StmtClass getStmtClass() const
SwitchCase * getNextSwitchCase()
bool isSingleDecl() const
UnaryOperatorBitfields UnaryOperatorBits
static bool classof(const Stmt *T)
SourceLocation getEndLoc() const
SourceLocation getEndLoc() const LLVM_READONLY
void setEllipsisLoc(SourceLocation L)
Set the location of the ...
DependentScopeDeclRefExprBitfields DependentScopeDeclRefExprBits
const Decl * getSingleDecl() const
static bool classof(const Stmt *T)
BreakStmt(EmptyShell Empty)
Build an empty break statement.
SourceLocation getBeginLoc() const LLVM_READONLY
const Stmt * getSubStmt() const
bool isSingleDecl() const
isSingleDecl - This method returns true if this DeclStmt refers to a single Decl. ...
body_iterator body_begin()
DeclStmt * getConditionVariableDeclStmt()
If this IfStmt has a condition variable, return the faux DeclStmt associated with the creation of tha...
static bool classof(const Stmt *T)
IndirectGotoStmt(SourceLocation gotoLoc, SourceLocation starLoc, Expr *target)
const Stmt * getBody() const
CXXNewExprBitfields CXXNewExprBits
llvm::iterator_range< const_body_iterator > body_const_range
Represents a __leave statement.
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
bool capturesVariableByCopy() const
Determine whether this capture handles a variable by copy.
SwitchStmt - This represents a 'switch' stmt.
CXXConstructExprBitfields CXXConstructExprBits
Iterator for iterating over Stmt * arrays that contain only T *.
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
SourceLocation getLeaveLoc() const
const_capture_init_iterator capture_init_end() const
static bool classof(const Stmt *T)
DefaultStmt(EmptyShell Empty)
Build an empty default statement.
reverse_decl_iterator decl_rend()
SourceLocation getBeginLoc() const
StringLiteral * getInputConstraintLiteral(unsigned i)
DeclGroupRef getDeclGroup()
Represents a 'co_await' expression.
const Expr * getInputExpr(unsigned i) const
TypeTraitExprBitfields TypeTraitExprBits
void setSwitchLoc(SourceLocation L)
static bool classof(const Stmt *T)
CXXBoolLiteralExprBitfields CXXBoolLiteralExprBits
AsmStringPiece(unsigned OpNo, const std::string &S, SourceLocation Begin, SourceLocation End)
bool IsSimple
True if the assembly statement does not have any input or output operands.
static bool classof(const Stmt *T)
StringRef getAsmString() const
ArrayRef< StringRef > getAllConstraints() const
SourceLocation getEndLoc() const LLVM_READONLY
UnaryExprOrTypeTraitExprBitfields UnaryExprOrTypeTraitExprBits
SourceLocation getColonLoc() const
unsigned getNumClobbers() const
SourceLocation getRParenLoc() const
void setElseLoc(SourceLocation ElseLoc)
void setStarLoc(SourceLocation L)
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
SourceLocation getAsmLoc() const
GotoStmt - This represents a direct goto.
A use of a default initializer in a constructor or in aggregate initialization.
Decl *const * const_iterator
const SwitchCase * getNextSwitchCase() const
OverloadExprBitfields OverloadExprBits
SourceLocation getBeginLoc() const
static bool classof(const Stmt *T)
const_child_range children() const
llvm::iterator_range< capture_iterator > capture_range
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
SourceLocation getWhileLoc() const
Defines the clang::SourceLocation class and associated facilities.
llvm::iterator_range< inputs_iterator > inputs_range
ContinueStmt - This represents a continue.
SourceLocation getBeginLoc() const
const_decl_iterator decl_end() const
const Expr * getRHS() const
reverse_body_iterator body_rbegin()
void setLBraceLoc(SourceLocation L)
CXXDefaultArgExprBitfields CXXDefaultArgExprBits
Expr * getFilterExpr() const
SourceLocation getAttrLoc() const
ContinueStmt(SourceLocation CL)
const Stmt * getInit() const
OpenMPLinearClauseKind getModifier() const
Return modifier.
WhileStmt - This represents a 'while' stmt.
CXXOperatorCallExprBitfields CXXOperatorCallExprBits
llvm::iterator_range< capture_init_iterator > capture_init_range
const_child_range children() const
labels_iterator begin_labels()
const_child_range children() const
static bool classof(const Stmt *T)
SourceLocation getBeginLoc() const
const Stmt * getSubStmt() const
void setDefaultLoc(SourceLocation L)
SourceLocation getBreakLoc() const
SourceLocation getCaseLoc() const
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of captures.
VariableCaptureKind
The different capture forms: by 'this', by reference, capture for variable-length array type etc...
StringLiteral - This represents a string literal expression, e.g.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
static bool classof(const Stmt *T)
SourceLocation getEndLoc() const LLVM_READONLY
void setRParenLoc(SourceLocation L)
SourceLocExprBitfields SourceLocExprBits
NonOdrUseReason
The reason why a DeclRefExpr does not constitute an odr-use.
void setNextSwitchCase(SwitchCase *SC)
void initialize(TemplateInstantiationCallbackPtrs &Callbacks, const Sema &TheSema)
const_child_range children() const
SourceLocation getBeginLoc() const
body_const_range body() const
A reference to a declared variable, function, enum, etc.
SourceLocation getBeginLoc() const
void setLabel(LabelDecl *D)
SourceLocation getBeginLoc() const
static bool classof(const Stmt *T)
BreakStmt - This represents a break.
const Stmt * getInit() const
SourceLocation getBeginLoc() const
void setSubStmt(Stmt *SS)
CallExprBitfields CallExprBits
CapturedRegionKind
The different kinds of captured statement.
unsigned getNumLabels() const
const Stmt * getBody() const
CastExprBitfields CastExprBits
DeclStmt(DeclGroupRef dg, SourceLocation startLoc, SourceLocation endLoc)
CXXNoexceptExprBitfields CXXNoexceptExprBits
const Expr * getCond() const
A trivial tuple used to represent a source range.
A boolean literal, per ([C++ lex.bool] Boolean literals).
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type, member-designator).
const_reverse_body_iterator body_rend() const
SourceLocation getEndLoc() const LLVM_READONLY
const Expr * getCond() const
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument.
BinaryOperatorBitfields BinaryOperatorBits
SourceLocation ColonLoc
Location of ':'.
const_child_range children() const
void setWhileLoc(SourceLocation L)
bool caseStmtIsGNURange() const
True if this case statement is of the form case LHS ...
This class handles loading and caching of source files into memory.
BreakStmt(SourceLocation BL)
CompoundStmt * getTryBlock() const
CompoundStmt * getBlock() const
void setKeywordLoc(SourceLocation L)
SourceLocation getReturnLoc() const
bool capturesVariableArrayType() const
Determine whether this capture handles a variable-length array type.
Attr - This represents one attribute.
void setLabelLoc(SourceLocation L)
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr *> VL, ArrayRef< Expr *> PL, ArrayRef< Expr *> IL, Expr *Step, Expr *CalcStep, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL and a linear step Step.
child_iterator child_end()
#define BLOCK(DERIVED, BASE)
const Stmt * getStmtExprResult() const
SourceLocation getEndLoc() const
CXXDependentScopeMemberExprBitfields CXXDependentScopeMemberExprBits
const_capture_init_iterator capture_init_begin() const
SourceLocation getLocation() const
Retrieve the source location at which the variable or 'this' was first used.
const DeclStmt * getConditionVariableDeclStmt() const
inputs_iterator end_inputs()
outputs_const_range outputs() const
const LabelDecl * getConstantTarget() const