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/Support/Compiler.h"
26 #include "llvm/Support/ErrorHandling.h"
30 class FoldingSetNodeID;
43 struct PrintingPolicy;
61 class ExprIterator :
public std::iterator<std::forward_iterator_tag,
83 const Expr *&, ptrdiff_t,
86 const Stmt *
const *I;
109 class LLVM_ALIGNAS(LLVM_PTR_SIZE)
Stmt {
113 #define STMT(CLASS, PARENT) CLASS##Class,
114 #define STMT_RANGE(BASE, FIRST, LAST) \
115 first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class,
116 #define LAST_STMT_RANGE(BASE, FIRST, LAST) \
117 first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class
118 #define ABSTRACT_STMT(STMT)
119 #include "clang/AST/StmtNodes.inc"
124 void*
operator new(
size_t bytes)
throw() {
125 llvm_unreachable(
"Stmts cannot be allocated with regular 'new'.");
127 void operator delete(
void* data)
throw() {
128 llvm_unreachable(
"Stmts cannot be released with regular 'delete'.");
131 class StmtBitfields {
137 enum { NumStmtBits = 8 };
139 class CompoundStmtBitfields {
141 unsigned : NumStmtBits;
143 unsigned NumStmts : 32 - NumStmtBits;
146 class ExprBitfields {
151 friend class BlockDeclRefExpr;
168 unsigned : NumStmtBits;
170 unsigned ValueKind : 2;
171 unsigned ObjectKind : 2;
172 unsigned TypeDependent : 1;
173 unsigned ValueDependent : 1;
174 unsigned InstantiationDependent : 1;
175 unsigned ContainsUnexpandedParameterPack : 1;
177 enum { NumExprBits = 16 };
179 class CharacterLiteralBitfields {
181 unsigned : NumExprBits;
186 enum APFloatSemantics {
195 class FloatingLiteralBitfields {
197 unsigned : NumExprBits;
199 unsigned Semantics : 3;
200 unsigned IsExact : 1;
203 class UnaryExprOrTypeTraitExprBitfields {
205 unsigned : NumExprBits;
211 class DeclRefExprBitfields {
214 unsigned : NumExprBits;
216 unsigned HasQualifier : 1;
217 unsigned HasTemplateKWAndArgsInfo : 1;
218 unsigned HasFoundDecl : 1;
219 unsigned HadMultipleCandidates : 1;
220 unsigned RefersToEnclosingVariableOrCapture : 1;
223 class CastExprBitfields {
225 unsigned : NumExprBits;
228 unsigned BasePathSize : 32 - 6 - NumExprBits;
231 class CallExprBitfields {
233 unsigned : NumExprBits;
235 unsigned NumPreArgs : 1;
238 class ExprWithCleanupsBitfields {
242 unsigned : NumExprBits;
244 unsigned NumObjects : 32 - NumExprBits;
247 class PseudoObjectExprBitfields {
251 unsigned : NumExprBits;
255 unsigned NumSubExprs : 8;
256 unsigned ResultIndex : 32 - 8 - NumExprBits;
259 class ObjCIndirectCopyRestoreExprBitfields {
261 unsigned : NumExprBits;
263 unsigned ShouldCopy : 1;
266 class InitListExprBitfields {
269 unsigned : NumExprBits;
273 unsigned HadArrayRangeDesignator : 1;
276 class TypeTraitExprBitfields {
281 unsigned : NumExprBits;
291 unsigned NumArgs : 32 - 8 - 1 - NumExprBits;
295 StmtBitfields StmtBits;
296 CompoundStmtBitfields CompoundStmtBits;
297 ExprBitfields ExprBits;
298 CharacterLiteralBitfields CharacterLiteralBits;
299 FloatingLiteralBitfields FloatingLiteralBits;
300 UnaryExprOrTypeTraitExprBitfields UnaryExprOrTypeTraitExprBits;
301 DeclRefExprBitfields DeclRefExprBits;
302 CastExprBitfields CastExprBits;
303 CallExprBitfields CallExprBits;
304 ExprWithCleanupsBitfields ExprWithCleanupsBits;
305 PseudoObjectExprBitfields PseudoObjectExprBits;
306 ObjCIndirectCopyRestoreExprBitfields ObjCIndirectCopyRestoreExprBits;
307 InitListExprBitfields InitListExprBits;
308 TypeTraitExprBitfields TypeTraitExprBits;
318 unsigned alignment = 8);
321 unsigned alignment = 8) {
322 return operator new(
bytes, *
C, alignment);
325 void*
operator new(
size_t bytes,
void* mem)
throw() {
331 void operator delete(
void*,
size_t)
throw() { }
332 void operator delete(
void*,
void*)
throw() { }
338 struct EmptyShell { };
342 static bool StatisticsEnabled;
346 explicit Stmt(StmtClass SC, EmptyShell) :
Stmt(SC) {}
350 static_assert(
sizeof(*
this) % llvm::AlignOf<void *>::Alignment == 0,
351 "Insufficient alignment!");
352 StmtBits.sClass = SC;
353 if (StatisticsEnabled) Stmt::addStmtClass(SC);
356 StmtClass getStmtClass()
const {
357 return static_cast<StmtClass
>(StmtBits.sClass);
359 const char *getStmtClassName()
const;
369 static void addStmtClass(
const StmtClass s);
370 static void EnableStatistics();
371 static void PrintStats();
378 void dump(raw_ostream &OS)
const;
381 void dumpColor()
const;
388 unsigned Indentation = 0)
const;
392 void viewAST()
const;
396 Stmt *IgnoreImplicit();
400 Stmt *IgnoreContainers(
bool IgnoreCaptured =
false);
402 const Stmt *stripLabelLikeStatements()
const;
403 Stmt *stripLabelLikeStatements() {
404 return const_cast<Stmt*
>(
405 const_cast<const Stmt*
>(
this)->stripLabelLikeStatements());
418 const_child_range
children()
const {
422 child_iterator child_begin() {
return children().first; }
423 child_iterator child_end() {
return children().second; }
425 const_child_iterator child_begin()
const {
return children().first; }
426 const_child_iterator child_end()
const {
return children().second; }
440 void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
441 bool Canonical)
const;
456 StartLoc(startLoc), EndLoc(endLoc) {}
464 return DG.isSingleDecl();
483 return T->getStmtClass() == DeclStmtClass;
488 return child_range(child_iterator(DG.begin(), DG.end()),
489 child_iterator(DG.end(), DG.end()));
525 bool HasLeadingEmptyMacro;
528 :
Stmt(NullStmtClass), SemiLoc(L),
529 HasLeadingEmptyMacro(hasLeadingEmptyMacro) {}
533 HasLeadingEmptyMacro(
false) { }
544 return T->getStmtClass() == NullStmtClass;
567 :
Stmt(CompoundStmtClass), Body(nullptr), LBraceLoc(Loc), RBraceLoc(Loc) {
568 CompoundStmtBits.NumStmts = 0;
573 :
Stmt(CompoundStmtClass, Empty), Body(nullptr) {
574 CompoundStmtBits.NumStmts = 0;
579 bool body_empty()
const {
return CompoundStmtBits.NumStmts == 0; }
580 unsigned size()
const {
return CompoundStmtBits.NumStmts; }
592 assert(!body_empty() &&
"setLastStmt");
605 return !body_empty() ? Body[0] :
nullptr;
608 return !body_empty() ? Body[size() - 1] :
nullptr;
619 typedef std::reverse_iterator<const_body_iterator>
637 return T->getStmtClass() == CompoundStmtClass;
642 return child_range(Body, Body + CompoundStmtBits.NumStmts);
646 return child_range(Body, Body + CompoundStmtBits.NumStmts);
660 :
Stmt(SC), NextSwitchCase(nullptr), KeywordLoc(KWLoc), ColonLoc(ColonLoc) {
664 :
Stmt(SC), NextSwitchCase(nullptr) {}
680 return const_cast<SwitchCase*
>(
this)->getSubStmt();
687 return T->getStmtClass() == CaseStmtClass ||
688 T->getStmtClass() == DefaultStmtClass;
694 enum { LHS, RHS, SUBSTMT, END_EXPR };
695 Stmt* SubExprs[END_EXPR];
700 :
SwitchCase(CaseStmtClass, caseLoc, colonLoc) {
701 SubExprs[SUBSTMT] =
nullptr;
702 SubExprs[LHS] =
reinterpret_cast<Stmt*
>(lhs);
703 SubExprs[RHS] =
reinterpret_cast<Stmt*
>(rhs);
704 EllipsisLoc = ellipsisLoc;
722 return reinterpret_cast<const Expr*
>(SubExprs[LHS]);
725 return reinterpret_cast<const Expr*
>(SubExprs[RHS]);
744 return T->getStmtClass() == CaseStmtClass;
749 return child_range(&SubExprs[0], &SubExprs[END_EXPR]);
757 SwitchCase(DefaultStmtClass, DL, CL), SubStmt(substmt) {}
776 return T->getStmtClass() == DefaultStmtClass;
780 child_range
children() {
return child_range(&SubStmt, &SubStmt+1); }
784 if (
const CaseStmt *CS = dyn_cast<CaseStmt>(
this))
785 return CS->getLocEnd();
786 return cast<DefaultStmt>(
this)->getLocEnd();
799 :
Stmt(LabelStmtClass), IdentLoc(IL), TheDecl(D), SubStmt(substmt) {
802 "LabelStmt too big");
811 const char *getName()
const;
820 child_range
children() {
return child_range(&SubStmt, &SubStmt+1); }
823 return T->getStmtClass() == LabelStmtClass;
841 :
Stmt(AttributedStmtClass), SubStmt(SubStmt), AttrLoc(Loc),
842 NumAttrs(Attrs.size()) {
843 memcpy(getAttrArrayPtr(), Attrs.data(), Attrs.size() *
sizeof(
Attr *));
847 :
Stmt(AttributedStmtClass, Empty), NumAttrs(NumAttrs) {
848 memset(getAttrArrayPtr(), 0, NumAttrs *
sizeof(
Attr *));
851 Attr *
const *getAttrArrayPtr()
const {
852 return reinterpret_cast<Attr *
const *
>(
this + 1);
854 Attr **getAttrArrayPtr() {
return reinterpret_cast<Attr **
>(
this + 1); }
857 static AttributedStmt *
Create(
const ASTContext &
C, SourceLocation Loc,
858 ArrayRef<const Attr*> Attrs,
Stmt *SubStmt);
860 static AttributedStmt *
CreateEmpty(
const ASTContext &
C,
unsigned NumAttrs);
864 return llvm::makeArrayRef(getAttrArrayPtr(), NumAttrs);
872 child_range
children() {
return child_range(&SubStmt, &SubStmt + 1); }
875 return T->getStmtClass() == AttributedStmtClass;
883 enum { VAR, COND, THEN, ELSE, END_EXPR };
884 Stmt* SubExprs[END_EXPR];
892 Stmt *elsev =
nullptr);
895 explicit IfStmt(EmptyShell Empty) :
Stmt(IfStmtClass, Empty) { }
905 VarDecl *getConditionVariable()
const;
911 return reinterpret_cast<DeclStmt*
>(SubExprs[VAR]);
933 return SubExprs[ELSE]->getLocEnd();
935 return SubExprs[THEN]->getLocEnd();
941 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
945 return T->getStmtClass() == IfStmtClass;
953 enum { VAR, COND, BODY, END_EXPR };
954 Stmt* SubExprs[END_EXPR];
959 llvm::PointerIntPair<SwitchCase *, 1, bool> FirstCase;
976 VarDecl *getConditionVariable()
const;
982 return reinterpret_cast<DeclStmt*
>(SubExprs[VAR]);
1007 &&
"case/default already added to a switch");
1009 FirstCase.setPointer(SC);
1022 return SubExprs[BODY] ? SubExprs[BODY]->getLocEnd() : SubExprs[COND]->getLocEnd();
1027 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1031 return T->getStmtClass() == SwitchStmtClass;
1040 enum { VAR, COND, BODY, END_EXPR };
1041 Stmt* SubExprs[END_EXPR];
1057 VarDecl *getConditionVariable()
const;
1063 return reinterpret_cast<DeclStmt*
>(SubExprs[VAR]);
1078 return SubExprs[BODY]->getLocEnd();
1082 return T->getStmtClass() == WhileStmtClass;
1087 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1095 enum { BODY, COND, END_EXPR };
1096 Stmt* SubExprs[END_EXPR];
1103 :
Stmt(DoStmtClass), DoLoc(DL), WhileLoc(WL), RParenLoc(RP) {
1104 SubExprs[COND] =
reinterpret_cast<Stmt*
>(cond);
1105 SubExprs[BODY] = body;
1130 return T->getStmtClass() == DoStmtClass;
1135 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1146 enum { INIT, CONDVAR, COND, INC, BODY, END_EXPR };
1147 Stmt* SubExprs[END_EXPR];
1168 VarDecl *getConditionVariable()
const;
1174 return reinterpret_cast<DeclStmt*
>(SubExprs[CONDVAR]);
1200 return SubExprs[BODY]->getLocEnd();
1204 return T->getStmtClass() == ForStmtClass;
1209 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1221 :
Stmt(GotoStmtClass), Label(label), GotoLoc(GL), LabelLoc(LL) {}
1238 return T->getStmtClass() == GotoStmtClass;
1254 :
Stmt(IndirectGotoStmtClass), GotoLoc(gotoLoc), StarLoc(starLoc),
1255 Target((
Stmt*)target) {}
1259 :
Stmt(IndirectGotoStmtClass, Empty) { }
1281 return T->getStmtClass() == IndirectGotoStmtClass;
1285 child_range
children() {
return child_range(&Target, &Target+1); }
1306 return T->getStmtClass() == ContinueStmtClass;
1321 "BreakStmt too large");
1334 return T->getStmtClass() == BreakStmtClass;
1360 :
Stmt(ReturnStmtClass), RetLoc(RL), RetExpr((
Stmt *)E),
1361 NRVOCandidate(NRVOCandidate) {}
1366 const Expr *getRetValue()
const;
1367 Expr *getRetValue();
1383 return RetExpr ? RetExpr->getLocEnd() : RetLoc;
1387 return T->getStmtClass() == ReturnStmtClass;
1392 if (RetExpr)
return child_range(&RetExpr, &RetExpr+1);
1393 return child_range();
1417 unsigned numoutputs,
unsigned numinputs,
unsigned numclobbers) :
1418 Stmt (SC), AsmLoc(asmloc), IsSimple(issimple), IsVolatile(isvolatile),
1419 NumOutputs(numoutputs), NumInputs(numinputs), NumClobbers(numclobbers) { }
1425 explicit AsmStmt(StmtClass SC, EmptyShell Empty) :
1426 Stmt(SC, Empty), Exprs(nullptr) { }
1443 std::string generateAsmString(
const ASTContext &
C)
const;
1452 StringRef getOutputConstraint(
unsigned i)
const;
1458 return getOutputConstraint(i)[0] ==
'+';
1461 const Expr *getOutputExpr(
unsigned i)
const;
1465 unsigned getNumPlusOperands()
const;
1473 StringRef getInputConstraint(
unsigned i)
const;
1475 const Expr *getInputExpr(
unsigned i)
const;
1480 StringRef getClobber(
unsigned i)
const;
1483 return T->getStmtClass() == GCCAsmStmtClass ||
1484 T->getStmtClass() == MSAsmStmtClass;
1495 return &Exprs[0] + NumOutputs;
1499 return &Exprs[0] + NumOutputs + NumInputs;
1505 return &Exprs[0] + NumOutputs;
1509 return &Exprs[0] + NumOutputs + NumInputs;
1527 return &Exprs[0] + NumOutputs;
1537 return &Exprs[0] + NumOutputs;
1544 return child_range(&Exprs[0], &Exprs[0] + NumOutputs + NumInputs);
1563 bool isvolatile,
unsigned numoutputs,
unsigned numinputs,
1570 Constraints(nullptr), Clobbers(nullptr), Names(nullptr) { }
1601 : MyKind(Operand), Str(S), OperandNo(OpNo),
1613 assert(isOperand());
1618 assert(isOperand() &&
"Range is currently used only for Operands.");
1624 char getModifier()
const;
1636 std::string generateAsmString(
const ASTContext &
C)
const;
1646 return II->getName();
1651 StringRef getOutputConstraint(
unsigned i)
const;
1654 return Constraints[i];
1657 return Constraints[i];
1660 Expr *getOutputExpr(
unsigned i);
1663 return const_cast<GCCAsmStmt*
>(
this)->getOutputExpr(i);
1669 return Names[i + NumOutputs];
1674 return II->getName();
1679 StringRef getInputConstraint(
unsigned i)
const;
1682 return Constraints[i + NumOutputs];
1685 return Constraints[i + NumOutputs];
1688 Expr *getInputExpr(
unsigned i);
1689 void setInputExpr(
unsigned i,
Expr *E);
1692 return const_cast<GCCAsmStmt*
>(
this)->getInputExpr(i);
1696 void setOutputsAndInputsAndClobbers(
const ASTContext &
C,
1700 unsigned NumOutputs,
1703 unsigned NumClobbers);
1711 int getNamedOperand(StringRef SymbolicName)
const;
1713 StringRef getClobber(
unsigned i)
const;
1723 return T->getStmtClass() == GCCAsmStmtClass;
1733 unsigned NumAsmToks;
1736 StringRef *Constraints;
1737 StringRef *Clobbers;
1751 NumAsmToks(0), AsmToks(nullptr), Constraints(nullptr), Clobbers(nullptr) { }
1767 std::string generateAsmString(
const ASTContext &
C)
const;
1772 assert(i < NumOutputs);
1773 return Constraints[i];
1776 Expr *getOutputExpr(
unsigned i);
1779 return const_cast<MSAsmStmt*
>(
this)->getOutputExpr(i);
1785 assert(i < NumInputs);
1786 return Constraints[i + NumOutputs];
1789 Expr *getInputExpr(
unsigned i);
1790 void setInputExpr(
unsigned i,
Expr *E);
1793 return const_cast<MSAsmStmt*
>(
this)->getInputExpr(i);
1799 return llvm::makeArrayRef(Constraints, NumInputs + NumOutputs);
1802 return llvm::makeArrayRef(Clobbers, NumClobbers);
1805 return llvm::makeArrayRef(reinterpret_cast<Expr**>(Exprs),
1806 NumInputs + NumOutputs);
1809 StringRef
getClobber(
unsigned i)
const {
return getClobbers()[i]; }
1812 void initialize(
const ASTContext &
C, StringRef AsmString,
1821 return T->getStmtClass() == MSAsmStmtClass;
1825 return child_range(&Exprs[0], &Exprs[NumInputs + NumOutputs]);
1833 enum { FILTER_EXPR,
BLOCK };
1856 return reinterpret_cast<Expr*
>(Children[FILTER_EXPR]);
1860 return cast<CompoundStmt>(Children[
BLOCK]);
1864 return child_range(Children,Children+2);
1868 return T->getStmtClass() == SEHExceptStmtClass;
1898 return child_range(&Block,&Block+1);
1902 return T->getStmtClass() == SEHFinallyStmtClass;
1912 enum { TRY = 0, HANDLER = 1 };
1937 return cast<CompoundStmt>(Children[TRY]);
1947 return child_range(Children,Children+2);
1951 return T->getStmtClass() == SEHTryStmtClass;
1961 :
Stmt(SEHLeaveStmtClass), LeaveLoc(LL) {}
1973 return T->getStmtClass() == SEHLeaveStmtClass;
2002 llvm::PointerIntPair<VarDecl *, 2, VariableCaptureKind> VarAndKind;
2016 : VarAndKind(Var, Kind), Loc(Loc) {
2019 assert(!Var &&
"'this' capture cannot have a variable!");
2022 assert(Var &&
"capturing by reference must have a variable!");
2026 "Variable-length array type capture cannot have a variable!");
2047 return getCaptureKind() == VCK_VLAType;
2054 assert(capturesVariable() &&
2055 "No variable available for 'this' or VAT capture");
2056 return VarAndKind.getPointer();
2063 unsigned NumCaptures;
2067 llvm::PointerIntPair<CapturedDecl *, 1, CapturedRegionKind> CapDeclAndKind;
2079 Stmt **getStoredStmts()
const {
2083 Capture *getStoredCaptures()
const;
2085 void setCapturedStmt(
Stmt *
S) { getStoredStmts()[NumCaptures] =
S; }
2090 ArrayRef<Capture> Captures,
2091 ArrayRef<Expr *> CaptureInits,
2092 CapturedDecl *CD, RecordDecl *RD);
2094 static CapturedStmt *CreateDeserialized(
const ASTContext &
Context,
2095 unsigned NumCaptures);
2100 return const_cast<CapturedStmt *
>(
this)->getCapturedStmt();
2106 return const_cast<CapturedStmt *
>(
this)->getCapturedDecl();
2111 assert(D &&
"null CapturedDecl");
2112 CapDeclAndKind.setPointer(D);
2117 return CapDeclAndKind.getInt();
2122 CapDeclAndKind.setInt(Kind);
2130 assert(D &&
"null RecordDecl");
2135 bool capturesVariable(
const VarDecl *Var)
const;
2157 return getStoredCaptures() + NumCaptures;
2173 return reinterpret_cast<Expr **
>(getStoredStmts());
2179 return capture_init_begin() + NumCaptures;
2183 return getCapturedStmt()->getLocStart();
2186 return getCapturedStmt()->getLocEnd();
2189 return getCapturedStmt()->getSourceRange();
2193 return T->getStmtClass() == CapturedStmtClass;
GotoStmt(EmptyShell Empty)
Build an empty goto statement.
DoStmt(Stmt *body, Expr *cond, SourceLocation DL, SourceLocation WL, SourceLocation RP)
static bool classof(const Stmt *T)
const SwitchCase * getNextSwitchCase() const
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
decl_const_range decls() const
unsigned getNumOutputs() const
const DeclGroupRef getDeclGroup() const
bool operator==(const ExprIterator &R) const
const Stmt * getSubStmt() const
void setCapturedDecl(CapturedDecl *D)
Set the outlined function declaration.
SourceLocation getLocEnd() const LLVM_READONLY
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
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.
llvm::iterator_range< outputs_iterator > outputs_range
AsmStmt(StmtClass SC, EmptyShell Empty)
Build an empty inline-assembly statement.
SourceLocation getLocStart() const LLVM_READONLY
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)
void setDeclGroup(DeclGroupRef DGR)
DeclGroupRef::iterator decl_iterator
NullStmt(EmptyShell Empty)
Build an empty null statement.
Represents an attribute applied to a statement.
capture_init_range capture_inits() const
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation getIfLoc() const
Represents a call to a C++ constructor.
void setSwitchCaseList(SwitchCase *SC)
Set the case list for this switch statement.
const Stmt * getElse() const
NullStmt(SourceLocation L, bool hasLeadingEmptyMacro=false)
void setStartLoc(SourceLocation L)
void setForLoc(SourceLocation L)
SourceLocation getLocStart() const LLVM_READONLY
const Stmt * getBody() const
SourceLocation getEndLoc() const
WhileStmt(EmptyShell Empty)
Build an empty while statement.
CompoundStmt * getBlock() const
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getReturnLoc() const
static bool classof(const Stmt *T)
StringRef getInputConstraint(unsigned i) const
void setAsmLoc(SourceLocation L)
llvm::iterator_range< capture_init_iterator > capture_init_range
SourceLocation getDoLoc() const
SourceLocation getRParenLoc() 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)
const Stmt * getSubStmt() const
const Expr * getOutputExpr(unsigned i) const
SourceLocation getDefaultLoc() const
SourceLocation getEllipsisLoc() const
ConstExprIterator operator-(size_t i) const
void setBody(Stmt *S, SourceLocation SL)
SourceLocation getLocStart() const LLVM_READONLY
static bool classof(const Stmt *T)
bool operator==(const ConstExprIterator &R) const
bool isOutputPlusConstraint(unsigned i) const
Represents a C99 designated initializer expression.
inputs_iterator begin_inputs()
const_decl_iterator decl_begin() const
const Expr * operator*() const
unsigned getNumInputs() const
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
SourceLocation getLocStart() const LLVM_READONLY
LabelStmt(SourceLocation IL, LabelDecl *D, Stmt *substmt)
const Expr * getRHS() const
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation getCaseLoc() const
bool operator!=(const ExprIterator &R) const
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)
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)
Describes an C or C++ initializer list.
body_const_range body() const
SwitchCase(StmtClass SC, EmptyShell)
IdentifierInfo * getOutputIdentifier(unsigned i) const
GCCAsmStmt(EmptyShell Empty)
Build an empty inline-assembly statement.
outputs_iterator begin_outputs()
Expr * operator[](size_t idx)
const_capture_iterator capture_begin() const
const_child_range children() const
const Expr * getCond() const
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
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.
ArrayRef< StringRef > getClobbers() const
ArrayRef< StringRef > getAllConstraints() const
const_reverse_body_iterator body_rbegin() const
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getLocStart() const LLVM_READONLY
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > IL, Expr *Step, Expr *CalcStep)
Creates clause with a list of variables VL and a linear step Step.
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
SourceLocation getLocStart() const LLVM_READONLY
const_outputs_iterator end_outputs() const
VariableCaptureKind getCaptureKind() const
Determine the kind of capture.
SourceLocation getLocEnd() const LLVM_READONLY
StringLiteral * getClobberStringLiteral(unsigned i)
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.
SourceLocation getSwitchLoc() const
SourceLocation getLocStart() const LLVM_READONLY
llvm::iterator_range< inputs_iterator > inputs_range
StringLiteral * getAsmString()
void setColonLoc(SourceLocation L)
void setBreakLoc(SourceLocation L)
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
SourceLocation getLocStart() const LLVM_READONLY
static bool classof(const Stmt *T)
void setSemiLoc(SourceLocation L)
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. This assembly statement should not be opt...
static bool classof(const Stmt *T)
static bool classof(const Stmt *T)
llvm::iterator_range< const_capture_iterator > capture_const_range
ID
Defines the set of possible language-specific address spaces.
SourceLocation getColonLoc() const
void setLeaveLoc(SourceLocation L)
const Expr * getTarget() const
ConstExprIterator & operator++()
LabelDecl * getDecl() const
void setRParenLoc(SourceLocation L)
ConstExprIterator operator+(size_t i) const
IdentifierInfo * getInputIdentifier(unsigned i) const
GotoStmt(LabelDecl *label, SourceLocation GL, SourceLocation LL)
SourceRange getSourceRange() const LLVM_READONLY
const Stmt * getSubStmt() const
void setWhileLoc(SourceLocation L)
Represents a character-granular source range.
SourceLocation getLocStart() const LLVM_READONLY
static bool classof(const Stmt *T)
void setLParenLoc(SourceLocation L)
ExprIterator operator-(size_t i)
SourceLocation getLocEnd() const LLVM_READONLY
const Expr * getInputExpr(unsigned i) const
SourceLocation getGotoLoc() const
SourceLocation KeywordLoc
void setRetValue(Expr *E)
void setColonLoc(SourceLocation L)
ExprIterator outputs_iterator
Expr ** capture_init_iterator
Iterator that walks over the capture initialization arguments.
SwitchCase * NextSwitchCase
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
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
StringRef getInputName(unsigned i) const
SourceLocation getLabelLoc() const
SourceLocation getLocEnd() const LLVM_READONLY
llvm::iterator_range< decl_iterator > decl_range
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.
StringLiteral * getOutputConstraintLiteral(unsigned i)
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.
void setColonLoc(SourceLocation L)
SwitchCase * getSwitchCaseList()
const DeclStmt * getConditionVariableDeclStmt() const
const DeclStmt * getConditionVariableDeclStmt() const
signed operator-(const ConstExprIterator &R) const
SourceLocation getLocStart() const LLVM_READONLY
const Expr * getLHS() const
bool operator>=(const ExprIterator &R) 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
SourceLocation getSemiLoc() const
SourceLocation getLocEnd() const LLVM_READONLY
const Expr * operator->() const
llvm::iterator_range< const_body_iterator > body_const_range
LabelDecl * getLabel() const
const_outputs_iterator begin_outputs() const
ExprIterator inputs_iterator
ArrayRef< Expr * > getAllExprs() const
SourceLocation getGotoLoc() const
const CapturedDecl * getCapturedDecl() const
Capture(SourceLocation Loc, VariableCaptureKind Kind, VarDecl *Var=nullptr)
Create a new capture.
void setDecl(LabelDecl *D)
const StringLiteral * getAsmString() const
static bool classof(const Stmt *T)
bool operator>(const ConstExprIterator &R) const
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr...
This captures a statement into a function. For example, the following pragma annotated compound state...
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. The SourceManager can decode this to get at the full include stack...
SourceLocation getLeaveLoc() const
SEHLeaveStmt(EmptyShell Empty)
Build an empty __leave statement.
void setDoLoc(SourceLocation L)
const Expr * getOutputExpr(unsigned i) const
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
bool isSingleDecl() const
void setLastStmt(Stmt *S)
capture_init_iterator capture_init_end() const
Retrieve the iterator pointing one past the last initialization argument.
SourceLocation getKeywordLoc() const
const Stmt * getInit() const
void setIdentLoc(SourceLocation L)
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
ConstExprIterator(const Stmt *const *i)
SourceLocation getIdentLoc() const
CaseStmt(EmptyShell Empty)
Build an empty switch case statement.
SourceLocation getTryLoc() const
void setAllEnumCasesCovered()
SourceLocation getLocStart() const LLVM_READONLY
CompoundStmt(SourceLocation Loc)
const Expr * getCond() const
bool operator>=(const ConstExprIterator &R) const
bool capturesVariable() const
Determine whether this capture handles a variable.
static bool classof(const Stmt *T)
ConstExprIterator const_outputs_iterator
SourceLocation getEndLoc() const
decl_iterator decl_begin()
SourceLocation getContinueLoc() const
reverse_decl_iterator decl_rbegin()
SEHLeaveStmt(SourceLocation LL)
CharSourceRange getRange() const
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
void setCaseLoc(SourceLocation L)
Expr * operator->() const
bool isAllEnumCasesCovered() const
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.
ExprIterator operator+(size_t i)
const Decl * getSingleDecl() const
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.
void setGotoLoc(SourceLocation L)
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
const Stmt * getSubStmt() const
SourceLocation getStarLoc() const
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.
bool capturesThis() const
Determine whether this capture handles the C++ 'this' pointer.
SourceLocation getLocStart() const LLVM_READONLY
ExprIterator & operator++()
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
bool operator>(const ExprIterator &R) const
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
ReturnStmt(SourceLocation RL, Expr *E, const VarDecl *NRVOCandidate)
static bool classof(const Stmt *T)
BreakStmt(EmptyShell Empty)
Build an empty break statement.
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)
const Stmt * getThen() const
static bool classof(const OMPClause *T)
llvm::iterator_range< const_decl_iterator > decl_const_range
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()
unsigned getOperandNo() const
void setSwitchLoc(SourceLocation L)
DeclGroupRef::const_iterator const_decl_iterator
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
const DeclStmt * getConditionVariableDeclStmt() const
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...
ArrayRef< const Attr * > getAttrs() const
SourceLocation getColonLoc() const
SourceLocation getAttrLoc() const
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.
bool operator!=(const ConstExprIterator &R) const
const_inputs_iterator end_inputs() const
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
void setIfLoc(SourceLocation L)
SourceLocation getColonLoc() const
const Expr * getCond() const
CapturedRegionKind getCapturedRegionKind() const
Retrieve the captured region kind.
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...
const Expr * operator[](size_t idx) const
void setCapturedRegionKind(CapturedRegionKind Kind)
Set the captured region kind.
static bool classof(const Stmt *T)
capture_init_iterator capture_init_begin() const
Retrieve the first initialization argument.
void setRParenLoc(SourceLocation L)
SourceLocation getRBracLoc() const
SourceLocation getLocEnd() const LLVM_READONLY
void setNextSwitchCase(SwitchCase *SC)
signed operator-(const ExprIterator &R) const
A reference to a declared variable, function, enum, etc. [C99 6.5.1p2].
Capture * capture_iterator
An iterator that walks over the captures.
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getLocStart() const LLVM_READONLY
std::reverse_iterator< decl_iterator > reverse_decl_iterator
void setLabel(LabelDecl *D)
static bool classof(const Stmt *T)
const_inputs_iterator begin_inputs() const
const Capture * const_capture_iterator
void setSubStmt(Stmt *SS)
CapturedRegionKind
The different kinds of captured statement.
DeclStmt(DeclGroupRef dg, SourceLocation startLoc, SourceLocation endLoc)
unsigned getNumClobbers() const
SourceLocation getLocStart() const LLVM_READONLY
A trivial tuple used to represent a source range.
const Stmt * getCapturedStmt() const
CompoundStmt * getTryBlock() const
VarDecl * getCapturedVar() const
Retrieve the declaration of the variable being captured.
SourceLocation getStartLoc() const
inputs_const_range inputs() const
SourceLocation getExceptLoc() const
SourceLocation ColonLoc
Location of ':'.
void setWhileLoc(SourceLocation L)
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.
Attr - This represents one attribute.
SourceLocation getLocEnd() const LLVM_READONLY
void setLabelLoc(SourceLocation L)
ConstExprIterator const_inputs_iterator
#define BLOCK(DERIVED, BASE)
inputs_iterator end_inputs()