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;
611 unsigned : NumCallExprBits;
613 unsigned IsReversed : 1;
619 unsigned : NumExprBits;
631 unsigned : NumExprBits;
640 unsigned : NumExprBits;
643 unsigned IsImplicit : 1;
653 unsigned : NumExprBits;
656 unsigned IsThrownVariableInScope : 1;
666 unsigned : NumExprBits;
676 unsigned : NumExprBits;
686 unsigned : NumExprBits;
696 unsigned : NumExprBits;
699 unsigned IsGlobalNew : 1;
703 unsigned IsArray : 1;
706 unsigned ShouldPassAlignment : 1;
710 unsigned UsualArrayDeleteWantsSize : 1;
715 unsigned StoredInitializationStyle : 2;
718 unsigned IsParenTypeId : 1;
721 unsigned NumPlacementArgs;
728 unsigned : NumExprBits;
731 unsigned GlobalDelete : 1;
734 unsigned ArrayForm : 1;
739 unsigned ArrayFormAsWritten : 1;
743 unsigned UsualArrayDeleteWantsSize : 1;
754 unsigned : NumExprBits;
764 unsigned NumArgs : 32 - 8 - 1 - NumExprBits;
772 unsigned : NumExprBits;
776 unsigned HasTemplateKWAndArgsInfo : 1;
783 unsigned : NumExprBits;
785 unsigned Elidable : 1;
786 unsigned HadMultipleCandidates : 1;
787 unsigned ListInitialization : 1;
788 unsigned StdInitListInitialization : 1;
789 unsigned ZeroInitialization : 1;
790 unsigned ConstructionKind : 3;
799 unsigned : NumExprBits;
802 unsigned CleanupsHaveSideEffects : 1;
804 unsigned NumObjects : 32 - 1 - NumExprBits;
811 unsigned : NumExprBits;
821 unsigned : NumExprBits;
825 unsigned IsArrow : 1;
829 unsigned HasTemplateKWAndArgsInfo : 1;
833 unsigned HasFirstQualifierFoundInScope : 1;
843 unsigned : NumExprBits;
847 unsigned HasTemplateKWAndArgsInfo : 1;
852 unsigned : 32 - NumExprBits - 1;
857 enum { NumOverloadExprBits = NumExprBits + 1 };
863 unsigned : NumOverloadExprBits;
867 unsigned RequiresADL : 1;
871 unsigned Overloaded : 1;
874 "UnresolvedLookupExprBitfields must be <= than 4 bytes to" 875 "avoid trashing OverloadExprBitfields::NumResults!");
881 unsigned : NumOverloadExprBits;
885 unsigned IsArrow : 1;
888 unsigned HasUnresolvedUsing : 1;
891 "UnresolvedMemberExprBitfields must be <= than 4 bytes to" 892 "avoid trashing OverloadExprBitfields::NumResults!");
898 unsigned : NumExprBits;
907 unsigned : NumExprBits;
918 unsigned : NumExprBits;
920 unsigned IsSatisfied : 1;
929 unsigned : NumExprBits;
931 unsigned IsImplicit : 1;
939 unsigned : NumExprBits;
941 unsigned ShouldCopy : 1;
950 unsigned : NumExprBits;
954 unsigned IsUnique : 1;
1038 unsigned alignment = 8);
1041 unsigned alignment = 8) {
1042 return operator new(
bytes, *C, alignment);
1045 void *
operator new(
size_t bytes,
void *mem) noexcept {
return mem; }
1047 void operator delete(
void *,
const ASTContext &, unsigned) noexcept {}
1048 void operator delete(
void *,
const ASTContext *, unsigned) noexcept {}
1049 void operator delete(
void *,
size_t) noexcept {}
1050 void operator delete(
void *,
void *) noexcept {}
1063 template<
typename T,
typename TPtr = T *,
typename StmtPtr = Stmt *>
1065 : llvm::iterator_adaptor_base<CastIterator<T, TPtr, StmtPtr>, StmtPtr *,
1066 std::random_access_iterator_tag, TPtr> {
1067 using Base =
typename CastIterator::iterator_adaptor_base;
1073 return cast_or_null<T>(*this->I);
1078 template <
typename T>
1086 static bool StatisticsEnabled;
1096 Stmt &operator=(
const Stmt &) =
delete;
1100 static_assert(
sizeof(*
this) <= 8,
1101 "changing bitfields changed sizeof(Stmt)");
1102 static_assert(
sizeof(*
this) %
alignof(
void *) == 0,
1103 "Insufficient alignment!");
1104 StmtBits.sClass = SC;
1105 StmtBits.IsOMPStructuredBlock =
false;
1106 if (StatisticsEnabled) Stmt::addStmtClass(SC);
1110 return static_cast<StmtClass>(StmtBits.sClass);
1113 const char *getStmtClassName()
const;
1117 StmtBits.IsOMPStructuredBlock = IsOMPStructuredBlock;
1128 static void addStmtClass(
const StmtClass s);
1129 static void EnableStatistics();
1130 static void PrintStats();
1137 void dump(raw_ostream &OS)
const;
1140 int64_t getID(
const ASTContext &Context)
const;
1143 void dumpColor()
const;
1147 void dumpPretty(
const ASTContext &Context)
const;
1150 StringRef NewlineSymbol =
"\n",
1151 const ASTContext *Context =
nullptr)
const;
1159 void viewAST()
const;
1163 Stmt *IgnoreContainers(
bool IgnoreCaptured =
false);
1165 return const_cast<Stmt *
>(
this)->IgnoreContainers(IgnoreCaptured);
1168 const Stmt *stripLabelLikeStatements()
const;
1170 return const_cast<Stmt*
>(
1171 const_cast<const Stmt*
>(
this)->stripLabelLikeStatements());
1208 void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
1209 bool Canonical)
const;
1218 void ProcessODRHash(llvm::FoldingSetNodeID &ID,
ODRHash& Hash)
const;
1231 :
Stmt(DeclStmtClass), DG(dg), StartLoc(startLoc), EndLoc(endLoc) {}
1300 :
Stmt(NullStmtClass) {
1301 NullStmtBits.HasLeadingEmptyMacro = hasLeadingEmptyMacro;
1312 return NullStmtBits.HasLeadingEmptyMacro;
1351 :
Stmt(CompoundStmtClass), RBraceLoc(Loc) {
1352 CompoundStmtBits.NumStmts = 0;
1353 CompoundStmtBits.LBraceLoc = Loc;
1359 bool body_empty()
const {
return CompoundStmtBits.NumStmts == 0; }
1360 unsigned size()
const {
return CompoundStmtBits.NumStmts; }
1371 return !body_empty() ? body_begin()[size() - 1] :
nullptr;
1382 return getTrailingObjects<Stmt *>();
1388 return !body_empty() ? body_begin()[0] :
nullptr;
1392 return !body_empty() ? body_begin()[size() - 1] :
nullptr;
1406 std::reverse_iterator<const_body_iterator>;
1425 for (
auto *B : llvm::reverse(body())) {
1426 if (!isa<NullStmt>(B))
1433 return const_cast<CompoundStmt *
>(
this)->getStmtExprResult();
1468 :
Stmt(SC), ColonLoc(ColonLoc) {
1469 setKeywordLoc(KWLoc);
1484 inline Stmt *getSubStmt();
1486 return const_cast<SwitchCase *
>(
this)->getSubStmt();
1520 enum { LhsOffset = 0, SubStmtOffsetFromRhs = 1 };
1521 enum { NumMandatoryStmtPtr = 2 };
1523 unsigned numTrailingObjects(OverloadToken<Stmt *>)
const {
1524 return NumMandatoryStmtPtr + caseStmtIsGNURange();
1527 unsigned numTrailingObjects(OverloadToken<SourceLocation>)
const {
1528 return caseStmtIsGNURange();
1531 unsigned lhsOffset()
const {
return LhsOffset; }
1532 unsigned rhsOffset()
const {
return LhsOffset + caseStmtIsGNURange(); }
1533 unsigned subStmtOffset()
const {
return rhsOffset() + SubStmtOffsetFromRhs; }
1539 :
SwitchCase(CaseStmtClass, caseLoc, colonLoc) {
1541 bool IsGNURange = rhs !=
nullptr;
1542 SwitchCaseBits.CaseStmtIsGNURange = IsGNURange;
1544 setSubStmt(
nullptr);
1547 setEllipsisLoc(ellipsisLoc);
1554 SwitchCaseBits.CaseStmtIsGNURange = CaseStmtIsGNURange;
1576 return caseStmtIsGNURange() ? *getTrailingObjects<SourceLocation>()
1584 caseStmtIsGNURange() &&
1585 "setEllipsisLoc but this is not a case stmt of the form LHS ... RHS!");
1586 *getTrailingObjects<SourceLocation>() = L;
1590 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[lhsOffset()]);
1594 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[lhsOffset()]);
1598 getTrailingObjects<Stmt *>()[lhsOffset()] =
reinterpret_cast<Stmt *
>(Val);
1602 return caseStmtIsGNURange() ?
reinterpret_cast<Expr *
>(
1603 getTrailingObjects<Stmt *>()[rhsOffset()])
1608 return caseStmtIsGNURange() ?
reinterpret_cast<Expr *
>(
1609 getTrailingObjects<Stmt *>()[rhsOffset()])
1614 assert(caseStmtIsGNURange() &&
1615 "setRHS but this is not a case stmt of the form LHS ... RHS!");
1616 getTrailingObjects<Stmt *>()[rhsOffset()] =
reinterpret_cast<Stmt *
>(Val);
1621 return getTrailingObjects<Stmt *>()[subStmtOffset()];
1625 getTrailingObjects<Stmt *>()[subStmtOffset()] = S;
1632 while (
const auto *CS2 = dyn_cast<CaseStmt>(CS->
getSubStmt()))
1645 getTrailingObjects<Stmt *>() +
1646 numTrailingObjects(OverloadToken<Stmt *>()));
1651 getTrailingObjects<Stmt *>() +
1652 numTrailingObjects(OverloadToken<Stmt *>()));
1661 :
SwitchCase(DefaultStmtClass, DL, CL), SubStmt(substmt) {}
1692 if (
const auto *CS = dyn_cast<CaseStmt>(
this))
1693 return CS->getEndLoc();
1694 else if (
const auto *DS = dyn_cast<DefaultStmt>(
this))
1695 return DS->getEndLoc();
1696 llvm_unreachable(
"SwitchCase is neither a CaseStmt nor a DefaultStmt!");
1700 if (
auto *CS = dyn_cast<CaseStmt>(
this))
1701 return CS->getSubStmt();
1702 else if (
auto *DS = dyn_cast<DefaultStmt>(
this))
1703 return DS->getSubStmt();
1704 llvm_unreachable(
"SwitchCase is neither a CaseStmt nor a DefaultStmt!");
1718 const Expr *getExprStmt()
const;
1739 :
ValueStmt(LabelStmtClass), TheDecl(D), SubStmt(substmt) {
1786 :
ValueStmt(AttributedStmtClass), SubStmt(SubStmt) {
1787 AttributedStmtBits.NumAttrs = Attrs.size();
1788 AttributedStmtBits.AttrLoc = Loc;
1789 std::copy(Attrs.begin(), Attrs.end(), getAttrArrayPtr());
1793 :
ValueStmt(AttributedStmtClass, Empty) {
1794 AttributedStmtBits.NumAttrs = NumAttrs;
1796 std::fill_n(getAttrArrayPtr(), NumAttrs,
nullptr);
1799 const Attr *
const *getAttrArrayPtr()
const {
1800 return getTrailingObjects<const Attr *>();
1802 const Attr **getAttrArrayPtr() {
return getTrailingObjects<const Attr *>(); }
1813 return llvm::makeArrayRef(getAttrArrayPtr(), AttributedStmtBits.NumAttrs);
1861 enum { InitOffset = 0, ThenOffsetFromCond = 1, ElseOffsetFromCond = 2 };
1862 enum { NumMandatoryStmtPtr = 2 };
1864 unsigned numTrailingObjects(OverloadToken<Stmt *>)
const {
1865 return NumMandatoryStmtPtr + hasElseStorage() + hasVarStorage() +
1869 unsigned numTrailingObjects(OverloadToken<SourceLocation>)
const {
1870 return hasElseStorage();
1873 unsigned initOffset()
const {
return InitOffset; }
1874 unsigned varOffset()
const {
return InitOffset + hasInitStorage(); }
1875 unsigned condOffset()
const {
1876 return InitOffset + hasInitStorage() + hasVarStorage();
1878 unsigned thenOffset()
const {
return condOffset() + ThenOffsetFromCond; }
1879 unsigned elseOffset()
const {
return condOffset() + ElseOffsetFromCond; }
1886 explicit IfStmt(
EmptyShell Empty,
bool HasElse,
bool HasVar,
bool HasInit);
1893 Stmt *Else =
nullptr);
1910 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[condOffset()]);
1914 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[condOffset()]);
1918 getTrailingObjects<Stmt *>()[condOffset()] =
reinterpret_cast<Stmt *
>(Cond);
1921 Stmt *
getThen() {
return getTrailingObjects<Stmt *>()[thenOffset()]; }
1923 return getTrailingObjects<Stmt *>()[thenOffset()];
1927 getTrailingObjects<Stmt *>()[thenOffset()] = Then;
1931 return hasElseStorage() ? getTrailingObjects<Stmt *>()[elseOffset()]
1936 return hasElseStorage() ? getTrailingObjects<Stmt *>()[elseOffset()]
1941 assert(hasElseStorage() &&
1942 "This if statement has no storage for an else statement!");
1943 getTrailingObjects<Stmt *>()[elseOffset()] = Else;
1954 VarDecl *getConditionVariable();
1956 return const_cast<IfStmt *
>(
this)->getConditionVariable();
1966 return hasVarStorage() ?
static_cast<DeclStmt *
>(
1967 getTrailingObjects<Stmt *>()[varOffset()])
1972 return hasVarStorage() ?
static_cast<DeclStmt *
>(
1973 getTrailingObjects<Stmt *>()[varOffset()])
1978 return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
1983 return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
1988 assert(hasInitStorage() &&
1989 "This if statement has no storage for an init statement!");
1990 getTrailingObjects<Stmt *>()[initOffset()] = Init;
1997 return hasElseStorage() ? *getTrailingObjects<SourceLocation>()
2002 assert(hasElseStorage() &&
2003 "This if statement has no storage for an else statement!");
2004 *getTrailingObjects<SourceLocation>() = ElseLoc;
2014 bool isObjCAvailabilityCheck()
const;
2019 return getElse()->getEndLoc();
2020 return getThen()->getEndLoc();
2027 getTrailingObjects<Stmt *>() +
2028 numTrailingObjects(OverloadToken<Stmt *>()));
2033 getTrailingObjects<Stmt *>() +
2034 numTrailingObjects(OverloadToken<Stmt *>()));
2067 enum { InitOffset = 0, BodyOffsetFromCond = 1 };
2068 enum { NumMandatoryStmtPtr = 2 };
2070 unsigned numTrailingObjects(OverloadToken<Stmt *>)
const {
2071 return NumMandatoryStmtPtr + hasInitStorage() + hasVarStorage();
2074 unsigned initOffset()
const {
return InitOffset; }
2075 unsigned varOffset()
const {
return InitOffset + hasInitStorage(); }
2076 unsigned condOffset()
const {
2077 return InitOffset + hasInitStorage() + hasVarStorage();
2079 unsigned bodyOffset()
const {
return condOffset() + BodyOffsetFromCond; }
2104 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[condOffset()]);
2108 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[condOffset()]);
2112 getTrailingObjects<Stmt *>()[condOffset()] =
reinterpret_cast<Stmt *
>(Cond);
2115 Stmt *
getBody() {
return getTrailingObjects<Stmt *>()[bodyOffset()]; }
2117 return getTrailingObjects<Stmt *>()[bodyOffset()];
2121 getTrailingObjects<Stmt *>()[bodyOffset()] = Body;
2125 return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
2130 return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
2135 assert(hasInitStorage() &&
2136 "This switch statement has no storage for an init statement!");
2137 getTrailingObjects<Stmt *>()[initOffset()] = Init;
2149 VarDecl *getConditionVariable();
2151 return const_cast<SwitchStmt *
>(
this)->getConditionVariable();
2161 return hasVarStorage() ?
static_cast<DeclStmt *
>(
2162 getTrailingObjects<Stmt *>()[varOffset()])
2167 return hasVarStorage() ?
static_cast<DeclStmt *
>(
2168 getTrailingObjects<Stmt *>()[varOffset()])
2186 "case/default already added to a switch");
2198 return SwitchStmtBits.AllEnumCasesCovered;
2203 return getBody() ? getBody()->getEndLoc()
2204 :
reinterpret_cast<const Stmt *
>(getCond())->getEndLoc();
2210 getTrailingObjects<Stmt *>() +
2211 numTrailingObjects(OverloadToken<Stmt *>()));
2216 getTrailingObjects<Stmt *>() +
2217 numTrailingObjects(OverloadToken<Stmt *>()));
2245 enum { VarOffset = 0, BodyOffsetFromCond = 1 };
2246 enum { NumMandatoryStmtPtr = 2 };
2248 unsigned varOffset()
const {
return VarOffset; }
2249 unsigned condOffset()
const {
return VarOffset + hasVarStorage(); }
2250 unsigned bodyOffset()
const {
return condOffset() + BodyOffsetFromCond; }
2252 unsigned numTrailingObjects(OverloadToken<Stmt *>)
const {
2253 return NumMandatoryStmtPtr + hasVarStorage();
2276 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[condOffset()]);
2280 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[condOffset()]);
2284 getTrailingObjects<Stmt *>()[condOffset()] =
reinterpret_cast<Stmt *
>(Cond);
2287 Stmt *
getBody() {
return getTrailingObjects<Stmt *>()[bodyOffset()]; }
2289 return getTrailingObjects<Stmt *>()[bodyOffset()];
2293 getTrailingObjects<Stmt *>()[bodyOffset()] = Body;
2304 VarDecl *getConditionVariable();
2306 return const_cast<WhileStmt *
>(
this)->getConditionVariable();
2316 return hasVarStorage() ?
static_cast<DeclStmt *
>(
2317 getTrailingObjects<Stmt *>()[varOffset()])
2322 return hasVarStorage() ?
static_cast<DeclStmt *
>(
2323 getTrailingObjects<Stmt *>()[varOffset()])
2332 return getBody()->getEndLoc();
2342 getTrailingObjects<Stmt *>() +
2343 numTrailingObjects(OverloadToken<Stmt *>()));
2348 getTrailingObjects<Stmt *>() +
2349 numTrailingObjects(OverloadToken<Stmt *>()));
2355 enum { BODY, COND, END_EXPR };
2356 Stmt *SubExprs[END_EXPR];
2363 :
Stmt(DoStmtClass), WhileLoc(WL), RParenLoc(RP) {
2374 return reinterpret_cast<Expr *
>(SubExprs[COND]);
2399 return child_range(&SubExprs[0], &SubExprs[0] + END_EXPR);
2411 enum { INIT, CONDVAR, COND, INC, BODY, END_EXPR };
2412 Stmt* SubExprs[END_EXPR];
2433 VarDecl *getConditionVariable()
const;
2439 return reinterpret_cast<DeclStmt*
>(SubExprs[CONDVAR]);
2472 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
2487 :
Stmt(GotoStmtClass), Label(label), LabelLoc(LL) {
2526 :
Stmt(IndirectGotoStmtClass), StarLoc(starLoc) {
2528 setGotoLoc(gotoLoc);
2533 :
Stmt(IndirectGotoStmtClass, Empty) {}
2542 return reinterpret_cast<const Expr *
>(Target);
2648 bool hasNRVOCandidate()
const {
return ReturnStmtBits.HasNRVOCandidate; }
2650 unsigned numTrailingObjects(OverloadToken<const VarDecl *>)
const {
2651 return hasNRVOCandidate();
2663 const VarDecl *NRVOCandidate);
2679 return hasNRVOCandidate() ? *getTrailingObjects<const VarDecl *>()
2687 assert(hasNRVOCandidate() &&
2688 "This return statement has no storage for an NRVO candidate!");
2689 *getTrailingObjects<const VarDecl *>() = Var;
2697 return RetExpr ? RetExpr->
getEndLoc() : getReturnLoc();
2740 unsigned numoutputs,
unsigned numinputs,
unsigned numclobbers)
2741 :
Stmt (SC), AsmLoc(asmloc), IsSimple(issimple), IsVolatile(isvolatile),
2742 NumOutputs(numoutputs), NumInputs(numinputs),
2743 NumClobbers(numclobbers) {}
2764 std::string generateAsmString(
const ASTContext &
C)
const;
2773 StringRef getOutputConstraint(
unsigned i)
const;
2779 return getOutputConstraint(i)[0] ==
'+';
2782 const Expr *getOutputExpr(
unsigned i)
const;
2786 unsigned getNumPlusOperands()
const;
2794 StringRef getInputConstraint(
unsigned i)
const;
2796 const Expr *getInputExpr(
unsigned i)
const;
2801 StringRef getClobber(
unsigned i)
const;
2816 return &Exprs[0] + NumOutputs;
2820 return &Exprs[0] + NumOutputs + NumInputs;
2826 return &Exprs[0] + NumOutputs;
2830 return &Exprs[0] + NumOutputs + NumInputs;
2849 return &Exprs[0] + NumOutputs;
2861 return &Exprs[0] + NumOutputs;
2869 return child_range(&Exprs[0], &Exprs[0] + NumOutputs + NumInputs);
2888 unsigned NumLabels = 0;
2892 bool isvolatile,
unsigned numoutputs,
unsigned numinputs,
2932 : MyKind(Operand), Str(S), OperandNo(OpNo),
2941 assert(isOperand());
2946 assert(isOperand() &&
"Range is currently used only for Operands.");
2961 const ASTContext &C,
unsigned &DiagOffs)
const;
2964 std::string generateAsmString(
const ASTContext &C)
const;
2972 return II->getName();
2977 StringRef getOutputConstraint(
unsigned i)
const;
2980 return Constraints[i];
2983 return Constraints[i];
2986 Expr *getOutputExpr(
unsigned i);
2989 return const_cast<GCCAsmStmt*
>(
this)->getOutputExpr(i);
2995 return Names[i + NumOutputs];
3000 return II->getName();
3005 StringRef getInputConstraint(
unsigned i)
const;
3008 return Constraints[i + NumOutputs];
3011 return Constraints[i + NumOutputs];
3014 Expr *getInputExpr(
unsigned i);
3015 void setInputExpr(
unsigned i,
Expr *E);
3018 return const_cast<GCCAsmStmt*
>(
this)->getInputExpr(i);
3024 return NumLabels > 0;
3032 return Names[i + NumInputs];
3036 StringRef getLabelName(
unsigned i)
const;
3043 return &Exprs[0] + NumInputs;
3047 return &Exprs[0] + NumInputs + NumLabels;
3055 return &Exprs[0] + NumInputs;
3059 return &Exprs[0] + NumInputs + NumLabels;
3067 void setOutputsAndInputsAndClobbers(
const ASTContext &C,
3071 unsigned NumOutputs,
3075 unsigned NumClobbers);
3083 int getNamedOperand(StringRef SymbolicName)
const;
3085 StringRef getClobber(
unsigned i)
const;
3107 unsigned NumAsmToks = 0;
3109 Token *AsmToks =
nullptr;
3110 StringRef *Constraints =
nullptr;
3111 StringRef *Clobbers =
nullptr;
3138 std::string generateAsmString(
const ASTContext &
C)
const;
3143 assert(i < NumOutputs);
3144 return Constraints[i];
3147 Expr *getOutputExpr(
unsigned i);
3150 return const_cast<MSAsmStmt*
>(
this)->getOutputExpr(i);
3156 assert(i < NumInputs);
3157 return Constraints[i + NumOutputs];
3160 Expr *getInputExpr(
unsigned i);
3161 void setInputExpr(
unsigned i,
Expr *E);
3164 return const_cast<MSAsmStmt*
>(
this)->getInputExpr(i);
3170 return llvm::makeArrayRef(Constraints, NumInputs + NumOutputs);
3174 return llvm::makeArrayRef(Clobbers, NumClobbers);
3178 return llvm::makeArrayRef(reinterpret_cast<Expr**>(Exprs),
3179 NumInputs + NumOutputs);
3182 StringRef
getClobber(
unsigned i)
const {
return getClobbers()[i]; }
3197 return child_range(&Exprs[0], &Exprs[NumInputs + NumOutputs]);
3212 enum { FILTER_EXPR,
BLOCK };
3229 return reinterpret_cast<Expr*
>(Children[FILTER_EXPR]);
3233 return cast<CompoundStmt>(Children[
BLOCK]);
3292 enum { TRY = 0, HANDLER = 1 };
3314 return cast<CompoundStmt>(Children[TRY]);
3342 :
Stmt(SEHLeaveStmtClass), LeaveLoc(LL) {}
3390 llvm::PointerIntPair<VarDecl *, 2, VariableCaptureKind> VarAndKind;
3421 return getCaptureKind() == VCK_ByCopy;
3427 return getCaptureKind() == VCK_VLAType;
3433 VarDecl *getCapturedVar()
const;
3438 unsigned NumCaptures;
3442 llvm::PointerIntPair<CapturedDecl *, 2, CapturedRegionKind> CapDeclAndKind;
3454 Stmt **getStoredStmts() {
return reinterpret_cast<Stmt **
>(
this + 1); }
3456 Stmt *
const *getStoredStmts()
const {
3457 return reinterpret_cast<Stmt *
const *
>(
this + 1);
3460 Capture *getStoredCaptures()
const;
3462 void setCapturedStmt(
Stmt *S) { getStoredStmts()[NumCaptures] = S; }
3474 unsigned NumCaptures);
3498 assert(D &&
"null RecordDecl");
3503 bool capturesVariable(
const VarDecl *Var)
const;
3525 return getStoredCaptures() + NumCaptures;
3539 llvm::iterator_range<const_capture_init_iterator>;
3551 return reinterpret_cast<Expr **
>(getStoredStmts());
3555 return reinterpret_cast<Expr *
const *
>(getStoredStmts());
3561 return capture_init_begin() + NumCaptures;
3565 return capture_init_begin() + NumCaptures;
3569 return getCapturedStmt()->getBeginLoc();
3573 return getCapturedStmt()->getEndLoc();
3577 return getCapturedStmt()->getSourceRange();
3591 #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().
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
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
CXXRewrittenBinaryOperatorBitfields CXXRewrittenBinaryOperatorBits
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
RequiresExprBitfields RequiresExprBits
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 rewritten comparison expression that was originally written using operator syntax.
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