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/iterator.h"
26 #include "llvm/Support/Compiler.h"
27 #include "llvm/Support/ErrorHandling.h"
31 class FoldingSetNodeID;
45 struct PrintingPolicy;
60 class alignas(void *)
Stmt {
64 #define STMT(CLASS, PARENT) CLASS##Class,
65 #define STMT_RANGE(BASE, FIRST, LAST) \
66 first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class,
67 #define LAST_STMT_RANGE(BASE, FIRST, LAST) \
68 first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class
69 #define ABSTRACT_STMT(STMT)
70 #include "clang/AST/StmtNodes.inc"
75 void *
operator new(
size_t bytes) noexcept {
76 llvm_unreachable(
"Stmts cannot be allocated with regular 'new'.");
78 void operator delete(
void *data) noexcept {
79 llvm_unreachable(
"Stmts cannot be released with regular 'delete'.");
101 unsigned IsConstexpr : 1;
129 unsigned ValueKind : 2;
130 unsigned ObjectKind : 3;
131 unsigned TypeDependent : 1;
132 unsigned ValueDependent : 1;
133 unsigned InstantiationDependent : 1;
134 unsigned ContainsUnexpandedParameterPack : 1;
158 unsigned Semantics : 3;
159 unsigned IsExact : 1;
175 unsigned HasQualifier : 1;
176 unsigned HasTemplateKWAndArgsInfo : 1;
177 unsigned HasFoundDecl : 1;
178 unsigned HadMultipleCandidates : 1;
179 unsigned RefersToEnclosingVariableOrCapture : 1;
194 unsigned NumPreArgs : 1;
204 unsigned CleanupsHaveSideEffects : 1;
217 unsigned NumSubExprs : 8;
225 unsigned ShouldCopy : 1;
235 unsigned HadArrayRangeDesignator : 1;
261 unsigned IsImplicit : 1;
290 unsigned alignment = 8);
293 unsigned alignment = 8) {
294 return operator new(
bytes, *
C, alignment);
297 void *
operator new(
size_t bytes,
void *mem) noexcept {
return mem; }
301 void operator delete(
void *,
size_t) noexcept {}
302 void operator delete(
void *,
void *) noexcept {}
316 : llvm::iterator_adaptor_base<ExprIterator, Stmt **,
317 std::random_access_iterator_tag, Expr *> {
322 assert((*I)->getStmtClass() >= firstExprConstant &&
323 (*I)->getStmtClass() <= lastExprConstant);
324 return *
reinterpret_cast<Expr **
>(
I);
330 : llvm::iterator_adaptor_base<ConstExprIterator, const Stmt *const *,
331 std::random_access_iterator_tag,
337 assert((*I)->getStmtClass() >= firstExprConstant &&
338 (*I)->getStmtClass() <= lastExprConstant);
339 return *
reinterpret_cast<const Expr *
const *
>(
I);
345 static bool StatisticsEnabled;
353 static_assert(
sizeof(*
this) ==
sizeof(
void *),
354 "changing bitfields changed sizeof(Stmt)");
355 static_assert(
sizeof(*
this) %
alignof(
void *) == 0,
356 "Insufficient alignment!");
383 void dump(raw_ostream &OS) const;
393 unsigned Indentation = 0) const;
402 const
Stmt *IgnoreImplicit()
const {
412 return const_cast<Stmt*
>(
450 bool Canonical)
const;
474 StartLoc(startLoc), EndLoc(endLoc) {}
543 bool HasLeadingEmptyMacro;
546 :
Stmt(NullStmtClass), SemiLoc(L),
551 HasLeadingEmptyMacro(
false) { }
587 :
Stmt(CompoundStmtClass), Body(nullptr), LBraceLoc(Loc), RBraceLoc(Loc) {
593 :
Stmt(CompoundStmtClass, Empty), Body(nullptr) {
639 typedef std::reverse_iterator<const_body_iterator>
708 return T->getStmtClass() == CaseStmtClass ||
709 T->getStmtClass() == DefaultStmtClass;
715 enum { LHS, RHS, SUBSTMT, END_EXPR };
716 Stmt* SubExprs[END_EXPR];
721 :
SwitchCase(CaseStmtClass, caseLoc, colonLoc) {
722 SubExprs[SUBSTMT] =
nullptr;
723 SubExprs[LHS] =
reinterpret_cast<Stmt*
>(lhs);
724 SubExprs[RHS] =
reinterpret_cast<Stmt*
>(rhs);
725 EllipsisLoc = ellipsisLoc;
743 return reinterpret_cast<const Expr*
>(SubExprs[LHS]);
746 return reinterpret_cast<const Expr*
>(SubExprs[RHS]);
770 return child_range(&SubExprs[0], &SubExprs[END_EXPR]);
778 SwitchCase(DefaultStmtClass, DL, CL), SubStmt(substmt) {}
805 if (
const CaseStmt *CS = dyn_cast<CaseStmt>(
this))
806 return CS->getLocEnd();
807 return cast<DefaultStmt>(
this)->
getLocEnd();
820 :
Stmt(LabelStmtClass), IdentLoc(IL), TheDecl(D), SubStmt(substmt) {
823 "LabelStmt too big");
862 :
Stmt(AttributedStmtClass), SubStmt(SubStmt), AttrLoc(Loc),
863 NumAttrs(Attrs.size()) {
864 std::copy(Attrs.begin(), Attrs.end(), getAttrArrayPtr());
868 :
Stmt(AttributedStmtClass, Empty), NumAttrs(NumAttrs) {
869 std::fill_n(getAttrArrayPtr(), NumAttrs,
nullptr);
872 const Attr *
const *getAttrArrayPtr()
const {
873 return reinterpret_cast<const Attr *
const *
>(
this + 1);
875 const Attr **getAttrArrayPtr() {
876 return reinterpret_cast<const Attr **
>(
this + 1);
880 static AttributedStmt *
Create(
const ASTContext &
C, SourceLocation Loc,
881 ArrayRef<const Attr*> Attrs,
Stmt *SubStmt);
883 static AttributedStmt *
CreateEmpty(
const ASTContext &
C,
unsigned NumAttrs);
887 return llvm::makeArrayRef(getAttrArrayPtr(), NumAttrs);
906 enum { INIT, VAR, COND, THEN, ELSE, END_EXPR };
907 Stmt* SubExprs[END_EXPR];
916 Stmt *elsev =
nullptr);
935 return reinterpret_cast<DeclStmt*
>(SubExprs[VAR]);
973 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
985 enum { INIT, VAR, COND, BODY, END_EXPR };
986 Stmt* SubExprs[END_EXPR];
991 llvm::PointerIntPair<SwitchCase *, 1, bool> FirstCase;
1014 return reinterpret_cast<DeclStmt*
>(SubExprs[VAR]);
1042 &&
"case/default already added to a switch");
1044 FirstCase.setPointer(SC);
1062 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1075 enum { VAR, COND, BODY, END_EXPR };
1076 Stmt* SubExprs[END_EXPR];
1098 return reinterpret_cast<DeclStmt*
>(SubExprs[VAR]);
1122 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1130 enum { BODY, COND, END_EXPR };
1131 Stmt* SubExprs[END_EXPR];
1138 :
Stmt(DoStmtClass), DoLoc(DL), WhileLoc(WL), RParenLoc(RP) {
1139 SubExprs[COND] =
reinterpret_cast<Stmt*
>(cond);
1140 SubExprs[BODY] = body;
1170 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1181 enum { INIT, CONDVAR, COND, INC, BODY, END_EXPR };
1182 Stmt* SubExprs[END_EXPR];
1209 return reinterpret_cast<DeclStmt*
>(SubExprs[CONDVAR]);
1244 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1256 :
Stmt(GotoStmtClass), Label(label), GotoLoc(GL), LabelLoc(LL) {}
1291 :
Stmt(IndirectGotoStmtClass), GotoLoc(gotoLoc), StarLoc(starLoc),
1292 Target((
Stmt*)target) {}
1296 :
Stmt(IndirectGotoStmtClass, Empty) { }
1360 "BreakStmt too large");
1401 :
Stmt(ReturnStmtClass), RetLoc(RL), RetExpr((
Stmt *)E),
1402 NRVOCandidate(NRVOCandidate) {}
1424 return RetExpr ? RetExpr->
getLocEnd() : RetLoc;
1433 if (RetExpr)
return child_range(&RetExpr, &RetExpr+1);
1458 unsigned numoutputs,
unsigned numinputs,
unsigned numclobbers) :
1604 bool isvolatile,
unsigned numoutputs,
unsigned numinputs,
1611 Constraints(nullptr), Clobbers(nullptr),
Names(nullptr) { }
1642 : MyKind(
Operand), Str(S), OperandNo(OpNo),
1659 assert(
isOperand() &&
"Range is currently used only for Operands.");
1674 const ASTContext &C,
unsigned &DiagOffs)
const;
1687 return II->getName();
1695 return Constraints[i];
1698 return Constraints[i];
1715 return II->getName();
1737 void setOutputsAndInputsAndClobbers(
const ASTContext &C,
1774 unsigned NumAsmToks;
1777 StringRef *Constraints;
1778 StringRef *Clobbers;
1792 NumAsmToks(0), AsmToks(nullptr), Constraints(nullptr), Clobbers(nullptr) { }
1814 return Constraints[i];
1846 return llvm::makeArrayRef(reinterpret_cast<Expr**>(
Exprs),
1853 void initialize(
const ASTContext &
C, StringRef AsmString,
1874 enum { FILTER_EXPR, BLOCK };
1897 return reinterpret_cast<Expr*
>(Children[FILTER_EXPR]);
1901 return cast<CompoundStmt>(Children[
BLOCK]);
1953 enum { TRY = 0, HANDLER = 1 };
1978 return cast<CompoundStmt>(Children[TRY]);
2002 :
Stmt(SEHLeaveStmtClass), LeaveLoc(LL) {}
2046 llvm::PointerIntPair<VarDecl *, 2, VariableCaptureKind> VarAndKind;
2095 unsigned NumCaptures;
2099 llvm::PointerIntPair<CapturedDecl *, 1, CapturedRegionKind> CapDeclAndKind;
2111 Stmt **getStoredStmts() {
return reinterpret_cast<Stmt **
>(
this + 1); }
2113 Stmt *
const *getStoredStmts()
const {
2114 return reinterpret_cast<Stmt *
const *
>(
this + 1);
2117 Capture *getStoredCaptures()
const;
2119 void setCapturedStmt(
Stmt *
S) { getStoredStmts()[NumCaptures] =
S; }
2124 ArrayRef<Capture> Captures,
2125 ArrayRef<Expr *> CaptureInits,
2126 CapturedDecl *CD, RecordDecl *RD);
2129 unsigned NumCaptures);
2153 assert(D &&
"null RecordDecl");
2180 return getStoredCaptures() + NumCaptures;
2193 typedef llvm::iterator_range<const_capture_init_iterator>
2206 return reinterpret_cast<Expr **
>(getStoredStmts());
2210 return reinterpret_cast<Expr *
const *
>(getStoredStmts());
static AttributedStmt * CreateEmpty(const ASTContext &C, unsigned NumAttrs)
child_iterator child_begin()
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
void printPretty(raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0) const
GotoStmt(EmptyShell Empty)
Build an empty goto statement.
void setConditionVariable(const ASTContext &C, VarDecl *V)
DoStmt(Stmt *body, Expr *cond, SourceLocation DL, SourceLocation WL, SourceLocation RP)
static bool classof(const Stmt *T)
const SwitchCase * getNextSwitchCase() const
StmtClass getStmtClass() const
Capture(SourceLocation Loc, VariableCaptureKind Kind, VarDecl *Var=nullptr)
Create a new capture.
This represents a GCC inline-assembly statement extension.
decl_const_range decls() const
unsigned getNumOutputs() const
const DeclGroupRef getDeclGroup() const
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument.
const Stmt * getInit() const
const Stmt * getSubStmt() const
void setStmts(const ASTContext &C, ArrayRef< Stmt * > Stmts)
SourceLocation getLocEnd() const LLVM_READONLY
ConstExprIterator(const Stmt *const *I)
DefaultStmt(SourceLocation DL, SourceLocation CL, Stmt *substmt)
void setNRVOCandidate(const VarDecl *Var)
bool hasLeadingEmptyMacro() const
SourceLocation getLParenLoc() const
static bool classof(const Stmt *T)
SourceLocation getEndLoc() const
__SIZE_TYPE__ size_t
The unsigned integer type of the result of the sizeof operator.
llvm::iterator_range< capture_iterator > capture_range
const Stmt * getSubStmt() const
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
std::reverse_iterator< body_iterator > reverse_body_iterator
outputs_iterator end_outputs()
IndirectGotoStmt(EmptyShell Empty)
Build an empty indirect goto statement.
Stmt - This represents one statement.
llvm::iterator_range< outputs_iterator > outputs_range
IfStmt - This represents an if/then/else.
AsmStmt(StmtClass SC, EmptyShell Empty)
Build an empty inline-assembly statement.
SourceLocation getLocStart() const LLVM_READONLY
const Expr * getOutputExpr(unsigned i) const
reference operator*() const
SourceLocation getLocEnd() const LLVM_READONLY
capture_const_range captures() const
ContinueStmt(EmptyShell Empty)
Build an empty continue statement.
void setRParenLoc(SourceLocation L)
void setContinueLoc(SourceLocation L)
Decl - This represents one declaration (or definition), e.g.
void setDeclGroup(DeclGroupRef DGR)
void dumpColor() const
dumpColor - same as dump(), but forces color highlighting.
FloatingLiteralBitfields FloatingLiteralBits
DeclGroupRef::iterator decl_iterator
NullStmt(EmptyShell Empty)
Build an empty null statement.
Represents an attribute applied to a statement.
GCCAsmStmt(const ASTContext &C, SourceLocation asmloc, bool issimple, bool isvolatile, unsigned numoutputs, unsigned numinputs, IdentifierInfo **names, StringLiteral **constraints, Expr **exprs, StringLiteral *asmstr, unsigned numclobbers, StringLiteral **clobbers, SourceLocation rparenloc)
static CapturedStmt * Create(const ASTContext &Context, Stmt *S, CapturedRegionKind Kind, ArrayRef< Capture > Captures, ArrayRef< Expr * > CaptureInits, CapturedDecl *CD, RecordDecl *RD)
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation getIfLoc() const
DeclRefExprBitfields DeclRefExprBits
Represents a call to a C++ constructor.
const_capture_init_range capture_inits() const
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.
Stmt * IgnoreImplicit()
Skip past any implicit AST nodes which might surround this statement, such as ExprWithCleanups or Imp...
const Stmt * getElse() const
NullStmt(SourceLocation L, bool hasLeadingEmptyMacro=false)
void setStartLoc(SourceLocation L)
void setForLoc(SourceLocation L)
SourceLocation getLocStart() const LLVM_READONLY
static void addStmtClass(const StmtClass s)
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "for" statement, if any.
void setConditionVariable(const ASTContext &C, VarDecl *V)
const Stmt * getBody() const
SourceLocation getEndLoc() const
WhileStmt(EmptyShell Empty)
Build an empty while statement.
std::string generateAsmString(const ASTContext &C) const
Assemble final IR asm string.
CompoundStmt * getBlock() const
void setInputExpr(unsigned i, Expr *E)
void setInputExpr(unsigned i, Expr *E)
SourceLocation getLocEnd() const LLVM_READONLY
VarDecl - An instance of this class is created to represent a variable declaration or definition...
SourceLocation getReturnLoc() const
static bool classof(const Stmt *T)
StringRef getInputConstraint(unsigned i) const
void setAsmLoc(SourceLocation L)
VarDecl * getCapturedVar() const
Retrieve the declaration of the variable being captured.
llvm::iterator_range< capture_init_iterator > capture_init_range
SourceLocation getDoLoc() const
SourceLocation getRParenLoc() const
CapturedRegionKind getCapturedRegionKind() const
Retrieve the captured region kind.
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 en...
const Stmt * getSubStmt() const
const Expr * getOutputExpr(unsigned i) const
SourceLocation getDefaultLoc() const
SourceLocation getEllipsisLoc() 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.
bool isOutputPlusConstraint(unsigned i) const
isOutputPlusConstraint - Return true if the specified output constraint is a "+" constraint (which is...
RecordDecl - Represents a struct/union/class.
Represents a C99 designated initializer expression.
inputs_iterator begin_inputs()
One of these records is kept for each identifier that is lexed.
const_decl_iterator decl_begin() const
IfStmt(const ASTContext &C, SourceLocation IL, bool IsConstexpr, Stmt *init, VarDecl *var, Expr *cond, Stmt *then, SourceLocation EL=SourceLocation(), Stmt *elsev=nullptr)
unsigned getNumInputs() const
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
outputs_const_range outputs() const
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
WhileStmt(const ASTContext &C, VarDecl *Var, Expr *cond, Stmt *body, SourceLocation WL)
SourceLocation getLocStart() const LLVM_READONLY
LabelStmt(SourceLocation IL, LabelDecl *D, Stmt *substmt)
CharacterLiteralBitfields CharacterLiteralBits
const Expr * getRHS() const
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation getCaseLoc() const
Token - This structure provides full information about a lexed token.
ObjCIndirectCopyRestoreExprBitfields ObjCIndirectCopyRestoreExprBits
void setCapturedDecl(CapturedDecl *D)
Set the outlined function declaration.
void setReturnLoc(SourceLocation L)
MSAsmStmt(EmptyShell Empty)
Build an empty MS-style inline-assembly statement.
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getLBracLoc() const
SourceLocation getLBraceLoc() const
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)
Expr * getFilterExpr() const
void addSwitchCase(SwitchCase *SC)
SourceLocation getWhileLoc() const
const VarDecl * getNRVOCandidate() const
Retrieve the variable that might be used for the named return value optimization. ...
static bool classof(const Stmt *T)
IndirectGotoStmt - This represents an indirect goto.
Describes an C or C++ initializer list.
reference operator*() const
body_const_range body() const
SwitchCase(StmtClass SC, EmptyShell)
IdentifierInfo * getOutputIdentifier(unsigned i) const
GCCAsmStmt(EmptyShell Empty)
Build an empty inline-assembly statement.
ForStmt - This represents a 'for (init;cond;inc)' stmt.
StringRef getOutputConstraint(unsigned i) const
getOutputConstraint - Return the constraint string for the specified output operand.
outputs_iterator begin_outputs()
const_capture_iterator capture_begin() const
const_child_range children() const
const Expr * getCond() const
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getRParenLoc() const
void setEndLoc(SourceLocation L)
DeclStmt(EmptyShell Empty)
Build an empty declaration statement.
StringRef getClobber(unsigned i) const
ArrayRef< StringRef > getClobbers() const
ArrayRef< StringRef > getAllConstraints() const
const_reverse_body_iterator body_rbegin() const
SourceLocation getLocStart() const LLVM_READONLY
Expr * getOutputExpr(unsigned i)
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 DeclStmt * getConditionVariableDeclStmt() const
If this SwitchStmt has a condition variable, return the faux DeclStmt associated with the creation of...
SourceLocation getLocStart() const LLVM_READONLY
const_outputs_iterator end_outputs() const
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
SourceLocation getLocEnd() const LLVM_READONLY
StringLiteral * getClobberStringLiteral(unsigned i)
const_capture_init_iterator capture_init_begin() const
SourceLocation getLocEnd() const LLVM_READONLY
const RecordDecl * getCapturedRecordDecl() const
Retrieve the record declaration for captured variables.
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.
void viewAST() const
viewAST - Visualize an AST rooted at this Stmt* using GraphViz.
detail::InMemoryDirectory::const_iterator I
static SEHTryStmt * Create(const ASTContext &C, bool isCXXTry, SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler)
SourceLocation getSwitchLoc() const
Iterator for iterating over Stmt * arrays that contain only Expr *.
SourceLocation getLocStart() const LLVM_READONLY
llvm::iterator_range< inputs_iterator > inputs_range
StringLiteral * getAsmString()
Const iterator for iterating over Stmt * arrays that contain only Expr *.
void setColonLoc(SourceLocation L)
void setBreakLoc(SourceLocation L)
CompoundStmt - This represents a group of statements like { stmt stmt }.
void dumpPretty(const ASTContext &Context) const
dumpPretty/printPretty - These two methods do a "pretty print" of the AST back to its original source...
SourceLocation getAsmLoc() const
SourceLocation getLocEnd() const LLVM_READONLY
Describes the capture of either a variable, or 'this', or variable-length array type.
const Stmt * getBody() const
StringRef getAsmString() const
Stmt * stripLabelLikeStatements()
SourceLocation getLocStart() const LLVM_READONLY
static bool classof(const Stmt *T)
void setSemiLoc(SourceLocation L)
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getEndLoc() const
SourceLocation getLocStart() const LLVM_READONLY
Stmt * getHandler() const
const Stmt * getBody() const
bool IsVolatile
If true, treat this inline assembly as having side effects.
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
StringRef getInputConstraint(unsigned i) const
getInputConstraint - Return the specified input constraint.
static bool classof(const Stmt *T)
static bool classof(const Stmt *T)
std::string generateAsmString(const ASTContext &C) const
Assemble final IR asm string.
std::string generateAsmString(const ASTContext &C) const
Assemble final IR asm string.
llvm::iterator_range< const_capture_iterator > capture_const_range
SourceLocation getColonLoc() const
void setLeaveLoc(SourceLocation L)
const Expr * getTarget() const
LabelDecl * getDecl() const
void setRParenLoc(SourceLocation L)
IdentifierInfo * getInputIdentifier(unsigned i) const
GotoStmt(LabelDecl *label, SourceLocation GL, SourceLocation LL)
Expr - This represents one expression.
SourceRange getSourceRange() const LLVM_READONLY
const Stmt * getSubStmt() const
void setWhileLoc(SourceLocation L)
const Expr * getInputExpr(unsigned i) const
Represents a character-granular source range.
SourceLocation getLocStart() const LLVM_READONLY
InitListExprBitfields InitListExprBits
static bool classof(const Stmt *T)
bool capturesVariable(const VarDecl *Var) const
True if this variable has been captured.
void setLParenLoc(SourceLocation L)
Stmt * IgnoreContainers(bool IgnoreCaptured=false)
Skip no-op (attributed, compound) container stmts and skip captured stmt at the top, if IgnoreCaptured is true.
const_child_range children() const
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "while" statement, if any.
ConstStmtIterator const_child_iterator
SourceLocation getLocEnd() const LLVM_READONLY
AsmStringPiece - this is part of a decomposed asm string specification (for use with the AnalyzeAsmSt...
const Expr * getInputExpr(unsigned i) const
SourceLocation getGotoLoc() const
LabelDecl * getConstantTarget()
getConstantTarget - Returns the fixed target of this indirect goto, if one exists.
SourceLocation KeywordLoc
void setRetValue(Expr *E)
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
void setColonLoc(SourceLocation L)
ExprIterator outputs_iterator
Expr ** capture_init_iterator
Iterator that walks over the capture initialization arguments.
SwitchCase * NextSwitchCase
ExprWithCleanupsBitfields ExprWithCleanupsBits
static bool classof(const Stmt *T)
SourceLocation getEndLoc() const
bool capturesVariableArrayType() const
Determine whether this capture handles a variable-length array type.
const SwitchCase * getSwitchCaseList() const
CompoundStmtBitfields CompoundStmtBits
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
StringRef getInputName(unsigned i) const
void dump() const
Dumps the specified AST fragment and all subtrees to llvm::errs().
capture_init_range capture_inits()
SourceLocation getLabelLoc() const
SourceLocation getLocEnd() const LLVM_READONLY
llvm::iterator_range< decl_iterator > decl_range
AsmStringPiece(const std::string &S)
ForStmt(EmptyShell Empty)
Build an empty for statement.
StringLiteral * getOutputConstraintLiteral(unsigned i)
ReturnStmt - This represents a return, optionally of an expression: return; return 4;...
SourceLocation getLocation() const
Retrieve the source location at which the variable or 'this' was first used.
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)
SwitchCase * getSwitchCaseList()
const DeclStmt * getConditionVariableDeclStmt() const
If this ForStmt has a condition variable, return the faux DeclStmt associated with the creation of th...
const DeclStmt * getConditionVariableDeclStmt() const
If this IfStmt has a condition variable, return the faux DeclStmt associated with the creation of tha...
Expr * getInputExpr(unsigned i)
Expr * getOutputExpr(unsigned i)
SourceLocation getLocStart() const LLVM_READONLY
static AttributedStmt * Create(const ASTContext &C, SourceLocation Loc, ArrayRef< const Attr * > Attrs, Stmt *SubStmt)
StringRef getInputConstraint(unsigned i) const
getInputConstraint - Return the specified input constraint.
const Expr * getLHS() const
std::reverse_iterator< const_body_iterator > const_reverse_body_iterator
SourceLocation getLocEnd() const LLVM_READONLY
static bool classof(const Stmt *T)
const LabelDecl * getConstantTarget() const
friend class BlockDeclRefExpr
SourceLocation getSemiLoc() const
StmtIterator child_iterator
Child Iterators: All subclasses must implement 'children' to permit easy iteration over the substatem...
SourceLocation getLocEnd() const LLVM_READONLY
llvm::iterator_range< const_body_iterator > body_const_range
static SEHFinallyStmt * Create(const ASTContext &C, SourceLocation FinallyLoc, Stmt *Block)
DoStmt - This represents a 'do/while' stmt.
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
LabelDecl * getLabel() const
const_outputs_iterator begin_outputs() const
ExprIterator inputs_iterator
ArrayRef< Expr * > getAllExprs() const
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
SourceLocation getGotoLoc() const
void setDecl(LabelDecl *D)
const StringLiteral * getAsmString() const
static bool classof(const Stmt *T)
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr...
This captures a statement into a function.
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
SourceLocation getLocEnd() const LLVM_READONLY
void setGotoLoc(SourceLocation L)
CaseStmt(Expr *lhs, Expr *rhs, SourceLocation caseLoc, SourceLocation ellipsisLoc, SourceLocation colonLoc)
Encodes a location in the source.
SourceLocation getLeaveLoc() const
char getModifier() const
getModifier - Get the modifier for this operand, if present.
llvm::iterator_range< child_iterator > child_range
PseudoObjectExprBitfields PseudoObjectExprBits
IfStmtBitfields IfStmtBits
SEHLeaveStmt(EmptyShell Empty)
Build an empty __leave statement.
void setDoLoc(SourceLocation L)
const Expr * getOutputExpr(unsigned i) const
bool isValid() const
Return true if this is a valid SourceLocation object.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
bool isSingleDecl() const
isSingleDecl - This method returns true if this DeclStmt refers to a single Decl. ...
void setLastStmt(Stmt *S)
llvm::iterator_range< const_capture_init_iterator > const_capture_init_range
void setConstexpr(bool C)
SourceLocation getKeywordLoc() const
VariableCaptureKind getCaptureKind() const
Determine the kind of capture.
const Stmt * getInit() const
void setIdentLoc(SourceLocation L)
bool capturesVariableByCopy() const
Determine whether this capture handles a variable by copy.
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical) const
Produce a unique representation of the given statement.
LabelDecl - Represents the declaration of a label.
CompoundStmt * getBlock() const
const Expr * getCond() const
llvm::iterator_range< body_iterator > body_range
reverse_body_iterator body_rend()
const_decl_iterator decl_end() const
SourceLocation getIdentLoc() const
CaseStmt(EmptyShell Empty)
Build an empty switch case statement.
SourceLocation getTryLoc() const
void setAllEnumCasesCovered()
Set a flag in the SwitchStmt indicating that if the 'switch (X)' is a switch over an enum value then ...
MSAsmStmt(const ASTContext &C, SourceLocation asmloc, SourceLocation lbraceloc, bool issimple, bool isvolatile, ArrayRef< Token > asmtoks, unsigned numoutputs, unsigned numinputs, ArrayRef< StringRef > constraints, ArrayRef< Expr * > exprs, StringRef asmstr, ArrayRef< StringRef > clobbers, SourceLocation endloc)
SourceLocation getLocStart() const LLVM_READONLY
CompoundStmt(SourceLocation Loc)
const Expr * getCond() const
const_child_iterator child_begin() const
bool capturesVariable() const
Determine whether this capture handles a variable (by reference).
static bool classof(const Stmt *T)
ConstExprIterator const_outputs_iterator
SourceLocation getEndLoc() const
void setConditionVariable(const ASTContext &C, VarDecl *V)
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>.
decl_iterator decl_begin()
SourceLocation getContinueLoc() const
reverse_decl_iterator decl_rbegin()
SEHLeaveStmt(SourceLocation LL)
CharSourceRange getRange() const
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "switch" statement, if any.
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of captures.
Stmt * getCapturedStmt()
Retrieve the statement being captured.
const_reverse_body_iterator body_rend() const
SEHExceptStmt * getExceptHandler() const
Returns 0 if not defined.
Expr * getInputExpr(unsigned i)
void setCaseLoc(SourceLocation L)
bool isAllEnumCasesCovered() const
Returns true if the SwitchStmt is a switch of an enum value and all cases have been explicitly covere...
StringRef getOutputName(unsigned i) const
const_body_iterator body_begin() const
StringRef getOutputConstraint(unsigned i) const
LabelStmt(EmptyShell Empty)
StringRef getClobber(unsigned i) const
SourceLocation getLocEnd() const LLVM_READONLY
void setCapturedRecordDecl(RecordDecl *D)
Set the record declaration for captured variables.
const Decl * getSingleDecl() const
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
const Expr * getInputExpr(unsigned i) const
const_body_iterator body_end() const
IfStmt(EmptyShell Empty)
Build an empty if/then/else statement.
bool isObjCAvailabilityCheck() const
void setGotoLoc(SourceLocation L)
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "if" statement, if any.
CompoundStmt(const ASTContext &C, ArrayRef< Stmt * > Stmts, SourceLocation LB, SourceLocation RB)
NullStmt - This is the null statement ";": C99 6.8.3p3.
SourceLocation getLocStart() const LLVM_READONLY
llvm::iterator_range< const_outputs_iterator > outputs_const_range
SourceLocation getLocEnd() const LLVM_READONLY
unsigned capture_size() const
Retrieve the number of captures, including 'this'.
SourceLocation getLocEnd() const LLVM_READONLY
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 Stmt * getSubStmt() const
SourceLocation getStarLoc() const
const Stmt * getInit() const
static CapturedStmt * CreateDeserialized(const ASTContext &Context, unsigned NumCaptures)
const Stmt * body_front() const
const Expr * getInc() const
const Stmt * getBody() const
Reads an AST files chain containing the contents of a translation unit.
static bool classof(const Stmt *T)
bool capturesThis() const
Determine whether this capture handles the C++ 'this' pointer.
SourceLocation getLocStart() const LLVM_READONLY
DoStmt(EmptyShell Empty)
Build an empty do-while statement.
SourceLocation getLocEnd() const LLVM_READONLY
const StringLiteral * getClobberStringLiteral(unsigned i) const
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getLocEnd() const LLVM_READONLY
SwitchCase * getNextSwitchCase()
const StringLiteral * getOutputConstraintLiteral(unsigned i) const
static bool classof(const Stmt *T)
SourceLocation getWhileLoc() const
void setEllipsisLoc(SourceLocation L)
SourceLocation getLocEnd() const LLVM_READONLY
detail::InMemoryDirectory::const_iterator E
ReturnStmt(SourceLocation RL, Expr *E, const VarDecl *NRVOCandidate)
static bool classof(const Stmt *T)
BreakStmt(EmptyShell Empty)
Build an empty break statement.
const Expr * getRetValue() const
SourceLocation getLocEnd() const LLVM_READONLY
body_iterator body_begin()
Stmt *const * const_body_iterator
static bool classof(const Stmt *T)
IndirectGotoStmt(SourceLocation gotoLoc, SourceLocation starLoc, Expr *target)
Represents a __leave statement.
const Stmt * getThen() const
SwitchStmt - This represents a 'switch' stmt.
const_capture_init_iterator capture_init_end() const
void setConditionVariable(const ASTContext &C, VarDecl *V)
llvm::iterator_range< const_child_iterator > const_child_range
llvm::iterator_range< const_decl_iterator > decl_const_range
SwitchStmt(const ASTContext &C, Stmt *Init, VarDecl *Var, Expr *cond)
static bool classof(const Stmt *T)
DefaultStmt(EmptyShell Empty)
Build an empty default statement.
reverse_decl_iterator decl_rend()
int getNamedOperand(StringRef SymbolicName) const
getNamedOperand - Given a symbolic operand reference like %[foo], translate this into a numeric value...
StringLiteral * getInputConstraintLiteral(unsigned i)
DeclGroupRef getDeclGroup()
Represents a 'co_await' expression.
TypeTraitExprBitfields TypeTraitExprBits
unsigned getOperandNo() const
void setSwitchLoc(SourceLocation L)
DeclGroupRef::const_iterator const_decl_iterator
static bool classof(const Stmt *T)
SourceLocation getLocEnd() const LLVM_READONLY
unsigned getNumPlusOperands() const
getNumPlusOperands - Return the number of output operands that have a "+" constraint.
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)
ForStmt(const ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar, Expr *Inc, Stmt *Body, SourceLocation FL, SourceLocation LP, SourceLocation RP)
SourceLocation getLocStart() const LLVM_READONLY
StringRef getClobber(unsigned i) const
UnaryExprOrTypeTraitExprBitfields UnaryExprOrTypeTraitExprBits
const DeclStmt * getConditionVariableDeclStmt() const
If this WhileStmt has a condition variable, return the faux DeclStmt associated with the creation of ...
ReturnStmt(SourceLocation RL)
SourceLocation getForLoc() const
const Expr * getCond() const
void setStarLoc(SourceLocation L)
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
GotoStmt - This represents a direct goto.
ArrayRef< const Attr * > getAttrs() const
SourceLocation getColonLoc() const
SourceLocation getAttrLoc() const
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
SwitchStmt(EmptyShell Empty)
Build a empty switch statement.
const std::string & getString() const
static bool classof(const Stmt *T)
const StringLiteral * getInputConstraintLiteral(unsigned i) const
Decl *const * const_iterator
SourceLocation getFinallyLoc() const
Defines the clang::SourceLocation class and associated facilities.
const_inputs_iterator end_inputs() const
ContinueStmt - This represents a continue.
SourceLocation getRParenLoc() const
reverse_body_iterator body_rbegin()
void setLBraceLoc(SourceLocation L)
llvm::iterator_range< const_inputs_iterator > inputs_const_range
void setElseLoc(SourceLocation L)
SourceLocation getBreakLoc() const
ContinueStmt(SourceLocation CL)
SourceLocation getLocStart() const LLVM_READONLY
WhileStmt - This represents a 'while' stmt.
void setIfLoc(SourceLocation L)
SourceLocation getColonLoc() const
const Expr * getCond() const
SourceLocation getElseLoc() const
static bool classof(const Stmt *T)
CompoundStmt(EmptyShell Empty)
void setDefaultLoc(SourceLocation L)
const Stmt * body_back() const
VariableCaptureKind
The different capture forms: by 'this', by reference, capture for variable-length array type etc...
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
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)
StringRef getOutputConstraint(unsigned i) const
getOutputConstraint - Return the constraint string for the specified output operand.
SourceLocation getRBracLoc() const
SourceLocation getLocEnd() const LLVM_READONLY
void setNextSwitchCase(SwitchCase *SC)
A reference to a declared variable, function, enum, etc.
Capture * capture_iterator
An iterator that walks over the captures.
SourceLocation getLocEnd() const LLVM_READONLY
const Stmt * stripLabelLikeStatements() const
Strip off all label-like statements.
SourceLocation getLocStart() const LLVM_READONLY
std::reverse_iterator< decl_iterator > reverse_decl_iterator
void setLabel(LabelDecl *D)
static bool classof(const Stmt *T)
BreakStmt - This represents a break.
const_inputs_iterator begin_inputs() const
const Capture * const_capture_iterator
void setSubStmt(Stmt *SS)
CallExprBitfields CallExprBits
CapturedRegionKind
The different kinds of captured statement.
CastExprBitfields CastExprBits
DeclStmt(DeclGroupRef dg, SourceLocation startLoc, SourceLocation endLoc)
unsigned getNumClobbers() const
SourceLocation getLocStart() const LLVM_READONLY
const_child_iterator child_end() const
A trivial tuple used to represent a source range.
const Stmt * getCapturedStmt() const
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type, member-designator).
CompoundStmt * getTryBlock() const
SourceLocation getStartLoc() const
inputs_const_range inputs() const
const char * getStmtClassName() const
const char * getName() const
Expr *const * const_capture_init_iterator
Const iterator that walks over the capture initialization arguments.
SourceLocation getExceptLoc() const
SourceLocation getLocStart() const LLVM_READONLY
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument.
bool isSingleDecl() const
void setWhileLoc(SourceLocation L)
static SEHExceptStmt * Create(const ASTContext &C, SourceLocation ExceptLoc, Expr *FilterExpr, Stmt *Block)
This class handles loading and caching of source files into memory.
BreakStmt(SourceLocation BL)
void setKeywordLoc(SourceLocation L)
ReturnStmt(EmptyShell Empty)
Build an empty return expression.
void setCapturedRegionKind(CapturedRegionKind Kind)
Set the captured region kind.
SourceLocation getLocEnd() const LLVM_READONLY
void setLabelLoc(SourceLocation L)
ConstExprIterator const_inputs_iterator
void ProcessODRHash(llvm::FoldingSetNodeID &ID, ODRHash &Hash) const
Calculate a unique representation for a statement that is stable across compiler invocations.
static void EnableStatistics()
child_iterator child_end()
SEHFinallyStmt * getFinallyHandler() const
#define BLOCK(DERIVED, BASE)
inputs_iterator end_inputs()