14 #ifndef LLVM_CLANG_AST_STMT_H 15 #define LLVM_CLANG_AST_STMT_H 23 #include "llvm/ADT/ArrayRef.h" 24 #include "llvm/ADT/PointerIntPair.h" 25 #include "llvm/ADT/StringRef.h" 26 #include "llvm/ADT/iterator.h" 27 #include "llvm/ADT/iterator_range.h" 28 #include "llvm/Support/Casting.h" 29 #include "llvm/Support/Compiler.h" 30 #include "llvm/Support/ErrorHandling.h" 39 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'.");
98 enum { NumStmtBits = 8 };
103 unsigned : NumStmtBits;
105 unsigned NumStmts : 32 - NumStmtBits;
111 unsigned : NumStmtBits;
113 unsigned IsConstexpr : 1;
119 friend class BlockDeclRefExpr;
140 unsigned : NumStmtBits;
142 unsigned ValueKind : 2;
143 unsigned ObjectKind : 3;
144 unsigned TypeDependent : 1;
145 unsigned ValueDependent : 1;
146 unsigned InstantiationDependent : 1;
147 unsigned ContainsUnexpandedParameterPack : 1;
149 enum { NumExprBits = 17 };
154 unsigned : NumExprBits;
171 unsigned : NumExprBits;
173 unsigned Semantics : 3;
174 unsigned IsExact : 1;
180 unsigned : NumExprBits;
190 unsigned : NumExprBits;
192 unsigned HasQualifier : 1;
193 unsigned HasTemplateKWAndArgsInfo : 1;
194 unsigned HasFoundDecl : 1;
195 unsigned HadMultipleCandidates : 1;
196 unsigned RefersToEnclosingVariableOrCapture : 1;
202 unsigned : NumExprBits;
205 unsigned BasePathSize : 32 - 6 - NumExprBits;
211 unsigned : NumExprBits;
213 unsigned NumPreArgs : 1;
220 unsigned : NumExprBits;
223 unsigned CleanupsHaveSideEffects : 1;
225 unsigned NumObjects : 32 - 1 - NumExprBits;
232 unsigned : NumExprBits;
236 unsigned NumSubExprs : 8;
237 unsigned ResultIndex : 32 - 8 - NumExprBits;
243 unsigned : NumExprBits;
245 unsigned ShouldCopy : 1;
251 unsigned : NumExprBits;
255 unsigned HadArrayRangeDesignator : 1;
263 unsigned : NumExprBits;
273 unsigned NumArgs : 32 - 8 - 1 - NumExprBits;
279 unsigned : NumExprBits;
281 unsigned IsImplicit : 1;
307 unsigned alignment = 8);
310 unsigned alignment = 8) {
311 return operator new(
bytes, *C, alignment);
314 void *
operator new(
size_t bytes,
void *mem) noexcept {
return mem; }
316 void operator delete(
void *,
const ASTContext &, unsigned) noexcept {}
317 void operator delete(
void *,
const ASTContext *, unsigned) noexcept {}
318 void operator delete(
void *,
size_t) noexcept {}
319 void operator delete(
void *,
void *) noexcept {}
333 : llvm::iterator_adaptor_base<ExprIterator, Stmt **,
334 std::random_access_iterator_tag, Expr *> {
339 assert((*I)->getStmtClass() >= firstExprConstant &&
340 (*I)->getStmtClass() <= lastExprConstant);
341 return *
reinterpret_cast<Expr **
>(I);
347 : llvm::iterator_adaptor_base<ConstExprIterator, const Stmt *const *,
348 std::random_access_iterator_tag,
354 assert((*I)->getStmtClass() >= firstExprConstant &&
355 (*I)->getStmtClass() <= lastExprConstant);
356 return *
reinterpret_cast<const Expr *
const *
>(I);
362 static bool StatisticsEnabled;
370 static_assert(
sizeof(*
this) ==
sizeof(
void *),
371 "changing bitfields changed sizeof(Stmt)");
372 static_assert(
sizeof(*
this) %
alignof(
void *) == 0,
373 "Insufficient alignment!");
374 StmtBits.sClass = SC;
375 if (StatisticsEnabled) Stmt::addStmtClass(SC);
379 return static_cast<StmtClass>(StmtBits.sClass);
382 const char *getStmtClassName()
const;
392 static void addStmtClass(
const StmtClass s);
393 static void EnableStatistics();
394 static void PrintStats();
401 void dump(raw_ostream &OS)
const;
404 void dumpColor()
const;
408 void dumpPretty(
const ASTContext &Context)
const;
411 const ASTContext *Context =
nullptr)
const;
415 void viewAST()
const;
419 Stmt *IgnoreImplicit();
421 return const_cast<Stmt *
>(
this)->IgnoreImplicit();
426 Stmt *IgnoreContainers(
bool IgnoreCaptured =
false);
428 return const_cast<Stmt *
>(
this)->IgnoreContainers(IgnoreCaptured);
431 const Stmt *stripLabelLikeStatements()
const;
433 return const_cast<Stmt*
>(
434 const_cast<const Stmt*
>(
this)->stripLabelLikeStatements());
470 void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
471 bool Canonical)
const;
480 void ProcessODRHash(llvm::FoldingSetNodeID &ID,
ODRHash& Hash)
const;
493 :
Stmt(DeclStmtClass), DG(dg), StartLoc(startLoc), EndLoc(endLoc) {}
564 bool HasLeadingEmptyMacro =
false;
571 :
Stmt(NullStmtClass), SemiLoc(L),
572 HasLeadingEmptyMacro(hasLeadingEmptyMacro) {}
613 :
Stmt(CompoundStmtClass), LBraceLoc(Loc), RBraceLoc(Loc) {
614 CompoundStmtBits.NumStmts = 0;
620 bool body_empty()
const {
return CompoundStmtBits.NumStmts == 0; }
621 unsigned size()
const {
return CompoundStmtBits.NumStmts; }
631 return !body_empty() ? body_begin()[size() - 1] :
nullptr;
635 assert(!body_empty() &&
"setLastStmt");
636 body_begin()[size() - 1] = S;
647 return getTrailingObjects<Stmt *>();
652 return !body_empty() ? body_begin()[0] :
nullptr;
656 return !body_empty() ? body_begin()[size() - 1] :
nullptr;
670 std::reverse_iterator<const_body_iterator>;
708 :
Stmt(SC), KeywordLoc(KWLoc), ColonLoc(ColonLoc) {}
726 return const_cast<SwitchCase*
>(
this)->getSubStmt();
740 enum { LHS, RHS, SUBSTMT, END_EXPR };
741 Stmt* SubExprs[END_EXPR];
747 :
SwitchCase(CaseStmtClass, caseLoc, colonLoc) {
748 SubExprs[SUBSTMT] =
nullptr;
749 SubExprs[LHS] =
reinterpret_cast<Stmt*
>(lhs);
750 SubExprs[RHS] =
reinterpret_cast<Stmt*
>(rhs);
751 EllipsisLoc = ellipsisLoc;
769 return reinterpret_cast<const Expr*
>(SubExprs[LHS]);
773 return reinterpret_cast<const Expr*
>(SubExprs[RHS]);
799 return child_range(&SubExprs[0], &SubExprs[END_EXPR]);
808 SwitchCase(DefaultStmtClass, DL, CL), SubStmt(substmt) {}
835 if (
const CaseStmt *CS = dyn_cast<CaseStmt>(
this))
836 return CS->getLocEnd();
837 return cast<DefaultStmt>(
this)->getLocEnd();
849 :
Stmt(LabelStmtClass), IdentLoc(IL), TheDecl(D), SubStmt(substmt) {
852 "LabelStmt too big");
861 const char *getName()
const;
892 :
Stmt(AttributedStmtClass), SubStmt(SubStmt), AttrLoc(Loc),
893 NumAttrs(Attrs.size()) {
894 std::copy(Attrs.begin(), Attrs.end(), getAttrArrayPtr());
898 :
Stmt(AttributedStmtClass, Empty), NumAttrs(NumAttrs) {
899 std::fill_n(getAttrArrayPtr(), NumAttrs,
nullptr);
902 const Attr *
const *getAttrArrayPtr()
const {
903 return getTrailingObjects<const Attr *>();
905 const Attr **getAttrArrayPtr() {
return getTrailingObjects<const Attr *>(); }
916 return llvm::makeArrayRef(getAttrArrayPtr(), NumAttrs);
934 enum { INIT, VAR, COND, THEN, ELSE, END_EXPR };
935 Stmt* SubExprs[END_EXPR];
944 Stmt *elsev =
nullptr);
957 VarDecl *getConditionVariable()
const;
963 return reinterpret_cast<DeclStmt*
>(SubExprs[VAR]);
988 bool isObjCAvailabilityCheck()
const;
1002 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1013 enum { INIT, VAR, COND, BODY, END_EXPR };
1014 Stmt* SubExprs[END_EXPR];
1020 llvm::PointerIntPair<SwitchCase *, 1, bool> FirstCase;
1037 VarDecl *getConditionVariable()
const;
1043 return reinterpret_cast<DeclStmt*
>(SubExprs[VAR]);
1072 &&
"case/default already added to a switch");
1074 FirstCase.setPointer(SC);
1093 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1104 enum { VAR, COND, BODY, END_EXPR };
1105 Stmt* SubExprs[END_EXPR];
1122 VarDecl *getConditionVariable()
const;
1128 return reinterpret_cast<DeclStmt*
>(SubExprs[VAR]);
1153 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1160 enum { BODY, COND, END_EXPR };
1161 Stmt* SubExprs[END_EXPR];
1168 :
Stmt(DoStmtClass), DoLoc(DL), WhileLoc(WL), RParenLoc(RP) {
1169 SubExprs[COND] =
reinterpret_cast<Stmt*
>(cond);
1170 SubExprs[BODY] = body;
1200 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1209 enum { INIT, CONDVAR, COND, INC, BODY, END_EXPR };
1210 Stmt* SubExprs[END_EXPR];
1231 VarDecl *getConditionVariable()
const;
1237 return reinterpret_cast<DeclStmt*
>(SubExprs[CONDVAR]);
1273 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1285 :
Stmt(GotoStmtClass), Label(label), GotoLoc(GL), LabelLoc(LL) {}
1320 :
Stmt(IndirectGotoStmtClass), GotoLoc(gotoLoc), StarLoc(starLoc),
1321 Target((
Stmt*)target) {}
1325 :
Stmt(IndirectGotoStmtClass, Empty) {}
1387 "BreakStmt too large");
1426 :
Stmt(ReturnStmtClass), RetLoc(RL), RetExpr((
Stmt *)E),
1427 NRVOCandidate(NRVOCandidate) {}
1432 const Expr *getRetValue()
const;
1433 Expr *getRetValue();
1450 return RetExpr ? RetExpr->
getLocEnd() : RetLoc;
1459 if (RetExpr)
return child_range(&RetExpr, &RetExpr+1);
1486 unsigned numoutputs,
unsigned numinputs,
unsigned numclobbers)
1487 :
Stmt (SC), AsmLoc(asmloc), IsSimple(issimple), IsVolatile(isvolatile),
1488 NumOutputs(numoutputs), NumInputs(numinputs),
1489 NumClobbers(numclobbers) {}
1510 std::string generateAsmString(
const ASTContext &
C)
const;
1519 StringRef getOutputConstraint(
unsigned i)
const;
1525 return getOutputConstraint(i)[0] ==
'+';
1528 const Expr *getOutputExpr(
unsigned i)
const;
1532 unsigned getNumPlusOperands()
const;
1540 StringRef getInputConstraint(
unsigned i)
const;
1542 const Expr *getInputExpr(
unsigned i)
const;
1547 StringRef getClobber(
unsigned i)
const;
1562 return &Exprs[0] + NumOutputs;
1566 return &Exprs[0] + NumOutputs + NumInputs;
1572 return &Exprs[0] + NumOutputs;
1576 return &Exprs[0] + NumOutputs + NumInputs;
1595 return &Exprs[0] + NumOutputs;
1607 return &Exprs[0] + NumOutputs;
1615 return child_range(&Exprs[0], &Exprs[0] + NumOutputs + NumInputs);
1633 bool isvolatile,
unsigned numoutputs,
unsigned numinputs,
1672 : MyKind(Operand), Str(S), OperandNo(OpNo),
1683 assert(isOperand());
1688 assert(isOperand() &&
"Range is currently used only for Operands.");
1703 const ASTContext &C,
unsigned &DiagOffs)
const;
1706 std::string generateAsmString(
const ASTContext &C)
const;
1716 return II->getName();
1721 StringRef getOutputConstraint(
unsigned i)
const;
1724 return Constraints[i];
1727 return Constraints[i];
1730 Expr *getOutputExpr(
unsigned i);
1733 return const_cast<GCCAsmStmt*
>(
this)->getOutputExpr(i);
1739 return Names[i + NumOutputs];
1744 return II->getName();
1749 StringRef getInputConstraint(
unsigned i)
const;
1752 return Constraints[i + NumOutputs];
1755 return Constraints[i + NumOutputs];
1758 Expr *getInputExpr(
unsigned i);
1759 void setInputExpr(
unsigned i,
Expr *E);
1762 return const_cast<GCCAsmStmt*
>(
this)->getInputExpr(i);
1766 void setOutputsAndInputsAndClobbers(
const ASTContext &C,
1770 unsigned NumOutputs,
1773 unsigned NumClobbers);
1781 int getNamedOperand(StringRef SymbolicName)
const;
1783 StringRef getClobber(
unsigned i)
const;
1805 unsigned NumAsmToks = 0;
1807 Token *AsmToks =
nullptr;
1808 StringRef *Constraints =
nullptr;
1809 StringRef *Clobbers =
nullptr;
1836 std::string generateAsmString(
const ASTContext &
C)
const;
1841 assert(i < NumOutputs);
1842 return Constraints[i];
1845 Expr *getOutputExpr(
unsigned i);
1848 return const_cast<MSAsmStmt*
>(
this)->getOutputExpr(i);
1854 assert(i < NumInputs);
1855 return Constraints[i + NumOutputs];
1858 Expr *getInputExpr(
unsigned i);
1859 void setInputExpr(
unsigned i,
Expr *E);
1862 return const_cast<MSAsmStmt*
>(
this)->getInputExpr(i);
1868 return llvm::makeArrayRef(Constraints, NumInputs + NumOutputs);
1872 return llvm::makeArrayRef(Clobbers, NumClobbers);
1876 return llvm::makeArrayRef(reinterpret_cast<Expr**>(Exprs),
1877 NumInputs + NumOutputs);
1880 StringRef
getClobber(
unsigned i)
const {
return getClobbers()[i]; }
1883 void initialize(
const ASTContext &C, StringRef AsmString,
1896 return child_range(&Exprs[0], &Exprs[NumInputs + NumOutputs]);
1907 enum { FILTER_EXPR,
BLOCK };
1925 return reinterpret_cast<Expr*
>(Children[FILTER_EXPR]);
1929 return cast<CompoundStmt>(Children[
BLOCK]);
1981 enum { TRY = 0, HANDLER = 1 };
2004 return cast<CompoundStmt>(Children[TRY]);
2028 :
Stmt(SEHLeaveStmtClass), LeaveLoc(LL) {}
2072 llvm::PointerIntPair<VarDecl *, 2, VariableCaptureKind> VarAndKind;
2103 return getCaptureKind() == VCK_ByCopy;
2109 return getCaptureKind() == VCK_VLAType;
2115 VarDecl *getCapturedVar()
const;
2120 unsigned NumCaptures;
2124 llvm::PointerIntPair<CapturedDecl *, 1, CapturedRegionKind> CapDeclAndKind;
2136 Stmt **getStoredStmts() {
return reinterpret_cast<Stmt **
>(
this + 1); }
2138 Stmt *
const *getStoredStmts()
const {
2139 return reinterpret_cast<Stmt *
const *
>(
this + 1);
2142 Capture *getStoredCaptures()
const;
2144 void setCapturedStmt(
Stmt *S) { getStoredStmts()[NumCaptures] = S; }
2156 unsigned NumCaptures);
2180 assert(D &&
"null RecordDecl");
2185 bool capturesVariable(
const VarDecl *Var)
const;
2207 return getStoredCaptures() + NumCaptures;
2221 llvm::iterator_range<const_capture_init_iterator>;
2233 return reinterpret_cast<Expr **
>(getStoredStmts());
2237 return reinterpret_cast<Expr *
const *
>(getStoredStmts());
2243 return capture_init_begin() + NumCaptures;
2247 return capture_init_begin() + NumCaptures;
2251 return getCapturedStmt()->getLocStart();
2255 return getCapturedStmt()->getLocEnd();
2259 return getCapturedStmt()->getSourceRange();
2271 #endif // LLVM_CLANG_AST_STMT_H SourceLocation getRParenLoc() const
child_iterator child_begin()
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
SourceLocation getStartLoc() const
GotoStmt(EmptyShell Empty)
Build an empty goto statement.
SourceLocation getRBracLoc() const
IdentifierInfo * getInputIdentifier(unsigned i) const
DoStmt(Stmt *body, Expr *cond, SourceLocation DL, SourceLocation WL, SourceLocation RP)
static bool classof(const Stmt *T)
SourceLocation getRParenLoc() const
This represents a GCC inline-assembly statement extension.
const Stmt * getElse() const
unsigned getNumInputs() const
CompoundStmt * getBlock() const
SourceLocation getForLoc() 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
SourceLocation getLocEnd() const LLVM_READONLY
ConstExprIterator(const Stmt *const *I)
DefaultStmt(SourceLocation DL, SourceLocation CL, Stmt *substmt)
SourceLocation getEllipsisLoc() const
void setNRVOCandidate(const VarDecl *Var)
static bool classof(const Stmt *T)
__SIZE_TYPE__ size_t
The unsigned integer type of the result of the sizeof operator.
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
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...
IndirectGotoStmt(EmptyShell Empty)
Build an empty indirect goto statement.
std::reverse_iterator< const_body_iterator > const_reverse_body_iterator
Stmt - This represents one statement.
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.
SourceLocation getLocStart() const LLVM_READONLY
unsigned getNumOutputs() const
SourceLocation getLocEnd() const LLVM_READONLY
llvm::iterator_range< body_iterator > body_range
ContinueStmt(EmptyShell Empty)
Build an empty continue statement.
const StringLiteral * getAsmString() const
void setRParenLoc(SourceLocation L)
void setContinueLoc(SourceLocation L)
Decl - This represents one declaration (or definition), e.g.
void setDeclGroup(DeclGroupRef DGR)
bool hasLeadingEmptyMacro() const
FloatingLiteralBitfields FloatingLiteralBits
NullStmt(EmptyShell Empty)
Build an empty null statement.
const Expr * getOutputExpr(unsigned i) const
SourceLocation getIdentLoc() const
Represents an attribute applied to a statement.
const Expr * getOutputExpr(unsigned i) const
SourceLocation getLocStart() const LLVM_READONLY
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.
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
void setSwitchCaseList(SwitchCase *SC)
Set the case list for this switch statement.
NullStmt(SourceLocation L, bool hasLeadingEmptyMacro=false)
void setStartLoc(SourceLocation L)
SourceLocation getGotoLoc() const
void setForLoc(SourceLocation L)
SourceLocation getLocStart() const LLVM_READONLY
WhileStmt(EmptyShell Empty)
Build an empty while statement.
const_child_iterator child_begin() const
SourceLocation getLocEnd() const LLVM_READONLY
VarDecl - An instance of this class is created to represent 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
static bool classof(const Stmt *T)
void setAsmLoc(SourceLocation L)
const_outputs_iterator begin_outputs() const
const Expr * getCond() const
SourceLocation getIfLoc() const
Describes how types, statements, expressions, and declarations should be printed. ...
SourceLocation getLocStart() const LLVM_READONLY
capture_iterator capture_begin()
Retrieve an iterator pointing to the first capture.
static StringRef bytes(const std::vector< T, Allocator > &v)
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)
SourceLocation getLocStart() const LLVM_READONLY
Stmt(StmtClass SC, EmptyShell)
Construct an empty statement.
CoawaitExprBitfields CoawaitBits
static bool classof(const Stmt *T)
LabelStmt - Represents a label, which has a substatement.
RecordDecl - Represents a struct/union/class.
Represents a C99 designated initializer expression.
const Expr * getTarget() const
inputs_iterator begin_inputs()
SourceLocation getColonLoc() const
One of these records is kept for each identifier that is lexed.
const_outputs_iterator end_outputs() const
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
DeclGroupRef::const_iterator const_decl_iterator
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation getLocStart() const LLVM_READONLY
const_body_iterator body_begin() const
SourceLocation getEndLoc() const
SourceLocation getLocStart() const LLVM_READONLY
LabelStmt(SourceLocation IL, LabelDecl *D, Stmt *substmt)
CharSourceRange getRange() const
CharacterLiteralBitfields CharacterLiteralBits
ArrayRef< Expr * > getAllExprs() const
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation getEndLoc() const
Token - This structure provides full information about a lexed token.
ObjCIndirectCopyRestoreExprBitfields ObjCIndirectCopyRestoreExprBits
void setReturnLoc(SourceLocation L)
llvm::iterator_range< const_inputs_iterator > inputs_const_range
MSAsmStmt(EmptyShell Empty)
Build an empty MS-style inline-assembly statement.
SourceLocation getLocEnd() const LLVM_READONLY
const DeclGroupRef getDeclGroup() const
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)
const Stmt * getSubStmt() const
void addSwitchCase(SwitchCase *SC)
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.
outputs_iterator begin_outputs()
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
SourceLocation getLocEnd() const LLVM_READONLY
void setEndLoc(SourceLocation L)
DeclStmt(EmptyShell Empty)
Build an empty declaration statement.
llvm::iterator_range< const_outputs_iterator > outputs_const_range
SourceLocation getLocStart() const LLVM_READONLY
const StringLiteral * getInputConstraintLiteral(unsigned i) const
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getLocStart() 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 getLocStart() const LLVM_READONLY
const Expr * getInc() const
SourceLocation getContinueLoc() const
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
SourceLocation getLocEnd() const LLVM_READONLY
StringLiteral * getClobberStringLiteral(unsigned i)
StringRef getOutputName(unsigned i) const
SourceLocation getLocEnd() 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...
This represents the body of a CapturedStmt, and serves as its DeclContext.
const Expr * getLHS() const
const_body_iterator body_end() const
Iterator for iterating over Stmt * arrays that contain only Expr *.
SourceLocation getLocStart() const LLVM_READONLY
const_decl_iterator decl_begin() const
StringLiteral * getAsmString()
Const iterator for iterating over Stmt * arrays that contain only Expr *.
void setColonLoc(SourceLocation L)
llvm::iterator_range< const_child_iterator > const_child_range
void setBreakLoc(SourceLocation L)
CompoundStmt - This represents a group of statements like { stmt stmt }.
SourceLocation getLocEnd() const LLVM_READONLY
Describes the capture of either a variable, or 'this', or variable-length array type.
Stmt * stripLabelLikeStatements()
SourceLocation getLocStart() const LLVM_READONLY
static bool classof(const Stmt *T)
const_inputs_iterator begin_inputs() const
void setSemiLoc(SourceLocation L)
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getLocStart() 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...
static bool classof(const Stmt *T)
static bool classof(const Stmt *T)
unsigned getOperandNo() const
const DeclStmt * getConditionVariableDeclStmt() const
If this IfStmt has a condition variable, return the faux DeclStmt associated with the creation of tha...
SourceLocation getLabelLoc() const
llvm::iterator_range< const_capture_iterator > capture_const_range
void setLeaveLoc(SourceLocation L)
const Stmt * getSubStmt() const
const Stmt * getSubStmt() const
void setRParenLoc(SourceLocation L)
SourceLocation getFinallyLoc() const
GotoStmt(LabelDecl *label, SourceLocation GL, SourceLocation LL)
Expr - This represents one expression.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation getElseLoc() const
void setWhileLoc(SourceLocation L)
Represents a character-granular source range.
SourceLocation getLocStart() const LLVM_READONLY
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
const FunctionProtoType * T
SourceLocation getDefaultLoc() const
void setLParenLoc(SourceLocation L)
const StringLiteral * getClobberStringLiteral(unsigned i) const
SourceLocation getWhileLoc() const
SourceLocation getLocEnd() const LLVM_READONLY
const Stmt * getThen() 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
SourceLocation KeywordLoc
void setRetValue(Expr *E)
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
void setColonLoc(SourceLocation L)
ExprWithCleanupsBitfields ExprWithCleanupsBits
std::reverse_iterator< body_iterator > reverse_body_iterator
static bool classof(const Stmt *T)
CompoundStmtBitfields CompoundStmtBits
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
capture_init_range capture_inits()
SourceLocation getLocEnd() const LLVM_READONLY
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;...
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()
llvm::iterator_range< const_decl_iterator > decl_const_range
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation getLocEnd() const LLVM_READONLY
static bool classof(const Stmt *T)
Stmt *const * const_body_iterator
SourceLocation getLocEnd() const LLVM_READONLY
const_inputs_iterator end_inputs() const
const Expr * getCond() const
DoStmt - This represents a 'do/while' stmt.
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
std::reverse_iterator< decl_iterator > reverse_decl_iterator
const Stmt * IgnoreContainers(bool IgnoreCaptured=false) const
SourceLocation getEndLoc() const
decl_const_range decls() const
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
void setDecl(LabelDecl *D)
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.
void setGotoLoc(SourceLocation L)
CaseStmt(Expr *lhs, Expr *rhs, SourceLocation caseLoc, SourceLocation ellipsisLoc, SourceLocation colonLoc)
Encodes a location in the source.
StringRef getOutputConstraint(unsigned i) const
PseudoObjectExprBitfields PseudoObjectExprBits
IfStmtBitfields IfStmtBits
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 setLastStmt(Stmt *S)
ArrayRef< const Attr * > getAttrs() const
void setConstexpr(bool C)
SourceLocation getExceptLoc() const
const_capture_iterator capture_begin() const
void setIdentLoc(SourceLocation L)
const_child_range children() const
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
LabelDecl - Represents the declaration of a label.
bool capturesVariable() const
Determine whether this capture handles a variable (by reference).
reverse_body_iterator body_rend()
SourceLocation getLBraceLoc() const
const std::string & getString() const
CaseStmt(EmptyShell Empty)
Build an empty switch case statement.
void setAllEnumCasesCovered()
Set a flag in the SwitchStmt indicating that if the 'switch (X)' is a switch over an enum value then ...
SourceLocation getLocStart() const LLVM_READONLY
CompoundStmt(SourceLocation Loc)
reference operator*() 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.
decl_iterator decl_begin()
SourceLocation getGotoLoc() const
reverse_decl_iterator decl_rbegin()
SEHLeaveStmt(SourceLocation LL)
const StringLiteral * getOutputConstraintLiteral(unsigned i) const
Stmt * getCapturedStmt()
Retrieve the statement being captured.
const Stmt * body_front() const
unsigned capture_size() const
Retrieve the number of captures, including 'this'.
const Stmt * getBody() const
void setCaseLoc(SourceLocation L)
SourceLocation getEndLoc() const
LabelStmt(EmptyShell Empty)
const_capture_init_range capture_inits() const
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getKeywordLoc() const
SourceLocation getStarLoc() const
const DeclStmt * getConditionVariableDeclStmt() const
If this WhileStmt has a condition variable, return the faux DeclStmt associated with the creation of ...
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.
SourceLocation getLocStart() const LLVM_READONLY
IfStmt(EmptyShell Empty)
Build an empty if/then/else statement.
const_child_range children() const
void setGotoLoc(SourceLocation L)
NullStmt - This is the null statement ";": C99 6.8.3p3.
StringRef getInputConstraint(unsigned i) const
Dataflow Directional Tag Classes.
SourceLocation getLocStart() const LLVM_READONLY
bool isValid() const
Return true if this is a valid SourceLocation object.
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getLocEnd() const LLVM_READONLY
IdentifierInfo * getOutputIdentifier(unsigned i) const
llvm::iterator_range< outputs_iterator > outputs_range
const Stmt * body_back() const
Reads an AST files chain containing the contents of a translation unit.
static bool classof(const Stmt *T)
SourceLocation getLocStart() const LLVM_READONLY
DoStmt(EmptyShell Empty)
Build an empty do-while statement.
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getLocEnd() const LLVM_READONLY
Stmt * getHandler() const
SourceLocation getSemiLoc() const
StmtClass getStmtClass() const
reference operator*() const
SwitchCase * getNextSwitchCase()
bool isSingleDecl() const
static bool classof(const Stmt *T)
void setEllipsisLoc(SourceLocation L)
const Decl * getSingleDecl() const
SourceLocation getLocEnd() const LLVM_READONLY
ReturnStmt(SourceLocation RL, Expr *E, const VarDecl *NRVOCandidate)
static bool classof(const Stmt *T)
BreakStmt(EmptyShell Empty)
Build an empty break statement.
const Stmt * getSubStmt() const
SourceLocation getLocEnd() const LLVM_READONLY
bool isSingleDecl() const
isSingleDecl - This method returns true if this DeclStmt refers to a single Decl. ...
body_iterator body_begin()
static bool classof(const Stmt *T)
IndirectGotoStmt(SourceLocation gotoLoc, SourceLocation starLoc, Expr *target)
const Stmt * getBody() const
llvm::iterator_range< const_body_iterator > body_const_range
Represents a __leave statement.
bool capturesVariableByCopy() const
Determine whether this capture handles a variable by copy.
SwitchStmt - This represents a 'switch' stmt.
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()
StringLiteral * getInputConstraintLiteral(unsigned i)
DeclGroupRef getDeclGroup()
Represents a 'co_await' expression.
const Expr * getInputExpr(unsigned i) const
TypeTraitExprBitfields TypeTraitExprBits
void setSwitchLoc(SourceLocation L)
const Stmt * IgnoreImplicit() const
static bool classof(const Stmt *T)
SourceLocation getLocEnd() const LLVM_READONLY
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)
SourceLocation getLocStart() const LLVM_READONLY
StringRef getAsmString() const
ArrayRef< StringRef > getAllConstraints() const
UnaryExprOrTypeTraitExprBitfields UnaryExprOrTypeTraitExprBits
SourceLocation getColonLoc() const
unsigned getNumClobbers() const
ReturnStmt(SourceLocation RL)
SourceLocation getRParenLoc() const
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.
Decl *const * const_iterator
const SwitchCase * getNextSwitchCase() const
SwitchStmt(EmptyShell Empty)
Build a empty switch statement.
static bool classof(const Stmt *T)
llvm::iterator_range< capture_iterator > capture_range
SourceLocation getWhileLoc() const
Defines the clang::SourceLocation class and associated facilities.
llvm::iterator_range< inputs_iterator > inputs_range
ContinueStmt - This represents a continue.
const_decl_iterator decl_end() const
const Expr * getRHS() const
reverse_body_iterator body_rbegin()
void setLBraceLoc(SourceLocation L)
Expr * getFilterExpr() const
void setElseLoc(SourceLocation L)
SourceLocation getAttrLoc() const
ContinueStmt(SourceLocation CL)
const Stmt * getInit() const
OpenMPLinearClauseKind getModifier() const
Return modifier.
SourceLocation getLocStart() const LLVM_READONLY
WhileStmt - This represents a 'while' stmt.
llvm::iterator_range< capture_init_iterator > capture_init_range
void setIfLoc(SourceLocation L)
static bool classof(const Stmt *T)
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)
void setRParenLoc(SourceLocation L)
SourceLocation getLocEnd() const LLVM_READONLY
void setNextSwitchCase(SwitchCase *SC)
body_const_range body() const
A reference to a declared variable, function, enum, etc.
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation getColonLoc() const
void setLabel(LabelDecl *D)
static bool classof(const Stmt *T)
BreakStmt - This represents a break.
const Stmt * getInit() const
void setSubStmt(Stmt *SS)
CallExprBitfields CallExprBits
CapturedRegionKind
The different kinds of captured statement.
const Stmt * getBody() const
CastExprBitfields CastExprBits
DeclStmt(DeclGroupRef dg, SourceLocation startLoc, SourceLocation endLoc)
const Expr * getCond() const
SourceLocation getLocStart() const LLVM_READONLY
A trivial tuple used to represent a source range.
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type, member-designator).
const_reverse_body_iterator body_rend() const
const Expr * getCond() const
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument.
SourceLocation ColonLoc
Location of ':'.
void setWhileLoc(SourceLocation L)
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
ReturnStmt(EmptyShell Empty)
Build an empty return expression.
bool capturesVariableArrayType() const
Determine whether this capture handles a variable-length array type.
Attr - This represents one attribute.
SourceLocation getLocEnd() const LLVM_READONLY
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)
SourceLocation getEndLoc() const
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
If this SwitchStmt has a condition variable, return the faux DeclStmt associated with the creation of...
inputs_iterator end_inputs()
outputs_const_range outputs() const
const LabelDecl * getConstantTarget() const