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;
44 struct PrintingPolicy;
59 class LLVM_ALIGNAS(LLVM_PTR_SIZE)
Stmt {
63 #define STMT(CLASS, PARENT) CLASS##Class,
64 #define STMT_RANGE(BASE, FIRST, LAST) \
65 first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class,
66 #define LAST_STMT_RANGE(BASE, FIRST, LAST) \
67 first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class
68 #define ABSTRACT_STMT(STMT)
69 #include "clang/AST/StmtNodes.inc"
74 void *
operator new(
size_t bytes) LLVM_NOEXCEPT {
75 llvm_unreachable(
"Stmts cannot be allocated with regular 'new'.");
77 void operator delete(
void *data) LLVM_NOEXCEPT {
78 llvm_unreachable(
"Stmts cannot be released with regular 'delete'.");
87 enum { NumStmtBits = 8 };
89 class CompoundStmtBitfields {
91 unsigned : NumStmtBits;
93 unsigned NumStmts : 32 - NumStmtBits;
96 class IfStmtBitfields {
98 unsigned : NumStmtBits;
100 unsigned IsConstexpr : 1;
103 class ExprBitfields {
108 friend class BlockDeclRefExpr;
126 unsigned : NumStmtBits;
128 unsigned ValueKind : 2;
129 unsigned ObjectKind : 2;
130 unsigned TypeDependent : 1;
131 unsigned ValueDependent : 1;
132 unsigned InstantiationDependent : 1;
133 unsigned ContainsUnexpandedParameterPack : 1;
135 enum { NumExprBits = 16 };
137 class CharacterLiteralBitfields {
139 unsigned : NumExprBits;
144 enum APFloatSemantics {
153 class FloatingLiteralBitfields {
155 unsigned : NumExprBits;
157 unsigned Semantics : 3;
158 unsigned IsExact : 1;
161 class UnaryExprOrTypeTraitExprBitfields {
163 unsigned : NumExprBits;
169 class DeclRefExprBitfields {
172 unsigned : NumExprBits;
174 unsigned HasQualifier : 1;
175 unsigned HasTemplateKWAndArgsInfo : 1;
176 unsigned HasFoundDecl : 1;
177 unsigned HadMultipleCandidates : 1;
178 unsigned RefersToEnclosingVariableOrCapture : 1;
181 class CastExprBitfields {
183 unsigned : NumExprBits;
186 unsigned BasePathSize : 32 - 6 - NumExprBits;
189 class CallExprBitfields {
191 unsigned : NumExprBits;
193 unsigned NumPreArgs : 1;
196 class ExprWithCleanupsBitfields {
200 unsigned : NumExprBits;
203 unsigned CleanupsHaveSideEffects : 1;
205 unsigned NumObjects : 32 - 1 - NumExprBits;
208 class PseudoObjectExprBitfields {
212 unsigned : NumExprBits;
216 unsigned NumSubExprs : 8;
217 unsigned ResultIndex : 32 - 8 - NumExprBits;
220 class ObjCIndirectCopyRestoreExprBitfields {
222 unsigned : NumExprBits;
224 unsigned ShouldCopy : 1;
227 class InitListExprBitfields {
230 unsigned : NumExprBits;
234 unsigned HadArrayRangeDesignator : 1;
237 class TypeTraitExprBitfields {
242 unsigned : NumExprBits;
252 unsigned NumArgs : 32 - 8 - 1 - NumExprBits;
256 StmtBitfields StmtBits;
257 CompoundStmtBitfields CompoundStmtBits;
258 IfStmtBitfields IfStmtBits;
259 ExprBitfields ExprBits;
260 CharacterLiteralBitfields CharacterLiteralBits;
261 FloatingLiteralBitfields FloatingLiteralBits;
262 UnaryExprOrTypeTraitExprBitfields UnaryExprOrTypeTraitExprBits;
263 DeclRefExprBitfields DeclRefExprBits;
264 CastExprBitfields CastExprBits;
265 CallExprBitfields CallExprBits;
266 ExprWithCleanupsBitfields ExprWithCleanupsBits;
267 PseudoObjectExprBitfields PseudoObjectExprBits;
268 ObjCIndirectCopyRestoreExprBitfields ObjCIndirectCopyRestoreExprBits;
269 InitListExprBitfields InitListExprBits;
270 TypeTraitExprBitfields TypeTraitExprBits;
280 unsigned alignment = 8);
283 unsigned alignment = 8) {
284 return operator new(
bytes, *
C, alignment);
287 void *
operator new(
size_t bytes,
void *mem) LLVM_NOEXCEPT {
return mem; }
291 void operator delete(
void *,
size_t) LLVM_NOEXCEPT {}
292 void operator delete(
void *,
void *) LLVM_NOEXCEPT {}
298 struct EmptyShell { };
306 : llvm::iterator_adaptor_base<ExprIterator, Stmt **,
307 std::random_access_iterator_tag, Expr *> {
308 ExprIterator() : iterator_adaptor_base(
nullptr) {}
309 ExprIterator(
Stmt **
I) : iterator_adaptor_base(I) {}
312 assert((*I)->getStmtClass() >= firstExprConstant &&
313 (*I)->getStmtClass() <= lastExprConstant);
314 return *
reinterpret_cast<Expr **
>(
I);
319 struct ConstExprIterator
320 : llvm::iterator_adaptor_base<ConstExprIterator, const Stmt *const *,
321 std::random_access_iterator_tag,
323 ConstExprIterator() : iterator_adaptor_base(
nullptr) {}
324 ConstExprIterator(
const Stmt *
const *
I) : iterator_adaptor_base(I) {}
327 assert((*I)->getStmtClass() >= firstExprConstant &&
328 (*I)->getStmtClass() <= lastExprConstant);
329 return *
reinterpret_cast<const Expr *
const *
>(
I);
335 static bool StatisticsEnabled;
339 explicit Stmt(StmtClass SC, EmptyShell) :
Stmt(SC) {}
343 static_assert(
sizeof(*
this) % llvm::AlignOf<void *>::Alignment == 0,
344 "Insufficient alignment!");
345 StmtBits.sClass = SC;
346 if (StatisticsEnabled) Stmt::addStmtClass(SC);
349 StmtClass getStmtClass()
const {
350 return static_cast<StmtClass
>(StmtBits.sClass);
352 const char *getStmtClassName()
const;
362 static void addStmtClass(
const StmtClass s);
363 static void EnableStatistics();
364 static void PrintStats();
371 void dump(raw_ostream &OS)
const;
374 void dumpColor()
const;
381 unsigned Indentation = 0)
const;
385 void viewAST()
const;
389 Stmt *IgnoreImplicit();
393 Stmt *IgnoreContainers(
bool IgnoreCaptured =
false);
395 const Stmt *stripLabelLikeStatements()
const;
396 Stmt *stripLabelLikeStatements() {
397 return const_cast<Stmt*
>(
398 const_cast<const Stmt*
>(
this)->stripLabelLikeStatements());
407 typedef llvm::iterator_range<child_iterator> child_range;
408 typedef llvm::iterator_range<const_child_iterator> const_child_range;
411 const_child_range
children()
const {
413 return const_child_range(Children.begin(), Children.end());
416 child_iterator child_begin() {
return children().begin(); }
417 child_iterator child_end() {
return children().end(); }
419 const_child_iterator child_begin()
const {
return children().begin(); }
420 const_child_iterator child_end()
const {
return children().end(); }
435 bool Canonical)
const;
450 StartLoc(startLoc), EndLoc(endLoc) {}
458 return DG.isSingleDecl();
477 return T->getStmtClass() == DeclStmtClass;
482 return child_range(child_iterator(DG.begin(), DG.end()),
483 child_iterator(DG.end(), DG.end()));
519 bool HasLeadingEmptyMacro;
522 :
Stmt(NullStmtClass), SemiLoc(L),
523 HasLeadingEmptyMacro(hasLeadingEmptyMacro) {}
527 HasLeadingEmptyMacro(
false) { }
538 return T->getStmtClass() == NullStmtClass;
542 return child_range(child_iterator(), child_iterator());
563 :
Stmt(CompoundStmtClass), Body(nullptr), LBraceLoc(Loc), RBraceLoc(Loc) {
564 CompoundStmtBits.NumStmts = 0;
569 :
Stmt(CompoundStmtClass, Empty), Body(nullptr) {
570 CompoundStmtBits.NumStmts = 0;
575 bool body_empty()
const {
return CompoundStmtBits.NumStmts == 0; }
576 unsigned size()
const {
return CompoundStmtBits.NumStmts; }
588 assert(!body_empty() &&
"setLastStmt");
601 return !body_empty() ? Body[0] :
nullptr;
604 return !body_empty() ? Body[size() - 1] :
nullptr;
615 typedef std::reverse_iterator<const_body_iterator>
633 return T->getStmtClass() == CompoundStmtClass;
638 return child_range(Body, Body + CompoundStmtBits.NumStmts);
642 return const_child_range(child_iterator(Body),
643 child_iterator(Body + CompoundStmtBits.NumStmts));
657 :
Stmt(SC), NextSwitchCase(nullptr), KeywordLoc(KWLoc), ColonLoc(ColonLoc) {
661 :
Stmt(SC), NextSwitchCase(nullptr) {}
677 return const_cast<SwitchCase*
>(
this)->getSubStmt();
684 return T->getStmtClass() == CaseStmtClass ||
685 T->getStmtClass() == DefaultStmtClass;
691 enum { LHS, RHS, SUBSTMT, END_EXPR };
692 Stmt* SubExprs[END_EXPR];
697 :
SwitchCase(CaseStmtClass, caseLoc, colonLoc) {
698 SubExprs[SUBSTMT] =
nullptr;
699 SubExprs[LHS] =
reinterpret_cast<Stmt*
>(lhs);
700 SubExprs[RHS] =
reinterpret_cast<Stmt*
>(rhs);
701 EllipsisLoc = ellipsisLoc;
719 return reinterpret_cast<const Expr*
>(SubExprs[LHS]);
722 return reinterpret_cast<const Expr*
>(SubExprs[RHS]);
741 return T->getStmtClass() == CaseStmtClass;
746 return child_range(&SubExprs[0], &SubExprs[END_EXPR]);
754 SwitchCase(DefaultStmtClass, DL, CL), SubStmt(substmt) {}
773 return T->getStmtClass() == DefaultStmtClass;
777 child_range
children() {
return child_range(&SubStmt, &SubStmt+1); }
781 if (
const CaseStmt *CS = dyn_cast<CaseStmt>(
this))
782 return CS->getLocEnd();
783 return cast<DefaultStmt>(
this)->getLocEnd();
796 :
Stmt(LabelStmtClass), IdentLoc(IL), TheDecl(D), SubStmt(substmt) {
799 "LabelStmt too big");
808 const char *getName()
const;
817 child_range
children() {
return child_range(&SubStmt, &SubStmt+1); }
820 return T->getStmtClass() == LabelStmtClass;
838 :
Stmt(AttributedStmtClass), SubStmt(SubStmt), AttrLoc(Loc),
839 NumAttrs(Attrs.size()) {
840 std::copy(Attrs.begin(), Attrs.end(), getAttrArrayPtr());
844 :
Stmt(AttributedStmtClass, Empty), NumAttrs(NumAttrs) {
845 std::fill_n(getAttrArrayPtr(), NumAttrs,
nullptr);
848 const Attr *
const *getAttrArrayPtr()
const {
849 return reinterpret_cast<const Attr *
const *
>(
this + 1);
851 const Attr **getAttrArrayPtr() {
852 return reinterpret_cast<const Attr **
>(
this + 1);
857 ArrayRef<const Attr*> Attrs,
Stmt *SubStmt);
863 return llvm::makeArrayRef(getAttrArrayPtr(), NumAttrs);
871 child_range
children() {
return child_range(&SubStmt, &SubStmt + 1); }
874 return T->getStmtClass() == AttributedStmtClass;
882 enum { INIT, VAR, COND, THEN, ELSE, END_EXPR };
883 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]);
939 return SubExprs[ELSE]->getLocEnd();
941 return SubExprs[THEN]->getLocEnd();
947 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
951 return T->getStmtClass() == IfStmtClass;
959 enum { INIT, VAR, COND, BODY, END_EXPR };
960 Stmt* SubExprs[END_EXPR];
965 llvm::PointerIntPair<SwitchCase *, 1, bool> FirstCase;
982 VarDecl *getConditionVariable()
const;
988 return reinterpret_cast<DeclStmt*
>(SubExprs[VAR]);
1016 &&
"case/default already added to a switch");
1018 FirstCase.setPointer(SC);
1031 return SubExprs[BODY] ? SubExprs[BODY]->getLocEnd() : SubExprs[COND]->getLocEnd();
1036 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1040 return T->getStmtClass() == SwitchStmtClass;
1049 enum { VAR, COND, BODY, END_EXPR };
1050 Stmt* SubExprs[END_EXPR];
1066 VarDecl *getConditionVariable()
const;
1072 return reinterpret_cast<DeclStmt*
>(SubExprs[VAR]);
1087 return SubExprs[BODY]->getLocEnd();
1091 return T->getStmtClass() == WhileStmtClass;
1096 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1104 enum { BODY, COND, END_EXPR };
1105 Stmt* SubExprs[END_EXPR];
1112 :
Stmt(DoStmtClass), DoLoc(DL), WhileLoc(WL), RParenLoc(RP) {
1113 SubExprs[COND] =
reinterpret_cast<Stmt*
>(cond);
1114 SubExprs[BODY] = body;
1139 return T->getStmtClass() == DoStmtClass;
1144 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1155 enum { INIT, CONDVAR, COND, INC, BODY, END_EXPR };
1156 Stmt* SubExprs[END_EXPR];
1177 VarDecl *getConditionVariable()
const;
1183 return reinterpret_cast<DeclStmt*
>(SubExprs[CONDVAR]);
1209 return SubExprs[BODY]->getLocEnd();
1213 return T->getStmtClass() == ForStmtClass;
1218 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1230 :
Stmt(GotoStmtClass), Label(label), GotoLoc(GL), LabelLoc(LL) {}
1247 return T->getStmtClass() == GotoStmtClass;
1252 return child_range(child_iterator(), child_iterator());
1265 :
Stmt(IndirectGotoStmtClass), GotoLoc(gotoLoc), StarLoc(starLoc),
1266 Target((
Stmt*)target) {}
1270 :
Stmt(IndirectGotoStmtClass, Empty) { }
1292 return T->getStmtClass() == IndirectGotoStmtClass;
1296 child_range
children() {
return child_range(&Target, &Target+1); }
1317 return T->getStmtClass() == ContinueStmtClass;
1322 return child_range(child_iterator(), child_iterator());
1334 "BreakStmt too large");
1347 return T->getStmtClass() == BreakStmtClass;
1352 return child_range(child_iterator(), child_iterator());
1375 :
Stmt(ReturnStmtClass), RetLoc(RL), RetExpr((
Stmt *)E),
1376 NRVOCandidate(NRVOCandidate) {}
1381 const Expr *getRetValue()
const;
1382 Expr *getRetValue();
1398 return RetExpr ? RetExpr->getLocEnd() : RetLoc;
1402 return T->getStmtClass() == ReturnStmtClass;
1407 if (RetExpr)
return child_range(&RetExpr, &RetExpr+1);
1408 return child_range(child_iterator(), child_iterator());
1432 unsigned numoutputs,
unsigned numinputs,
unsigned numclobbers) :
1433 Stmt (SC), AsmLoc(asmloc), IsSimple(issimple), IsVolatile(isvolatile),
1434 NumOutputs(numoutputs), NumInputs(numinputs), NumClobbers(numclobbers) { }
1440 explicit AsmStmt(StmtClass SC, EmptyShell Empty) :
1441 Stmt(SC, Empty), Exprs(nullptr) { }
1458 std::string generateAsmString(
const ASTContext &
C)
const;
1467 StringRef getOutputConstraint(
unsigned i)
const;
1473 return getOutputConstraint(i)[0] ==
'+';
1476 const Expr *getOutputExpr(
unsigned i)
const;
1480 unsigned getNumPlusOperands()
const;
1488 StringRef getInputConstraint(
unsigned i)
const;
1490 const Expr *getInputExpr(
unsigned i)
const;
1495 StringRef getClobber(
unsigned i)
const;
1498 return T->getStmtClass() == GCCAsmStmtClass ||
1499 T->getStmtClass() == MSAsmStmtClass;
1510 return &Exprs[0] + NumOutputs;
1514 return &Exprs[0] + NumOutputs + NumInputs;
1520 return &Exprs[0] + NumOutputs;
1524 return &Exprs[0] + NumOutputs + NumInputs;
1542 return &Exprs[0] + NumOutputs;
1552 return &Exprs[0] + NumOutputs;
1559 return child_range(&Exprs[0], &Exprs[0] + NumOutputs + NumInputs);
1578 bool isvolatile,
unsigned numoutputs,
unsigned numinputs,
1585 Constraints(nullptr), Clobbers(nullptr),
Names(nullptr) { }
1616 : MyKind(Operand), Str(S), OperandNo(OpNo),
1628 assert(isOperand());
1633 assert(isOperand() &&
"Range is currently used only for Operands.");
1648 const ASTContext &C,
unsigned &DiagOffs)
const;
1651 std::string generateAsmString(
const ASTContext &C)
const;
1661 return II->getName();
1666 StringRef getOutputConstraint(
unsigned i)
const;
1669 return Constraints[i];
1672 return Constraints[i];
1675 Expr *getOutputExpr(
unsigned i);
1678 return const_cast<GCCAsmStmt*
>(
this)->getOutputExpr(i);
1684 return Names[i + NumOutputs];
1689 return II->getName();
1694 StringRef getInputConstraint(
unsigned i)
const;
1697 return Constraints[i + NumOutputs];
1700 return Constraints[i + NumOutputs];
1703 Expr *getInputExpr(
unsigned i);
1704 void setInputExpr(
unsigned i,
Expr *
E);
1707 return const_cast<GCCAsmStmt*
>(
this)->getInputExpr(i);
1711 void setOutputsAndInputsAndClobbers(
const ASTContext &C,
1715 unsigned NumOutputs,
1718 unsigned NumClobbers);
1726 int getNamedOperand(StringRef SymbolicName)
const;
1728 StringRef getClobber(
unsigned i)
const;
1738 return T->getStmtClass() == GCCAsmStmtClass;
1748 unsigned NumAsmToks;
1751 StringRef *Constraints;
1752 StringRef *Clobbers;
1766 NumAsmToks(0), AsmToks(nullptr), Constraints(nullptr), Clobbers(nullptr) { }
1782 std::string generateAsmString(
const ASTContext &
C)
const;
1787 assert(i < NumOutputs);
1788 return Constraints[i];
1791 Expr *getOutputExpr(
unsigned i);
1794 return const_cast<MSAsmStmt*
>(
this)->getOutputExpr(i);
1800 assert(i < NumInputs);
1801 return Constraints[i + NumOutputs];
1804 Expr *getInputExpr(
unsigned i);
1805 void setInputExpr(
unsigned i,
Expr *
E);
1808 return const_cast<MSAsmStmt*
>(
this)->getInputExpr(i);
1814 return llvm::makeArrayRef(Constraints, NumInputs + NumOutputs);
1817 return llvm::makeArrayRef(Clobbers, NumClobbers);
1820 return llvm::makeArrayRef(reinterpret_cast<Expr**>(Exprs),
1821 NumInputs + NumOutputs);
1824 StringRef
getClobber(
unsigned i)
const {
return getClobbers()[i]; }
1827 void initialize(
const ASTContext &
C, StringRef AsmString,
1836 return T->getStmtClass() == MSAsmStmtClass;
1840 return child_range(&Exprs[0], &Exprs[NumInputs + NumOutputs]);
1848 enum { FILTER_EXPR,
BLOCK };
1871 return reinterpret_cast<Expr*
>(Children[FILTER_EXPR]);
1875 return cast<CompoundStmt>(Children[
BLOCK]);
1879 return child_range(Children,Children+2);
1883 return T->getStmtClass() == SEHExceptStmtClass;
1913 return child_range(&Block,&Block+1);
1917 return T->getStmtClass() == SEHFinallyStmtClass;
1927 enum { TRY = 0, HANDLER = 1 };
1952 return cast<CompoundStmt>(Children[TRY]);
1962 return child_range(Children,Children+2);
1966 return T->getStmtClass() == SEHTryStmtClass;
1976 :
Stmt(SEHLeaveStmtClass), LeaveLoc(LL) {}
1988 return T->getStmtClass() == SEHLeaveStmtClass;
1993 return child_range(child_iterator(), child_iterator());
2020 llvm::PointerIntPair<VarDecl *, 2, VariableCaptureKind> VarAndKind;
2050 return getCaptureKind() == VCK_ByCopy;
2056 return getCaptureKind() == VCK_VLAType;
2062 VarDecl *getCapturedVar()
const;
2069 unsigned NumCaptures;
2073 llvm::PointerIntPair<CapturedDecl *, 1, CapturedRegionKind> CapDeclAndKind;
2085 Stmt **getStoredStmts() {
return reinterpret_cast<Stmt **
>(
this + 1); }
2087 Stmt *
const *getStoredStmts()
const {
2088 return reinterpret_cast<Stmt *
const *
>(
this + 1);
2091 Capture *getStoredCaptures()
const;
2093 void setCapturedStmt(
Stmt *
S) { getStoredStmts()[NumCaptures] =
S; }
2098 ArrayRef<Capture> Captures,
2099 ArrayRef<Expr *> CaptureInits,
2100 CapturedDecl *CD, RecordDecl *RD);
2103 unsigned NumCaptures);
2127 assert(D &&
"null RecordDecl");
2132 bool capturesVariable(
const VarDecl *Var)
const;
2154 return getStoredCaptures() + NumCaptures;
2167 typedef llvm::iterator_range<const_capture_init_iterator>
2180 return reinterpret_cast<Expr **
>(getStoredStmts());
2184 return reinterpret_cast<Expr *
const *
>(getStoredStmts());
2190 return capture_init_begin() + NumCaptures;
2194 return capture_init_begin() + NumCaptures;
2198 return getCapturedStmt()->getLocStart();
2201 return getCapturedStmt()->getLocEnd();
2204 return getCapturedStmt()->getSourceRange();
2208 return T->getStmtClass() == CapturedStmtClass;
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
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
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
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
__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.
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
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.
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation getIfLoc() const
Represents a call to a C++ constructor.
const_capture_init_range capture_inits() const
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
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)
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)
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
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
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
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
Token - This structure provides full information about a lexed token.
void setReturnLoc(SourceLocation L)
MSAsmStmt(EmptyShell Empty)
Build an empty MS-style inline-assembly statement.
SourceLocation getLocEnd() const LLVM_READONLY
clang::CharUnits operator*(clang::CharUnits::QuantityType Scale, const clang::CharUnits &CU)
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.
body_const_range body() const
OpenMPLinearClauseKind getModifier() const
Return modifier.
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.
outputs_iterator begin_outputs()
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
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.
detail::InMemoryDirectory::const_iterator I
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)
CompoundStmt - This represents a group of statements like { stmt stmt }.
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.
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
static bool classof(const Stmt *T)
static bool classof(const Stmt *T)
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)
Represents a character-granular source range.
SourceLocation getLocStart() const LLVM_READONLY
static bool classof(const Stmt *T)
void setLParenLoc(SourceLocation L)
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
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
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
capture_init_range capture_inits()
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)
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...
SourceLocation getLocStart() const LLVM_READONLY
class LLVM_ALIGNAS(8) TemplateSpecializationType unsigned NumArgs
Represents a type template specialization; the template must be a class template, a type alias templa...
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
SourceLocation getSemiLoc() const
SourceLocation getLocEnd() const LLVM_READONLY
llvm::iterator_range< const_body_iterator > body_const_range
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
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
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
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.
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. ...
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 ...
SourceLocation getLocStart() const LLVM_READONLY
CompoundStmt(SourceLocation Loc)
const Expr * getCond() const
bool capturesVariable() const
Determine whether this capture handles a variable (by reference).
static bool classof(const Stmt *T)
ConstExprIterator const_outputs_iterator
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
SourceLocation getEndLoc() const
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
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)
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 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)
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
const Stmt * getSubStmt() const
SourceLocation getStarLoc() const
const Stmt * getInit() 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
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.
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
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
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
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...
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 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
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)
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
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
Expr *const * const_capture_init_iterator
Const iterator that walks over the capture initialization arguments.
SourceLocation getExceptLoc() 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)
void setKeywordLoc(SourceLocation L)
ReturnStmt(EmptyShell Empty)
Build an empty return expression.
SourceLocation getLocEnd() const LLVM_READONLY
void setLabelLoc(SourceLocation L)
ConstExprIterator const_inputs_iterator
#define BLOCK(DERIVED, BASE)
inputs_iterator end_inputs()