13#ifndef LLVM_CLANG_AST_STMT_H
14#define LLVM_CLANG_AST_STMT_H
30#include "llvm/ADT/APFloat.h"
31#include "llvm/ADT/ArrayRef.h"
32#include "llvm/ADT/BitmaskEnum.h"
33#include "llvm/ADT/PointerIntPair.h"
34#include "llvm/ADT/StringRef.h"
35#include "llvm/ADT/iterator.h"
36#include "llvm/ADT/iterator_range.h"
37#include "llvm/Support/Casting.h"
38#include "llvm/Support/Compiler.h"
39#include "llvm/Support/ErrorHandling.h"
49class FoldingSetNodeID;
84class alignas(void *)
Stmt {
88#define STMT(CLASS, PARENT) CLASS##Class,
89#define STMT_RANGE(BASE, FIRST, LAST) \
90 first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class,
91#define LAST_STMT_RANGE(BASE, FIRST, LAST) \
92 first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class
93#define ABSTRACT_STMT(STMT)
94#include "clang/AST/StmtNodes.inc"
102 void *
operator new(
size_t bytes)
noexcept {
103 llvm_unreachable(
"Stmts cannot be allocated with regular 'new'.");
106 void operator delete(
void *data)
noexcept {
107 llvm_unreachable(
"Stmts cannot be released with regular 'delete'.");
136 LLVM_PREFERRED_TYPE(
bool)
137 unsigned HasLeadingEmptyMacro : 1;
152 LLVM_PREFERRED_TYPE(
bool)
153 unsigned HasFPFeatures : 1;
193 LLVM_PREFERRED_TYPE(
bool)
194 unsigned HasElse : 1;
197 LLVM_PREFERRED_TYPE(
bool)
201 LLVM_PREFERRED_TYPE(
bool)
202 unsigned HasInit : 1;
215 LLVM_PREFERRED_TYPE(
bool)
216 unsigned HasInit : 1;
219 LLVM_PREFERRED_TYPE(
bool)
225 LLVM_PREFERRED_TYPE(
bool)
226 unsigned AllEnumCasesCovered : 1;
240 LLVM_PREFERRED_TYPE(
bool)
305 LLVM_PREFERRED_TYPE(
bool)
306 unsigned HasNRVOCandidate : 1;
321 LLVM_PREFERRED_TYPE(
bool)
322 unsigned CaseStmtIsGNURange : 1;
358 unsigned ValueKind : 2;
360 unsigned ObjectKind : 3;
362 unsigned Dependent : llvm::BitWidth<ExprDependence>;
376 unsigned ResultKind : 2;
380 unsigned APValueKind : 4;
384 LLVM_PREFERRED_TYPE(
bool)
385 unsigned IsUnsigned : 1;
391 unsigned BitWidth : 7;
395 LLVM_PREFERRED_TYPE(
bool)
396 unsigned HasCleanup : 1;
399 LLVM_PREFERRED_TYPE(
bool)
400 unsigned IsImmediateInvocation : 1;
415 LLVM_PREFERRED_TYPE(
bool)
416 unsigned HasFunctionName : 1;
420 LLVM_PREFERRED_TYPE(
bool)
421 unsigned IsTransparent : 1;
434 LLVM_PREFERRED_TYPE(
bool)
435 unsigned HasQualifier : 1;
436 LLVM_PREFERRED_TYPE(
bool)
437 unsigned HasTemplateKWAndArgsInfo : 1;
438 LLVM_PREFERRED_TYPE(
bool)
439 unsigned HasFoundDecl : 1;
440 LLVM_PREFERRED_TYPE(
bool)
441 unsigned HadMultipleCandidates : 1;
442 LLVM_PREFERRED_TYPE(
bool)
443 unsigned RefersToEnclosingVariableOrCapture : 1;
444 LLVM_PREFERRED_TYPE(
bool)
445 unsigned CapturedByCopyInLambdaWithExplicitObjectParameter : 1;
448 LLVM_PREFERRED_TYPE(
bool)
449 unsigned IsImmediateEscalating : 1;
463 llvm::APFloat::S_MaxSemantics < 32,
464 "Too many Semantics enum values to fit in bitfield of size 5");
465 LLVM_PREFERRED_TYPE(llvm::APFloat::Semantics)
466 unsigned Semantics : 5;
467 LLVM_PREFERRED_TYPE(
bool)
468 unsigned IsExact : 1;
486 unsigned CharByteWidth : 3;
488 LLVM_PREFERRED_TYPE(
bool)
489 unsigned IsPascal : 1;
493 unsigned NumConcatenated;
514 LLVM_PREFERRED_TYPE(
bool)
515 unsigned CanOverflow : 1;
520 LLVM_PREFERRED_TYPE(
bool)
521 unsigned HasFPFeatures : 1;
534 LLVM_PREFERRED_TYPE(
bool)
554 unsigned NumPreArgs : 1;
557 LLVM_PREFERRED_TYPE(
bool)
558 unsigned UsesADL : 1;
561 LLVM_PREFERRED_TYPE(
bool)
562 unsigned HasFPFeatures : 1;
570 unsigned OffsetToTrailingObjects : 8;
582 LLVM_PREFERRED_TYPE(
bool)
583 unsigned IsArrow : 1;
587 LLVM_PREFERRED_TYPE(
bool)
588 unsigned HasQualifier : 1;
591 LLVM_PREFERRED_TYPE(
bool)
592 unsigned HasFoundDecl : 1;
599 LLVM_PREFERRED_TYPE(
bool)
600 unsigned HasTemplateKWAndArgsInfo : 1;
604 LLVM_PREFERRED_TYPE(
bool)
605 unsigned HadMultipleCandidates : 1;
626 LLVM_PREFERRED_TYPE(
bool)
627 unsigned PartOfExplicitCast : 1;
630 LLVM_PREFERRED_TYPE(
bool)
631 unsigned HasFPFeatures : 1;
635 unsigned BasePathSize;
650 LLVM_PREFERRED_TYPE(
bool)
651 unsigned HasFPFeatures : 1;
655 LLVM_PREFERRED_TYPE(
bool)
656 unsigned ExcludedOverflowPattern : 1;
669 LLVM_PREFERRED_TYPE(
bool)
670 unsigned HadArrayRangeDesignator : 1;
702 unsigned NumSubExprs : 16;
703 unsigned ResultIndex : 16;
729 unsigned TemplateDepth;
744 unsigned OperatorKind : 6;
754 LLVM_PREFERRED_TYPE(
bool)
755 unsigned IsReversed : 1;
765 LLVM_PREFERRED_TYPE(
bool)
789 LLVM_PREFERRED_TYPE(
bool)
790 unsigned IsImplicit : 1;
794 LLVM_PREFERRED_TYPE(
bool)
795 unsigned CapturedByCopyInLambdaWithExplicitObjectParameter : 1;
809 LLVM_PREFERRED_TYPE(
bool)
810 unsigned IsThrownVariableInScope : 1;
824 LLVM_PREFERRED_TYPE(
bool)
825 unsigned HasRewrittenInit : 1;
840 LLVM_PREFERRED_TYPE(
bool)
841 unsigned HasRewrittenInit : 1;
866 LLVM_PREFERRED_TYPE(
bool)
867 unsigned IsGlobalNew : 1;
871 LLVM_PREFERRED_TYPE(
bool)
872 unsigned IsArray : 1;
875 LLVM_PREFERRED_TYPE(
bool)
876 unsigned ShouldPassAlignment : 1;
880 LLVM_PREFERRED_TYPE(
bool)
881 unsigned UsualArrayDeleteWantsSize : 1;
884 LLVM_PREFERRED_TYPE(
bool)
885 unsigned HasInitializer : 1;
889 unsigned StoredInitializationStyle : 2;
892 LLVM_PREFERRED_TYPE(
bool)
893 unsigned IsParenTypeId : 1;
896 unsigned NumPlacementArgs;
907 LLVM_PREFERRED_TYPE(
bool)
908 unsigned GlobalDelete : 1;
911 LLVM_PREFERRED_TYPE(
bool)
912 unsigned ArrayForm : 1;
917 LLVM_PREFERRED_TYPE(
bool)
918 unsigned ArrayFormAsWritten : 1;
922 LLVM_PREFERRED_TYPE(
bool)
923 unsigned UsualArrayDeleteWantsSize : 1;
943 LLVM_PREFERRED_TYPE(
bool)
962 LLVM_PREFERRED_TYPE(
bool)
963 unsigned HasTemplateKWAndArgsInfo : 1;
973 LLVM_PREFERRED_TYPE(
bool)
974 unsigned Elidable : 1;
975 LLVM_PREFERRED_TYPE(
bool)
976 unsigned HadMultipleCandidates : 1;
977 LLVM_PREFERRED_TYPE(
bool)
978 unsigned ListInitialization : 1;
979 LLVM_PREFERRED_TYPE(
bool)
980 unsigned StdInitListInitialization : 1;
981 LLVM_PREFERRED_TYPE(
bool)
982 unsigned ZeroInitialization : 1;
984 unsigned ConstructionKind : 3;
985 LLVM_PREFERRED_TYPE(
bool)
986 unsigned IsImmediateEscalating : 1;
999 LLVM_PREFERRED_TYPE(
bool)
1000 unsigned CleanupsHaveSideEffects : 1;
1025 LLVM_PREFERRED_TYPE(
bool)
1026 unsigned IsArrow : 1;
1030 LLVM_PREFERRED_TYPE(
bool)
1031 unsigned HasTemplateKWAndArgsInfo : 1;
1035 LLVM_PREFERRED_TYPE(
bool)
1036 unsigned HasFirstQualifierFoundInScope : 1;
1051 LLVM_PREFERRED_TYPE(
bool)
1052 unsigned HasTemplateKWAndArgsInfo : 1;
1060 unsigned NumResults;
1073 LLVM_PREFERRED_TYPE(
bool)
1074 unsigned RequiresADL : 1;
1077 "UnresolvedLookupExprBitfields must be <= than 4 bytes to"
1078 "avoid trashing OverloadExprBitfields::NumResults!");
1089 LLVM_PREFERRED_TYPE(
bool)
1090 unsigned IsArrow : 1;
1093 LLVM_PREFERRED_TYPE(
bool)
1094 unsigned HasUnresolvedUsing : 1;
1097 "UnresolvedMemberExprBitfields must be <= than 4 bytes to"
1098 "avoid trashing OverloadExprBitfields::NumResults!");
1107 LLVM_PREFERRED_TYPE(
bool)
1133 unsigned CaptureDefault : 2;
1137 LLVM_PREFERRED_TYPE(
bool)
1138 unsigned ExplicitParams : 1;
1141 LLVM_PREFERRED_TYPE(
bool)
1142 unsigned ExplicitResultType : 1;
1145 unsigned NumCaptures : 16;
1156 LLVM_PREFERRED_TYPE(
bool)
1157 unsigned IsSatisfied : 1;
1169 LLVM_PREFERRED_TYPE(
bool)
1170 unsigned IsImplicit : 1;
1181 LLVM_PREFERRED_TYPE(
bool)
1182 unsigned ShouldCopy : 1;
1196 LLVM_PREFERRED_TYPE(
bool)
1197 unsigned IsUnique : 1;
1285 unsigned alignment = 8);
1288 unsigned alignment = 8) {
1289 return operator new(
bytes, *
C, alignment);
1292 void *
operator new(
size_t bytes,
void *mem)
noexcept {
return mem; }
1296 void operator delete(
void *,
size_t)
noexcept {}
1297 void operator delete(
void *,
void *)
noexcept {}
1318 template<
typename T,
typename TPtr = T *,
typename StmtPtr = Stmt *>
1320 : llvm::iterator_adaptor_base<CastIterator<T, TPtr, StmtPtr>, StmtPtr *,
1321 std::random_access_iterator_tag, TPtr> {
1322 using Base =
typename CastIterator::iterator_adaptor_base;
1328 return cast_or_null<T>(*this->I);
1333 template <
typename T>
1341 static bool StatisticsEnabled;
1355 static_assert(
sizeof(*this) <= 8,
1356 "changing bitfields changed sizeof(Stmt)");
1357 static_assert(
sizeof(*this) %
alignof(
void *) == 0,
1358 "Insufficient alignment!");
1398 static
std::tuple<
bool, const
Attr *, const
Attr *>
1417 StringRef NewlineSymbol = "\n",
1421 unsigned Indentation = 0,
1422 StringRef NewlineSymbol = "\n",
1442 return const_cast<Stmt*
>(
1486 bool Canonical,
bool ProfileLambdaExpr =
false)
const;
1508 :
Stmt(DeclStmtClass), DG(dg), StartLoc(startLoc), EndLoc(endLoc) {}
1531 return T->getStmtClass() == DeclStmtClass;
1577 :
Stmt(NullStmtClass) {
1596 return T->getStmtClass() == NullStmtClass;
1611 private llvm::TrailingObjects<CompoundStmt, Stmt *, FPOptionsOverride> {
1613 friend TrailingObjects;
1630 *getTrailingObjects<FPOptionsOverride>() = F;
1633 size_t numTrailingObjects(OverloadToken<Stmt *>)
const {
1638 static CompoundStmt *
Create(
const ASTContext &
C, ArrayRef<Stmt *> Stmts,
1639 FPOptionsOverride FPFeatures, SourceLocation LB,
1646 :
Stmt(CompoundStmtClass), LBraceLoc(
Loc), RBraceLoc(EndLoc) {
1653 bool HasFPFeatures);
1663 return *getTrailingObjects<FPOptionsOverride>();
1691 return getTrailingObjects<Stmt *>();
1715 std::reverse_iterator<const_body_iterator>;
1734 for (
auto *B : llvm::reverse(
body())) {
1735 if (!isa<NullStmt>(B))
1752 return T->getStmtClass() == CompoundStmtClass;
1802 return T->getStmtClass() == CaseStmtClass ||
1803 T->getStmtClass() == DefaultStmtClass;
1811 private llvm::TrailingObjects<CaseStmt, Stmt *, SourceLocation> {
1812 friend TrailingObjects;
1829 enum { LhsOffset = 0, SubStmtOffsetFromRhs = 1 };
1830 enum { NumMandatoryStmtPtr = 2 };
1832 unsigned numTrailingObjects(OverloadToken<Stmt *>)
const {
1836 unsigned numTrailingObjects(OverloadToken<SourceLocation>)
const {
1840 unsigned lhsOffset()
const {
return LhsOffset; }
1842 unsigned subStmtOffset()
const {
return rhsOffset() + SubStmtOffsetFromRhs; }
1848 :
SwitchCase(CaseStmtClass, caseLoc, colonLoc) {
1850 bool IsGNURange = rhs !=
nullptr;
1894 "setEllipsisLoc but this is not a case stmt of the form LHS ... RHS!");
1895 *getTrailingObjects<SourceLocation>() = L;
1899 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[lhsOffset()]);
1903 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[lhsOffset()]);
1907 getTrailingObjects<Stmt *>()[lhsOffset()] =
reinterpret_cast<Stmt *
>(Val);
1912 getTrailingObjects<Stmt *>()[rhsOffset()])
1918 getTrailingObjects<Stmt *>()[rhsOffset()])
1924 "setRHS but this is not a case stmt of the form LHS ... RHS!");
1925 getTrailingObjects<Stmt *>()[rhsOffset()] =
reinterpret_cast<Stmt *
>(Val);
1930 return getTrailingObjects<Stmt *>()[subStmtOffset()];
1934 getTrailingObjects<Stmt *>()[subStmtOffset()] = S;
1941 while (
const auto *CS2 = dyn_cast<CaseStmt>(CS->
getSubStmt()))
1948 return T->getStmtClass() == CaseStmtClass;
1954 getTrailingObjects<Stmt *>() +
1955 numTrailingObjects(OverloadToken<Stmt *>()));
1960 getTrailingObjects<Stmt *>() +
1961 numTrailingObjects(OverloadToken<Stmt *>()));
1970 :
SwitchCase(DefaultStmtClass, DL, CL), SubStmt(substmt) {}
1989 return T->getStmtClass() == DefaultStmtClass;
2001 if (
const auto *CS = dyn_cast<CaseStmt>(
this))
2002 return CS->getEndLoc();
2003 else if (
const auto *DS = dyn_cast<DefaultStmt>(
this))
2004 return DS->getEndLoc();
2005 llvm_unreachable(
"SwitchCase is neither a CaseStmt nor a DefaultStmt!");
2009 if (
auto *CS = dyn_cast<CaseStmt>(
this))
2010 return CS->getSubStmt();
2011 else if (
auto *DS = dyn_cast<DefaultStmt>(
this))
2012 return DS->getSubStmt();
2013 llvm_unreachable(
"SwitchCase is neither a CaseStmt nor a DefaultStmt!");
2034 return T->getStmtClass() >= firstValueStmtConstant &&
2035 T->getStmtClass() <= lastValueStmtConstant;
2044 bool SideEntry =
false;
2049 :
ValueStmt(LabelStmtClass), TheDecl(
D), SubStmt(substmt) {
2078 return T->getStmtClass() == LabelStmtClass;
2090 private llvm::TrailingObjects<AttributedStmt, const Attr *> {
2092 friend TrailingObjects;
2098 :
ValueStmt(AttributedStmtClass), SubStmt(SubStmt) {
2101 std::copy(Attrs.begin(), Attrs.end(), getAttrArrayPtr());
2108 std::fill_n(getAttrArrayPtr(), NumAttrs,
nullptr);
2111 const Attr *
const *getAttrArrayPtr()
const {
2112 return getTrailingObjects<const Attr *>();
2114 const Attr **getAttrArrayPtr() {
return getTrailingObjects<const Attr *>(); }
2117 static AttributedStmt *
Create(
const ASTContext &
C, SourceLocation
Loc,
2118 ArrayRef<const Attr *> Attrs,
Stmt *SubStmt);
2121 static AttributedStmt *
CreateEmpty(
const ASTContext &
C,
unsigned NumAttrs);
2141 return T->getStmtClass() == AttributedStmtClass;
2148 private llvm::TrailingObjects<IfStmt, Stmt *, SourceLocation> {
2149 friend TrailingObjects;
2173 enum { InitOffset = 0, ThenOffsetFromCond = 1, ElseOffsetFromCond = 2 };
2174 enum { NumMandatoryStmtPtr = 2 };
2178 unsigned numTrailingObjects(OverloadToken<Stmt *>)
const {
2183 unsigned numTrailingObjects(OverloadToken<SourceLocation>)
const {
2187 unsigned initOffset()
const {
return InitOffset; }
2188 unsigned varOffset()
const {
return InitOffset +
hasInitStorage(); }
2189 unsigned condOffset()
const {
2192 unsigned thenOffset()
const {
return condOffset() + ThenOffsetFromCond; }
2193 unsigned elseOffset()
const {
return condOffset() + ElseOffsetFromCond; }
2209 Stmt *Else =
nullptr);
2226 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[condOffset()]);
2230 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[condOffset()]);
2234 getTrailingObjects<Stmt *>()[condOffset()] =
reinterpret_cast<Stmt *
>(Cond);
2237 Stmt *
getThen() {
return getTrailingObjects<Stmt *>()[thenOffset()]; }
2239 return getTrailingObjects<Stmt *>()[thenOffset()];
2243 getTrailingObjects<Stmt *>()[thenOffset()] = Then;
2247 return hasElseStorage() ? getTrailingObjects<Stmt *>()[elseOffset()]
2252 return hasElseStorage() ? getTrailingObjects<Stmt *>()[elseOffset()]
2258 "This if statement has no storage for an else statement!");
2259 getTrailingObjects<Stmt *>()[elseOffset()] = Else;
2283 getTrailingObjects<Stmt *>()[varOffset()])
2289 getTrailingObjects<Stmt *>()[varOffset()])
2295 getTrailingObjects<Stmt *>()[varOffset()] = CondVar;
2299 return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
2304 return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
2310 "This if statement has no storage for an init statement!");
2311 getTrailingObjects<Stmt *>()[initOffset()] =
Init;
2324 "This if statement has no storage for an else statement!");
2325 *getTrailingObjects<SourceLocation>() = ElseLoc;
2378 getTrailingObjects<Stmt *>() +
2379 numTrailingObjects(OverloadToken<Stmt *>()));
2387 getTrailingObjects<Stmt *>() +
2388 numTrailingObjects(OverloadToken<Stmt *>()));
2392 return T->getStmtClass() == IfStmtClass;
2398 private llvm::TrailingObjects<SwitchStmt, Stmt *> {
2399 friend TrailingObjects;
2421 enum { InitOffset = 0, BodyOffsetFromCond = 1 };
2422 enum { NumMandatoryStmtPtr = 2 };
2426 unsigned numTrailingObjects(OverloadToken<Stmt *>)
const {
2430 unsigned initOffset()
const {
return InitOffset; }
2431 unsigned varOffset()
const {
return InitOffset +
hasInitStorage(); }
2432 unsigned condOffset()
const {
2435 unsigned bodyOffset()
const {
return condOffset() + BodyOffsetFromCond; }
2462 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[condOffset()]);
2466 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[condOffset()]);
2470 getTrailingObjects<Stmt *>()[condOffset()] =
reinterpret_cast<Stmt *
>(Cond);
2473 Stmt *
getBody() {
return getTrailingObjects<Stmt *>()[bodyOffset()]; }
2475 return getTrailingObjects<Stmt *>()[bodyOffset()];
2479 getTrailingObjects<Stmt *>()[bodyOffset()] = Body;
2483 return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
2488 return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
2494 "This switch statement has no storage for an init statement!");
2495 getTrailingObjects<Stmt *>()[initOffset()] =
Init;
2520 getTrailingObjects<Stmt *>()[varOffset()])
2526 getTrailingObjects<Stmt *>()[varOffset()])
2532 getTrailingObjects<Stmt *>()[varOffset()] = CondVar;
2553 "case/default already added to a switch");
2577 getTrailingObjects<Stmt *>() +
2578 numTrailingObjects(OverloadToken<Stmt *>()));
2583 getTrailingObjects<Stmt *>() +
2584 numTrailingObjects(OverloadToken<Stmt *>()));
2588 return T->getStmtClass() == SwitchStmtClass;
2594 private llvm::TrailingObjects<WhileStmt, Stmt *> {
2595 friend TrailingObjects;
2612 enum { VarOffset = 0, BodyOffsetFromCond = 1 };
2613 enum { NumMandatoryStmtPtr = 2 };
2617 unsigned varOffset()
const {
return VarOffset; }
2618 unsigned condOffset()
const {
return VarOffset +
hasVarStorage(); }
2619 unsigned bodyOffset()
const {
return condOffset() + BodyOffsetFromCond; }
2621 unsigned numTrailingObjects(OverloadToken<Stmt *>)
const {
2647 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[condOffset()]);
2651 return reinterpret_cast<Expr *
>(getTrailingObjects<Stmt *>()[condOffset()]);
2655 getTrailingObjects<Stmt *>()[condOffset()] =
reinterpret_cast<Stmt *
>(Cond);
2658 Stmt *
getBody() {
return getTrailingObjects<Stmt *>()[bodyOffset()]; }
2660 return getTrailingObjects<Stmt *>()[bodyOffset()];
2664 getTrailingObjects<Stmt *>()[bodyOffset()] = Body;
2688 getTrailingObjects<Stmt *>()[varOffset()])
2694 getTrailingObjects<Stmt *>()[varOffset()])
2700 getTrailingObjects<Stmt *>()[varOffset()] = CondVar;
2717 return T->getStmtClass() == WhileStmtClass;
2723 getTrailingObjects<Stmt *>() +
2724 numTrailingObjects(OverloadToken<Stmt *>()));
2729 getTrailingObjects<Stmt *>() +
2730 numTrailingObjects(OverloadToken<Stmt *>()));
2736 enum { BODY, COND, END_EXPR };
2737 Stmt *SubExprs[END_EXPR];
2744 :
Stmt(DoStmtClass), WhileLoc(WL), RParenLoc(RP) {
2755 return reinterpret_cast<Expr *
>(SubExprs[COND]);
2775 return T->getStmtClass() == DoStmtClass;
2780 return child_range(&SubExprs[0], &SubExprs[0] + END_EXPR);
2794 enum { INIT, CONDVAR, COND, INC, BODY, END_EXPR };
2795 Stmt* SubExprs[END_EXPR];
2822 return reinterpret_cast<DeclStmt*
>(SubExprs[CONDVAR]);
2826 return reinterpret_cast<DeclStmt*
>(SubExprs[CONDVAR]);
2830 SubExprs[CONDVAR] = CondVar;
2858 return T->getStmtClass() == ForStmtClass;
2863 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
2878 :
Stmt(GotoStmtClass),
Label(label), LabelLoc(LL) {
2897 return T->getStmtClass() == GotoStmtClass;
2917 :
Stmt(IndirectGotoStmtClass), StarLoc(starLoc) {
2933 return reinterpret_cast<const Expr *
>(
Target);
2948 return T->getStmtClass() == IndirectGotoStmtClass;
2976 return T->getStmtClass() == ContinueStmtClass;
3006 return T->getStmtClass() == BreakStmtClass;
3029 private llvm::TrailingObjects<ReturnStmt, const VarDecl *> {
3030 friend TrailingObjects;
3039 bool hasNRVOCandidate()
const {
return ReturnStmtBits.HasNRVOCandidate; }
3041 unsigned numTrailingObjects(OverloadToken<const VarDecl *>)
const {
3042 return hasNRVOCandidate();
3054 const VarDecl *NRVOCandidate);
3070 return hasNRVOCandidate() ? *getTrailingObjects<const VarDecl *>()
3078 assert(hasNRVOCandidate() &&
3079 "This return statement has no storage for an NRVO candidate!");
3080 *getTrailingObjects<const VarDecl *>() = Var;
3092 return T->getStmtClass() == ReturnStmtClass;
3131 unsigned numoutputs,
unsigned numinputs,
unsigned numclobbers)
3195 return T->getStmtClass() == GCCAsmStmtClass ||
3196 T->getStmtClass() == MSAsmStmtClass;
3279 unsigned NumLabels = 0;
3283 bool isvolatile,
unsigned numoutputs,
unsigned numinputs,
3323 : MyKind(
Operand), Str(S), OperandNo(OpNo),
3337 assert(
isOperand() &&
"Range is currently used only for Operands.");
3363 return II->getName();
3371 return Constraints[i];
3374 return Constraints[i];
3391 return II->getName();
3415 return NumLabels > 0;
3458 void setOutputsAndInputsAndClobbers(
const ASTContext &
C,
3487 return T->getStmtClass() == GCCAsmStmtClass;
3498 unsigned NumAsmToks = 0;
3500 Token *AsmToks =
nullptr;
3501 StringRef *Constraints =
nullptr;
3502 StringRef *Clobbers =
nullptr;
3535 return Constraints[i];
3576 void initialize(
const ASTContext &
C, StringRef AsmString,
3584 return T->getStmtClass() == MSAsmStmtClass;
3603 enum { FILTER_EXPR,
BLOCK };
3609 static SEHExceptStmt*
Create(
const ASTContext &
C,
3610 SourceLocation ExceptLoc,
3620 return reinterpret_cast<Expr*
>(Children[FILTER_EXPR]);
3624 return cast<CompoundStmt>(Children[
BLOCK]);
3636 return T->getStmtClass() == SEHExceptStmtClass;
3671 return T->getStmtClass() == SEHFinallyStmtClass;
3683 enum { TRY = 0, HANDLER = 1 };
3693 static SEHTryStmt*
Create(
const ASTContext &
C,
bool isCXXTry,
3694 SourceLocation TryLoc,
Stmt *TryBlock,
3705 return cast<CompoundStmt>(Children[TRY]);
3723 return T->getStmtClass() == SEHTryStmtClass;
3733 :
Stmt(SEHLeaveStmtClass), LeaveLoc(LL) {}
3745 return T->getStmtClass() == SEHLeaveStmtClass;
3781 llvm::PointerIntPair<VarDecl *, 2, VariableCaptureKind> VarAndKind;
3832 unsigned NumCaptures;
3836 llvm::PointerIntPair<CapturedDecl *, 2, CapturedRegionKind> CapDeclAndKind;
3848 Stmt **getStoredStmts() {
return reinterpret_cast<Stmt **
>(
this + 1); }
3850 Stmt *
const *getStoredStmts()
const {
3851 return reinterpret_cast<Stmt *
const *
>(
this + 1);
3854 Capture *getStoredCaptures()
const;
3856 void setCapturedStmt(
Stmt *S) { getStoredStmts()[NumCaptures] = S; }
3868 unsigned NumCaptures);
3892 assert(
D &&
"null RecordDecl");
3919 return getStoredCaptures() + NumCaptures;
3933 llvm::iterator_range<const_capture_init_iterator>;
3945 return reinterpret_cast<Expr **
>(getStoredStmts());
3949 return reinterpret_cast<Expr *
const *
>(getStoredStmts());
3975 return T->getStmtClass() == CapturedStmtClass;
static StringRef bytes(const std::vector< T, Allocator > &v)
enum clang::sema::@1653::IndirectLocalPathEntry::EntryKind Kind
const LambdaCapture * Capture
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines several types used to describe C++ lambda expressions that are shared between the parser and ...
Defines the clang::LangOptions interface.
llvm::MachO::Target Target
Defines an enumeration for C++ overloaded operators.
Defines the clang::SourceLocation class and associated facilities.
Defines various enumerations that describe declaration and type specifiers.
#define BLOCK(DERIVED, BASE)
Defines enumerations for the type traits support.
__device__ __2f16 float __ockl_bool s
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Reads an AST files chain containing the contents of a translation unit.
AddrLabelExpr - The GNU address of label extension, representing &&label.
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
outputs_iterator begin_outputs()
void setAsmLoc(SourceLocation L)
const_outputs_iterator end_outputs() const
outputs_iterator end_outputs()
const_inputs_iterator begin_inputs() const
unsigned getNumPlusOperands() const
getNumPlusOperands - Return the number of output operands that have a "+" constraint.
AsmStmt(StmtClass SC, SourceLocation asmloc, bool issimple, bool isvolatile, unsigned numoutputs, unsigned numinputs, unsigned numclobbers)
static bool classof(const Stmt *T)
StringRef getOutputConstraint(unsigned i) const
getOutputConstraint - Return the constraint string for the specified output operand.
inputs_const_range inputs() const
SourceLocation getAsmLoc() const
const Expr * getInputExpr(unsigned i) const
SourceLocation getEndLoc() const LLVM_READONLY
llvm::iterator_range< inputs_iterator > inputs_range
bool isOutputPlusConstraint(unsigned i) const
isOutputPlusConstraint - Return true if the specified output constraint is a "+" constraint (which is...
unsigned getNumClobbers() const
const_inputs_iterator end_inputs() const
llvm::iterator_range< const_inputs_iterator > inputs_const_range
const_child_range children() const
bool IsSimple
True if the assembly statement does not have any input or output operands.
const Expr * getOutputExpr(unsigned i) const
StringRef getInputConstraint(unsigned i) const
getInputConstraint - Return the specified input constraint.
outputs_const_range outputs() const
inputs_iterator end_inputs()
unsigned getNumOutputs() const
SourceLocation getBeginLoc() const LLVM_READONLY
inputs_iterator begin_inputs()
AsmStmt(StmtClass SC, EmptyShell Empty)
Build an empty inline-assembly statement.
std::string generateAsmString(const ASTContext &C) const
Assemble final IR asm string.
bool IsVolatile
If true, treat this inline assembly as having side effects.
unsigned getNumInputs() const
llvm::iterator_range< outputs_iterator > outputs_range
StringRef getClobber(unsigned i) const
const_outputs_iterator begin_outputs() const
llvm::iterator_range< const_outputs_iterator > outputs_const_range
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Attr - This represents one attribute.
Represents an attribute applied to a statement.
static AttributedStmt * CreateEmpty(const ASTContext &C, unsigned NumAttrs)
const Stmt * getSubStmt() const
SourceLocation getAttrLoc() const
ArrayRef< const Attr * > getAttrs() const
const_child_range children() const
static bool classof(const Stmt *T)
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const
A builtin binary operation expression such as "x + y" or "x <= y".
BreakStmt - This represents a break.
SourceLocation getBreakLoc() const
SourceLocation getEndLoc() const
SourceLocation getBeginLoc() const
BreakStmt(SourceLocation BL)
const_child_range children() const
static bool classof(const Stmt *T)
void setBreakLoc(SourceLocation L)
BreakStmt(EmptyShell Empty)
Build an empty break statement.
A boolean literal, per ([C++ lex.bool] Boolean literals).
Represents a call to a C++ constructor.
A default argument (C++ [dcl.fct.default]).
A use of a default initializer in a constructor or in aggregate initialization.
Represents a delete expression for memory deallocation and destructor calls, e.g.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
The null pointer literal (C++11 [lex.nullptr])
A call to an overloaded operator written using operator syntax.
A rewritten comparison expression that was originally written using operator syntax.
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type.
Represents the this expression in C++.
A C++ throw-expression (C++ [except.throw]).
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Represents the body of a CapturedStmt, and serves as its DeclContext.
Describes the capture of either a variable, or 'this', or variable-length array type.
bool capturesVariableByCopy() const
Determine whether this capture handles a variable by copy.
VariableCaptureKind getCaptureKind() const
Determine the kind of capture.
VarDecl * getCapturedVar() const
Retrieve the declaration of the variable being captured.
bool capturesVariableArrayType() const
Determine whether this capture handles a variable-length array type.
bool capturesThis() const
Determine whether this capture handles the C++ 'this' pointer.
bool capturesVariable() const
Determine whether this capture handles a variable (by reference).
SourceLocation getLocation() const
Retrieve the source location at which the variable or 'this' was first used.
This captures a statement into a function.
unsigned capture_size() const
Retrieve the number of captures, including 'this'.
const_capture_iterator capture_begin() const
static CapturedStmt * CreateDeserialized(const ASTContext &Context, unsigned NumCaptures)
SourceLocation getEndLoc() const LLVM_READONLY
capture_init_range capture_inits()
void setCapturedRegionKind(CapturedRegionKind Kind)
Set the captured region kind.
const_capture_init_iterator capture_init_begin() const
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
SourceRange getSourceRange() const LLVM_READONLY
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of captures.
const RecordDecl * getCapturedRecordDecl() const
Retrieve the record declaration for captured variables.
Stmt * getCapturedStmt()
Retrieve the statement being captured.
llvm::iterator_range< capture_init_iterator > capture_init_range
llvm::iterator_range< capture_iterator > capture_range
bool capturesVariable(const VarDecl *Var) const
True if this variable has been captured.
static bool classof(const Stmt *T)
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument.
void setCapturedDecl(CapturedDecl *D)
Set the outlined function declaration.
capture_iterator capture_begin()
Retrieve an iterator pointing to the first capture.
llvm::iterator_range< const_capture_init_iterator > const_capture_init_range
const_capture_init_iterator capture_init_end() const
SourceLocation getBeginLoc() const LLVM_READONLY
void setCapturedRecordDecl(RecordDecl *D)
Set the record declaration for captured variables.
llvm::iterator_range< const_capture_iterator > capture_const_range
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument.
Expr *const * const_capture_init_iterator
Const iterator that walks over the capture initialization arguments.
const Stmt * getCapturedStmt() const
capture_const_range captures() const
CapturedRegionKind getCapturedRegionKind() const
Retrieve the captured region kind.
VariableCaptureKind
The different capture forms: by 'this', by reference, capture for variable-length array type etc.
const_capture_init_range capture_inits() const
CaseStmt - Represent a case statement.
const Expr * getRHS() const
const_child_range children() const
SourceLocation getBeginLoc() const
void setEllipsisLoc(SourceLocation L)
Set the location of the ... in a case statement of the form LHS ... RHS.
static bool classof(const Stmt *T)
bool caseStmtIsGNURange() const
True if this case statement is of the form case LHS ... RHS, which is a GNU extension.
const Expr * getLHS() const
SourceLocation getEllipsisLoc() const
Get the location of the ... in a case statement of the form LHS ... RHS.
void setCaseLoc(SourceLocation L)
SourceLocation getCaseLoc() const
static CaseStmt * CreateEmpty(const ASTContext &Ctx, bool CaseStmtIsGNURange)
Build an empty case statement.
const Stmt * getSubStmt() const
SourceLocation getEndLoc() const LLVM_READONLY
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Represents a character-granular source range.
Represents a 'co_await' expression.
CompoundStmt - This represents a group of statements like { stmt stmt }.
static bool classof(const Stmt *T)
std::reverse_iterator< const_body_iterator > const_reverse_body_iterator
body_const_range body() const
Stmt *const * const_body_iterator
const_reverse_body_iterator body_rend() const
llvm::iterator_range< const_body_iterator > body_const_range
std::reverse_iterator< body_iterator > reverse_body_iterator
reverse_body_iterator body_rbegin()
llvm::iterator_range< body_iterator > body_range
const Stmt * getStmtExprResult() const
FPOptionsOverride getStoredFPFeatures() const
Get FPOptionsOverride from trailing storage.
const Stmt * body_front() const
SourceLocation getBeginLoc() const
static CompoundStmt * CreateEmpty(const ASTContext &C, unsigned NumStmts, bool HasFPFeatures)
SourceLocation getLBracLoc() const
body_iterator body_begin()
SourceLocation getEndLoc() const
bool hasStoredFPFeatures() const
const_child_range children() const
CompoundStmt(SourceLocation Loc, SourceLocation EndLoc)
reverse_body_iterator body_rend()
CompoundStmt(SourceLocation Loc)
const_body_iterator body_begin() const
Stmt * getStmtExprResult()
const Stmt * body_back() const
const_reverse_body_iterator body_rbegin() const
FPOptionsOverride getStoredFPFeaturesOrDefault() const
Get the store FPOptionsOverride or default if not stored.
SourceLocation getRBracLoc() const
const_body_iterator body_end() const
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
ContinueStmt - This represents a continue.
ContinueStmt(EmptyShell Empty)
Build an empty continue statement.
ContinueStmt(SourceLocation CL)
static bool classof(const Stmt *T)
void setContinueLoc(SourceLocation L)
SourceLocation getContinueLoc() const
SourceLocation getEndLoc() const
const_child_range children() const
SourceLocation getBeginLoc() const
Decl *const * const_iterator
bool isSingleDecl() const
A reference to a declared variable, function, enum, etc.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
std::reverse_iterator< decl_iterator > reverse_decl_iterator
llvm::iterator_range< decl_iterator > decl_range
const_child_range children() const
SourceLocation getEndLoc() const
const DeclGroupRef getDeclGroup() const
DeclStmt(EmptyShell Empty)
Build an empty declaration statement.
bool isSingleDecl() const
isSingleDecl - This method returns true if this DeclStmt refers to a single Decl.
const_decl_iterator decl_begin() const
void setStartLoc(SourceLocation L)
DeclGroupRef::const_iterator const_decl_iterator
static bool classof(const Stmt *T)
void setEndLoc(SourceLocation L)
decl_iterator decl_begin()
void setDeclGroup(DeclGroupRef DGR)
const Decl * getSingleDecl() const
decl_const_range decls() const
const_decl_iterator decl_end() const
SourceLocation getBeginLoc() const LLVM_READONLY
DeclGroupRef getDeclGroup()
reverse_decl_iterator decl_rend()
llvm::iterator_range< const_decl_iterator > decl_const_range
reverse_decl_iterator decl_rbegin()
DeclStmt(DeclGroupRef dg, SourceLocation startLoc, SourceLocation endLoc)
Decl - This represents one declaration (or definition), e.g.
const Stmt * getSubStmt() const
SourceLocation getEndLoc() const LLVM_READONLY
void setDefaultLoc(SourceLocation L)
SourceLocation getDefaultLoc() const
DefaultStmt(EmptyShell Empty)
Build an empty default statement.
static bool classof(const Stmt *T)
DefaultStmt(SourceLocation DL, SourceLocation CL, Stmt *substmt)
const_child_range children() const
SourceLocation getBeginLoc() const
A qualified reference to a name whose declaration cannot yet be resolved.
Represents a C99 designated initializer expression.
DoStmt - This represents a 'do/while' stmt.
void setWhileLoc(SourceLocation L)
SourceLocation getBeginLoc() const
void setDoLoc(SourceLocation L)
SourceLocation getEndLoc() const
SourceLocation getWhileLoc() const
static bool classof(const Stmt *T)
const_child_range children() const
DoStmt(EmptyShell Empty)
Build an empty do-while statement.
SourceLocation getDoLoc() const
void setRParenLoc(SourceLocation L)
SourceLocation getRParenLoc() const
const Stmt * getBody() const
DoStmt(Stmt *Body, Expr *Cond, SourceLocation DL, SourceLocation WL, SourceLocation RP)
const Expr * getCond() const
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
This represents one expression.
Represents difference between two FPOptions values.
ForStmt - This represents a 'for (init;cond;inc)' stmt.
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "for" statement, if any.
SourceLocation getEndLoc() const
SourceLocation getRParenLoc() const
const_child_range children() const
const DeclStmt * getConditionVariableDeclStmt() const
void setForLoc(SourceLocation L)
const Expr * getInc() const
ForStmt(EmptyShell Empty)
Build an empty for statement.
void setLParenLoc(SourceLocation L)
const Expr * getCond() const
void setConditionVariableDeclStmt(DeclStmt *CondVar)
SourceLocation getBeginLoc() const
static bool classof(const Stmt *T)
const Stmt * getInit() const
void setConditionVariable(const ASTContext &C, VarDecl *V)
SourceLocation getForLoc() const
const Stmt * getBody() const
SourceLocation getLParenLoc() const
DeclStmt * getConditionVariableDeclStmt()
If this ForStmt has a condition variable, return the faux DeclStmt associated with the creation of th...
void setRParenLoc(SourceLocation L)
AsmStringPiece - this is part of a decomposed asm string specification (for use with the AnalyzeAsmSt...
AsmStringPiece(const std::string &S)
const std::string & getString() const
unsigned getOperandNo() const
CharSourceRange getRange() const
AsmStringPiece(unsigned OpNo, const std::string &S, SourceLocation Begin, SourceLocation End)
char getModifier() const
getModifier - Get the modifier for this operand, if present.
This represents a GCC inline-assembly statement extension.
const Expr * getInputExpr(unsigned i) const
const_labels_iterator end_labels() const
StringLiteral * getInputConstraintLiteral(unsigned i)
unsigned getNumLabels() const
const StringLiteral * getInputConstraintLiteral(unsigned i) const
std::string generateAsmString(const ASTContext &C) const
Assemble final IR asm string.
const StringLiteral * getClobberStringLiteral(unsigned i) const
SourceLocation getRParenLoc() const
StringRef getClobber(unsigned i) const
labels_const_range labels() const
StringLiteral * getOutputConstraintLiteral(unsigned i)
llvm::iterator_range< labels_iterator > labels_range
labels_iterator begin_labels()
IdentifierInfo * getInputIdentifier(unsigned i) const
labels_iterator end_labels()
StringRef getLabelName(unsigned i) const
unsigned AnalyzeAsmString(SmallVectorImpl< AsmStringPiece > &Pieces, const ASTContext &C, unsigned &DiagOffs) const
AnalyzeAsmString - Analyze the asm string of the current asm, decomposing it into pieces.
const StringLiteral * getOutputConstraintLiteral(unsigned i) const
void setRParenLoc(SourceLocation L)
StringRef getOutputConstraint(unsigned i) const
getOutputConstraint - Return the constraint string for the specified output operand.
void setInputExpr(unsigned i, Expr *E)
const StringLiteral * getAsmString() const
void setAsmString(StringLiteral *E)
static bool classof(const Stmt *T)
StringLiteral * getClobberStringLiteral(unsigned i)
StringRef getInputName(unsigned i) const
SourceLocation getEndLoc() const LLVM_READONLY
StringRef getOutputName(unsigned i) const
const_labels_iterator begin_labels() const
GCCAsmStmt(EmptyShell Empty)
Build an empty inline-assembly statement.
IdentifierInfo * getLabelIdentifier(unsigned i) const
IdentifierInfo * getOutputIdentifier(unsigned i) const
Expr * getOutputExpr(unsigned i)
StringLiteral * getAsmString()
llvm::iterator_range< const_labels_iterator > labels_const_range
int getNamedOperand(StringRef SymbolicName) const
getNamedOperand - Given a symbolic operand reference like %[foo], translate this into a numeric value...
const Expr * getOutputExpr(unsigned i) const
SourceLocation getBeginLoc() const LLVM_READONLY
Expr * getInputExpr(unsigned i)
AddrLabelExpr * getLabelExpr(unsigned i) const
StringRef getInputConstraint(unsigned i) const
getInputConstraint - Return the specified input constraint.
Represents a C11 generic selection.
GotoStmt - This represents a direct goto.
GotoStmt(LabelDecl *label, SourceLocation GL, SourceLocation LL)
SourceLocation getLabelLoc() const
SourceLocation getGotoLoc() const
void setLabel(LabelDecl *D)
GotoStmt(EmptyShell Empty)
Build an empty goto statement.
void setLabelLoc(SourceLocation L)
LabelDecl * getLabel() const
SourceLocation getEndLoc() const
const_child_range children() const
static bool classof(const Stmt *T)
void setGotoLoc(SourceLocation L)
SourceLocation getBeginLoc() const
One of these records is kept for each identifier that is lexed.
IfStmt - This represents an if/then/else.
bool hasElseStorage() const
True if this IfStmt has storage for an else statement.
const Stmt * getElse() const
void setConditionVariableDeclStmt(DeclStmt *CondVar)
void setLParenLoc(SourceLocation Loc)
SourceLocation getIfLoc() const
void setConditionVariable(const ASTContext &Ctx, VarDecl *V)
Set the condition variable for this if statement.
bool hasVarStorage() const
True if this IfStmt has storage for a variable declaration.
const DeclStmt * getConditionVariableDeclStmt() const
IfStatementKind getStatementKind() const
SourceLocation getElseLoc() const
bool isNonNegatedConsteval() const
SourceLocation getLParenLoc() const
static bool classof(const Stmt *T)
const Stmt * getThen() const
const Expr * getCond() const
const VarDecl * getConditionVariable() const
void setElseLoc(SourceLocation ElseLoc)
const Stmt * getInit() const
static IfStmt * CreateEmpty(const ASTContext &Ctx, bool HasElse, bool HasVar, bool HasInit)
Create an empty IfStmt optionally with storage for an else statement, condition variable and init exp...
bool hasInitStorage() const
True if this IfStmt has the storage for an init statement.
void setStatementKind(IfStatementKind Kind)
std::optional< const Stmt * > getNondiscardedCase(const ASTContext &Ctx) const
If this is an 'if constexpr', determine which substatement will be taken.
bool isObjCAvailabilityCheck() const
bool isNegatedConsteval() const
DeclStmt * getConditionVariableDeclStmt()
If this IfStmt has a condition variable, return the faux DeclStmt associated with the creation of tha...
const_child_range children() const
SourceLocation getRParenLoc() const
void setRParenLoc(SourceLocation Loc)
SourceLocation getBeginLoc() const
SourceLocation getEndLoc() const LLVM_READONLY
void setIfLoc(SourceLocation IfLoc)
VarDecl * getConditionVariable()
Retrieve the variable declared in this "if" statement, if any.
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
IndirectGotoStmt - This represents an indirect goto.
SourceLocation getEndLoc() const LLVM_READONLY
static bool classof(const Stmt *T)
LabelDecl * getConstantTarget()
getConstantTarget - Returns the fixed target of this indirect goto, if one exists.
IndirectGotoStmt(SourceLocation gotoLoc, SourceLocation starLoc, Expr *target)
SourceLocation getGotoLoc() const
SourceLocation getBeginLoc() const
void setGotoLoc(SourceLocation L)
const_child_range children() const
const LabelDecl * getConstantTarget() const
void setStarLoc(SourceLocation L)
IndirectGotoStmt(EmptyShell Empty)
Build an empty indirect goto statement.
const Expr * getTarget() const
SourceLocation getStarLoc() const
Describes an C or C++ initializer list.
Represents the declaration of a label.
LabelStmt - Represents a label, which has a substatement.
LabelStmt(SourceLocation IL, LabelDecl *D, Stmt *substmt)
Build a label statement.
static bool classof(const Stmt *T)
LabelDecl * getDecl() const
LabelStmt(EmptyShell Empty)
Build an empty label statement.
SourceLocation getIdentLoc() const
void setSubStmt(Stmt *SS)
void setDecl(LabelDecl *D)
SourceLocation getBeginLoc() const
void setIdentLoc(SourceLocation L)
const_child_range children() const
SourceLocation getEndLoc() const LLVM_READONLY
void setSideEntry(bool SE)
const char * getName() const
const Stmt * getSubStmt() const
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
This represents a Microsoft inline-assembly statement extension.
const Expr * getOutputExpr(unsigned i) const
Expr * getOutputExpr(unsigned i)
ArrayRef< StringRef > getClobbers() const
SourceLocation getBeginLoc() const LLVM_READONLY
StringRef getAsmString() const
SourceLocation getLBraceLoc() const
SourceLocation getEndLoc() const
StringRef getInputConstraint(unsigned i) const
void setEndLoc(SourceLocation L)
void setInputExpr(unsigned i, Expr *E)
StringRef getOutputConstraint(unsigned i) const
ArrayRef< StringRef > getAllConstraints() const
static bool classof(const Stmt *T)
StringRef getClobber(unsigned i) const
const Expr * getInputExpr(unsigned i) const
void setLBraceLoc(SourceLocation L)
MSAsmStmt(EmptyShell Empty)
Build an empty MS-style inline-assembly statement.
std::string generateAsmString(const ASTContext &C) const
Assemble final IR asm string.
const_child_range children() const
ArrayRef< Expr * > getAllExprs() const
Expr * getInputExpr(unsigned i)
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
NullStmt - This is the null statement ";": C99 6.8.3p3.
void setSemiLoc(SourceLocation L)
bool hasLeadingEmptyMacro() const
SourceLocation getBeginLoc() const
SourceLocation getSemiLoc() const
static bool classof(const Stmt *T)
NullStmt(SourceLocation L, bool hasLeadingEmptyMacro=false)
NullStmt(EmptyShell Empty)
Build an empty null statement.
const_child_range children() const
SourceLocation getEndLoc() const
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
An expression that sends a message to the given Objective-C object or class.
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type,...
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
[C99 6.4.2.2] - A predefined identifier such as func.
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Represents a struct/union/class.
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
void setRetValue(Expr *E)
void setReturnLoc(SourceLocation L)
SourceLocation getReturnLoc() const
static bool classof(const Stmt *T)
SourceLocation getEndLoc() const LLVM_READONLY
void setNRVOCandidate(const VarDecl *Var)
Set the variable that might be used for the named return value optimization.
SourceLocation getBeginLoc() const
const VarDecl * getNRVOCandidate() const
Retrieve the variable that might be used for the named return value optimization.
const_child_range children() const
static ReturnStmt * CreateEmpty(const ASTContext &Ctx, bool HasNRVOCandidate)
Create an empty return statement, optionally with storage for an NRVO candidate.
const Expr * getRetValue() const
const_child_range children() const
CompoundStmt * getBlock() const
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getExceptLoc() const
SourceLocation getEndLoc() const
static bool classof(const Stmt *T)
Expr * getFilterExpr() const
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getEndLoc() const
const_child_range children() const
SourceLocation getFinallyLoc() const
static bool classof(const Stmt *T)
CompoundStmt * getBlock() const
Represents a __leave statement.
SourceLocation getLeaveLoc() const
SourceLocation getEndLoc() const LLVM_READONLY
SEHLeaveStmt(EmptyShell Empty)
Build an empty __leave statement.
SEHLeaveStmt(SourceLocation LL)
SourceLocation getBeginLoc() const LLVM_READONLY
static bool classof(const Stmt *T)
void setLeaveLoc(SourceLocation L)
const_child_range children() const
const_child_range children() const
CompoundStmt * getTryBlock() const
static bool classof(const Stmt *T)
SourceLocation getTryLoc() const
SEHFinallyStmt * getFinallyHandler() const
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getEndLoc() const
SEHExceptStmt * getExceptHandler() const
Returns 0 if not defined.
Stmt * getHandler() const
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
friend class BlockDeclRefExpr
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
void ProcessODRHash(llvm::FoldingSetNodeID &ID, ODRHash &Hash) const
Calculate a unique representation for a statement that is stable across compiler invocations.
Stmt(const Stmt &)=delete
UnaryExprOrTypeTraitExprBitfields UnaryExprOrTypeTraitExprBits
CXXUnresolvedConstructExprBitfields CXXUnresolvedConstructExprBits
WhileStmtBitfields WhileStmtBits
SwitchCaseBitfields SwitchCaseBits
GenericSelectionExprBitfields GenericSelectionExprBits
InitListExprBitfields InitListExprBits
static void EnableStatistics()
LambdaExprBitfields LambdaExprBits
AttributedStmtBitfields AttributedStmtBits
ParenListExprBitfields ParenListExprBits
ArrayOrMatrixSubscriptExprBitfields ArrayOrMatrixSubscriptExprBits
UnresolvedLookupExprBitfields UnresolvedLookupExprBits
SwitchStmtBitfields SwitchStmtBits
SubstNonTypeTemplateParmExprBitfields SubstNonTypeTemplateParmExprBits
CXXNoexceptExprBitfields CXXNoexceptExprBits
StmtIterator child_iterator
Child Iterators: All subclasses must implement 'children' to permit easy iteration over the substatem...
CXXRewrittenBinaryOperatorBitfields CXXRewrittenBinaryOperatorBits
ContinueStmtBitfields ContinueStmtBits
CallExprBitfields CallExprBits
Stmt * stripLabelLikeStatements()
void printPretty(raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0, StringRef NewlineSymbol="\n", const ASTContext *Context=nullptr) const
const Stmt * stripLabelLikeStatements() const
Strip off all label-like statements.
ExprWithCleanupsBitfields ExprWithCleanupsBits
FloatingLiteralBitfields FloatingLiteralBits
const_child_range children() const
child_iterator child_begin()
void printJson(raw_ostream &Out, PrinterHelper *Helper, const PrintingPolicy &Policy, bool AddQuotes) const
Pretty-prints in JSON format.
StmtClass getStmtClass() const
CXXScalarValueInitExprBitfields CXXScalarValueInitExprBits
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
CharacterLiteralBitfields CharacterLiteralBits
OverloadExprBitfields OverloadExprBits
CXXConstructExprBitfields CXXConstructExprBits
void printPrettyControlled(raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0, StringRef NewlineSymbol="\n", const ASTContext *Context=nullptr) const
UnaryOperatorBitfields UnaryOperatorBits
static std::tuple< bool, const Attr *, const Attr * > determineLikelihoodConflict(const Stmt *Then, const Stmt *Else)
CXXDependentScopeMemberExprBitfields CXXDependentScopeMemberExprBits
GotoStmtBitfields GotoStmtBits
child_iterator child_end()
ConstCastIterator< Expr > ConstExprIterator
TypeTraitExprBitfields TypeTraitExprBits
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical, bool ProfileLambdaExpr=false) const
Produce a unique representation of the given statement.
CXXNewExprBitfields CXXNewExprBits
SourceLocExprBitfields SourceLocExprBits
CXXNullPtrLiteralExprBitfields CXXNullPtrLiteralExprBits
CoawaitExprBitfields CoawaitBits
Stmt(StmtClass SC, EmptyShell)
Construct an empty statement.
ConstantExprBitfields ConstantExprBits
llvm::iterator_range< child_iterator > child_range
void dump() const
Dumps the specified AST fragment and all subtrees to llvm::errs().
CompoundStmtBitfields CompoundStmtBits
RequiresExprBitfields RequiresExprBits
StmtExprBitfields StmtExprBits
StringLiteralBitfields StringLiteralBits
OpaqueValueExprBitfields OpaqueValueExprBits
CastExprBitfields CastExprBits
Likelihood
The likelihood of a branch being taken.
@ LH_Unlikely
Branch has the [[unlikely]] attribute.
@ LH_None
No attribute set or branches of the IfStmt have the same attribute.
@ LH_Likely
Branch has the [[likely]] attribute.
CXXThrowExprBitfields CXXThrowExprBits
static void addStmtClass(const StmtClass s)
MemberExprBitfields MemberExprBits
ForStmtBitfields ForStmtBits
DeclRefExprBitfields DeclRefExprBits
const_child_iterator child_end() const
const char * getStmtClassName() const
ConstStmtIterator const_child_iterator
void dumpPretty(const ASTContext &Context) const
dumpPretty/printPretty - These two methods do a "pretty print" of the AST back to its original source...
CXXBoolLiteralExprBitfields CXXBoolLiteralExprBits
CXXOperatorCallExprBitfields CXXOperatorCallExprBits
CXXDefaultInitExprBitfields CXXDefaultInitExprBits
Stmt & operator=(const Stmt &)=delete
NullStmtBitfields NullStmtBits
static const Attr * getLikelihoodAttr(const Stmt *S)
Stmt * IgnoreContainers(bool IgnoreCaptured=false)
Skip no-op (attributed, compound) container stmts and skip captured stmt at the top,...
DependentScopeDeclRefExprBitfields DependentScopeDeclRefExprBits
IfStmtBitfields IfStmtBits
Stmt & operator=(Stmt &&)=delete
PredefinedExprBitfields PredefinedExprBits
int64_t getID(const ASTContext &Context) const
ReturnStmtBitfields ReturnStmtBits
LabelStmtBitfields LabelStmtBits
ObjCIndirectCopyRestoreExprBitfields ObjCIndirectCopyRestoreExprBits
SourceLocation getBeginLoc() const LLVM_READONLY
void dumpColor() const
dumpColor - same as dump(), but forces color highlighting.
BinaryOperatorBitfields BinaryOperatorBits
UnresolvedMemberExprBitfields UnresolvedMemberExprBits
PseudoObjectExprBitfields PseudoObjectExprBits
BreakStmtBitfields BreakStmtBits
void viewAST() const
viewAST - Visualize an AST rooted at this Stmt* using GraphViz.
llvm::iterator_range< const_child_iterator > const_child_range
const_child_iterator child_begin() const
CXXDeleteExprBitfields CXXDeleteExprBits
CXXDefaultArgExprBitfields CXXDefaultArgExprBits
DoStmtBitfields DoStmtBits
CXXThisExprBitfields CXXThisExprBits
CastIterator< Expr > ExprIterator
static Likelihood getLikelihood(ArrayRef< const Attr * > Attrs)
StringLiteral - This represents a string literal expression, e.g.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
SwitchCase * NextSwitchCase
A pointer to the following CaseStmt or DefaultStmt class, used by SwitchStmt.
void setColonLoc(SourceLocation L)
static bool classof(const Stmt *T)
SwitchCase(StmtClass SC, EmptyShell)
SourceLocation getKeywordLoc() const
SwitchCase(StmtClass SC, SourceLocation KWLoc, SourceLocation ColonLoc)
void setKeywordLoc(SourceLocation L)
const Stmt * getSubStmt() const
void setNextSwitchCase(SwitchCase *SC)
SourceLocation getColonLoc() const
SourceLocation getBeginLoc() const
const SwitchCase * getNextSwitchCase() const
SourceLocation ColonLoc
The location of the ":".
SourceLocation getEndLoc() const LLVM_READONLY
SwitchCase * getNextSwitchCase()
SwitchStmt - This represents a 'switch' stmt.
const Stmt * getInit() const
SourceLocation getSwitchLoc() const
void addSwitchCase(SwitchCase *SC)
void setBody(Stmt *S, SourceLocation SL)
SourceLocation getLParenLoc() const
const Expr * getCond() const
bool isAllEnumCasesCovered() const
Returns true if the SwitchStmt is a switch of an enum value and all cases have been explicitly covere...
void setSwitchLoc(SourceLocation L)
void setConditionVariableDeclStmt(DeclStmt *CondVar)
void setRParenLoc(SourceLocation Loc)
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getRParenLoc() const
void setConditionVariable(const ASTContext &Ctx, VarDecl *VD)
Set the condition variable in this switch statement.
void setLParenLoc(SourceLocation Loc)
const Stmt * getBody() const
const VarDecl * getConditionVariable() const
static SwitchStmt * CreateEmpty(const ASTContext &Ctx, bool HasInit, bool HasVar)
Create an empty switch statement optionally with storage for an init expression and a condition varia...
const DeclStmt * getConditionVariableDeclStmt() const
bool hasVarStorage() const
True if this SwitchStmt has storage for a condition variable.
const_child_range children() const
VarDecl * getConditionVariable()
Retrieve the variable declared in this "switch" statement, if any.
SourceLocation getBeginLoc() const
bool hasInitStorage() const
True if this SwitchStmt has storage for an init statement.
SwitchCase * getSwitchCaseList()
const SwitchCase * getSwitchCaseList() const
DeclStmt * getConditionVariableDeclStmt()
If this SwitchStmt has a condition variable, return the faux DeclStmt associated with the creation of...
void setAllEnumCasesCovered()
Set a flag in the SwitchStmt indicating that if the 'switch (X)' is a switch over an enum value then ...
void setSwitchCaseList(SwitchCase *SC)
static bool classof(const Stmt *T)
Token - This structure provides full information about a lexed token.
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
Represents a statement that could possibly have a value and type.
const Expr * getExprStmt() const
static bool classof(const Stmt *T)
Represents a variable declaration or definition.
WhileStmt - This represents a 'while' stmt.
SourceLocation getWhileLoc() const
SourceLocation getRParenLoc() const
DeclStmt * getConditionVariableDeclStmt()
If this WhileStmt has a condition variable, return the faux DeclStmt associated with the creation of ...
void setLParenLoc(SourceLocation L)
VarDecl * getConditionVariable()
Retrieve the variable declared in this "while" statement, if any.
SourceLocation getEndLoc() const LLVM_READONLY
void setConditionVariable(const ASTContext &Ctx, VarDecl *V)
Set the condition variable of this while statement.
bool hasVarStorage() const
True if this WhileStmt has storage for a condition variable.
SourceLocation getLParenLoc() const
SourceLocation getBeginLoc() const
const Stmt * getBody() const
void setRParenLoc(SourceLocation L)
const VarDecl * getConditionVariable() const
void setWhileLoc(SourceLocation L)
const Expr * getCond() const
static WhileStmt * CreateEmpty(const ASTContext &Ctx, bool HasVar)
Create an empty while statement optionally with storage for a condition variable.
const DeclStmt * getConditionVariableDeclStmt() const
void setConditionVariableDeclStmt(DeclStmt *CondVar)
static bool classof(const Stmt *T)
const_child_range children() const
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
The JSON file list parser is used to communicate input to InstallAPI.
@ Create
'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
ConstantResultStorageKind
Describes the kind of result that can be tail-allocated.
IfStatementKind
In an if statement, this denotes whether the statement is a constexpr or consteval if statement.
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
CapturedRegionKind
The different kinds of captured statement.
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
CastKind
CastKind - The kind of operation required for a conversion.
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
const FunctionProtoType * T
TypeTrait
Names for traits that operate specifically on types.
CXXNewInitializationStyle
NonOdrUseReason
The reason why a DeclRefExpr does not constitute an odr-use.
Diagnostic wrappers for TextAPI types for error reporting.
Describes how types, statements, expressions, and declarations should be printed.
Iterator for iterating over Stmt * arrays that contain only T *.
Base::value_type operator*() const
A placeholder type used to construct an empty shell of a type, that will be filled in later (e....