27 #include "llvm/ADT/StringExtras.h"
28 #include "llvm/Support/raw_ostream.h"
29 using namespace clang;
44 #define ABSTRACT_STMT(STMT)
45 #define STMT(CLASS, PARENT) \
46 StmtClassInfo[(unsigned)Stmt::CLASS##Class].Name = #CLASS; \
47 StmtClassInfo[(unsigned)Stmt::CLASS##Class].Size = sizeof(CLASS);
48 #include "clang/AST/StmtNodes.inc"
55 return ::operator
new(
bytes,
C, alignment);
58 const char *Stmt::getStmtClassName()
const {
62 void Stmt::PrintStats() {
67 llvm::errs() <<
"\n*** Stmt/Expr Stats:\n";
68 for (
int i = 0; i != Stmt::lastStmtConstant+1; i++) {
72 llvm::errs() <<
" " << sum <<
" stmts/exprs total.\n";
74 for (
int i = 0; i != Stmt::lastStmtConstant+1; i++) {
84 llvm::errs() <<
"Total bytes = " << sum <<
"\n";
87 void Stmt::addStmtClass(StmtClass s) {
91 bool Stmt::StatisticsEnabled =
false;
92 void Stmt::EnableStatistics() {
93 StatisticsEnabled =
true;
96 Stmt *Stmt::IgnoreImplicit() {
99 if (
auto *ewc = dyn_cast<ExprWithCleanups>(s))
100 s = ewc->getSubExpr();
102 if (
auto *mte = dyn_cast<MaterializeTemporaryExpr>(s))
103 s = mte->GetTemporaryExpr();
105 if (
auto *bte = dyn_cast<CXXBindTemporaryExpr>(s))
106 s = bte->getSubExpr();
108 while (
auto *ice = dyn_cast<ImplicitCastExpr>(s))
109 s = ice->getSubExpr();
116 Stmt *Stmt::IgnoreContainers(
bool IgnoreCaptured) {
119 if (
auto CapS = dyn_cast_or_null<CapturedStmt>(S))
120 S = CapS->getCapturedStmt();
122 if (
auto AS = dyn_cast_or_null<AttributedStmt>(S))
123 S = AS->getSubStmt();
124 else if (
auto CS = dyn_cast_or_null<CompoundStmt>(S)) {
138 const Stmt *Stmt::stripLabelLikeStatements()
const {
139 const Stmt *S =
this;
141 if (
const LabelStmt *LS = dyn_cast<LabelStmt>(S))
142 S = LS->getSubStmt();
143 else if (
const SwitchCase *SC = dyn_cast<SwitchCase>(S))
144 S = SC->getSubStmt();
146 S = AS->getSubStmt();
159 static inline good is_good(good) {
return good(); }
161 typedef Stmt::child_range children_t();
162 template <
class T> good implements_children(children_t T::*) {
165 LLVM_ATTRIBUTE_UNUSED
166 static inline bad implements_children(children_t
Stmt::*) {
171 template <
class T> good implements_getLocStart(getLocStart_t T::*) {
174 LLVM_ATTRIBUTE_UNUSED
175 static inline bad implements_getLocStart(getLocStart_t
Stmt::*) {
180 template <
class T> good implements_getLocEnd(getLocEnd_t T::*) {
183 LLVM_ATTRIBUTE_UNUSED
184 static inline bad implements_getLocEnd(getLocEnd_t
Stmt::*) {
188 #define ASSERT_IMPLEMENTS_children(type) \
189 (void) is_good(implements_children(&type::children))
190 #define ASSERT_IMPLEMENTS_getLocStart(type) \
191 (void) is_good(implements_getLocStart(&type::getLocStart))
192 #define ASSERT_IMPLEMENTS_getLocEnd(type) \
193 (void) is_good(implements_getLocEnd(&type::getLocEnd))
198 LLVM_ATTRIBUTE_UNUSED
200 #define ABSTRACT_STMT(type)
201 #define STMT(type, base) \
202 ASSERT_IMPLEMENTS_children(type); \
203 ASSERT_IMPLEMENTS_getLocStart(type); \
204 ASSERT_IMPLEMENTS_getLocEnd(type);
205 #include "clang/AST/StmtNodes.inc"
209 switch (getStmtClass()) {
210 case Stmt::NoStmtClass: llvm_unreachable(
"statement without class");
211 #define ABSTRACT_STMT(type)
212 #define STMT(type, base) \
213 case Stmt::type##Class: \
214 return static_cast<type*>(this)->children();
215 #include "clang/AST/StmtNodes.inc"
217 llvm_unreachable(
"unknown statement kind!");
227 template <
class S,
class T>
240 return SourceRange(static_cast<const S*>(stmt)->getLocStart(),
241 static_cast<const S*>(stmt)->getLocEnd());
246 switch (getStmtClass()) {
247 case Stmt::NoStmtClass: llvm_unreachable(
"statement without class");
248 #define ABSTRACT_STMT(type)
249 #define STMT(type, base) \
250 case Stmt::type##Class: \
251 return getSourceRangeImpl<type>(this, &type::getSourceRange);
252 #include "clang/AST/StmtNodes.inc"
254 llvm_unreachable(
"unknown statement kind!");
259 switch (getStmtClass()) {
260 case Stmt::NoStmtClass: llvm_unreachable(
"statement without class");
261 #define ABSTRACT_STMT(type)
262 #define STMT(type, base) \
263 case Stmt::type##Class: \
264 return static_cast<const type*>(this)->getLocStart();
265 #include "clang/AST/StmtNodes.inc"
267 llvm_unreachable(
"unknown statement kind");
271 switch (getStmtClass()) {
272 case Stmt::NoStmtClass: llvm_unreachable(
"statement without class");
273 #define ABSTRACT_STMT(type)
274 #define STMT(type, base) \
275 case Stmt::type##Class: \
276 return static_cast<const type*>(this)->getLocEnd();
277 #include "clang/AST/StmtNodes.inc"
279 llvm_unreachable(
"unknown statement kind");
284 :
Stmt(CompoundStmtClass), LBraceLoc(LB), RBraceLoc(RB) {
285 CompoundStmtBits.NumStmts = Stmts.size();
286 assert(CompoundStmtBits.NumStmts == Stmts.size() &&
287 "NumStmts doesn't fit in bits of CompoundStmtBits.NumStmts!");
289 if (Stmts.size() == 0) {
294 Body =
new (C)
Stmt*[Stmts.size()];
295 std::copy(Stmts.begin(), Stmts.end(), Body);
301 CompoundStmtBits.NumStmts = Stmts.size();
302 assert(CompoundStmtBits.NumStmts == Stmts.size() &&
303 "NumStmts doesn't fit in bits of CompoundStmtBits.NumStmts!");
305 Body =
new (C)
Stmt*[Stmts.size()];
306 std::copy(Stmts.begin(), Stmts.end(), Body);
316 assert(!Attrs.empty() &&
"Attrs should not be empty");
318 llvm::alignOf<AttributedStmt>());
324 assert(NumAttrs > 0 &&
"NumAttrs should be greater than zero");
326 llvm::alignOf<AttributedStmt>());
331 if (
const GCCAsmStmt *gccAsmStmt = dyn_cast<GCCAsmStmt>(
this))
332 return gccAsmStmt->generateAsmString(C);
333 if (
const MSAsmStmt *msAsmStmt = dyn_cast<MSAsmStmt>(
this))
334 return msAsmStmt->generateAsmString(C);
335 llvm_unreachable(
"unknown asm statement kind!");
339 if (
const GCCAsmStmt *gccAsmStmt = dyn_cast<GCCAsmStmt>(
this))
340 return gccAsmStmt->getOutputConstraint(i);
341 if (
const MSAsmStmt *msAsmStmt = dyn_cast<MSAsmStmt>(
this))
342 return msAsmStmt->getOutputConstraint(i);
343 llvm_unreachable(
"unknown asm statement kind!");
347 if (
const GCCAsmStmt *gccAsmStmt = dyn_cast<GCCAsmStmt>(
this))
348 return gccAsmStmt->getOutputExpr(i);
349 if (
const MSAsmStmt *msAsmStmt = dyn_cast<MSAsmStmt>(
this))
350 return msAsmStmt->getOutputExpr(i);
351 llvm_unreachable(
"unknown asm statement kind!");
355 if (
const GCCAsmStmt *gccAsmStmt = dyn_cast<GCCAsmStmt>(
this))
356 return gccAsmStmt->getInputConstraint(i);
357 if (
const MSAsmStmt *msAsmStmt = dyn_cast<MSAsmStmt>(
this))
358 return msAsmStmt->getInputConstraint(i);
359 llvm_unreachable(
"unknown asm statement kind!");
363 if (
const GCCAsmStmt *gccAsmStmt = dyn_cast<GCCAsmStmt>(
this))
364 return gccAsmStmt->getInputExpr(i);
365 if (
const MSAsmStmt *msAsmStmt = dyn_cast<MSAsmStmt>(
this))
366 return msAsmStmt->getInputExpr(i);
367 llvm_unreachable(
"unknown asm statement kind!");
371 if (
const GCCAsmStmt *gccAsmStmt = dyn_cast<GCCAsmStmt>(
this))
372 return gccAsmStmt->getClobber(i);
373 if (
const MSAsmStmt *msAsmStmt = dyn_cast<MSAsmStmt>(
this))
374 return msAsmStmt->getClobber(i);
375 llvm_unreachable(
"unknown asm statement kind!");
389 assert(
isOperand() &&
"Only Operands can have modifiers.");
390 return isLetter(Str[0]) ? Str[0] :
'\0';
398 return cast<Expr>(
Exprs[i]);
421 void GCCAsmStmt::setOutputsAndInputsAndClobbers(
const ASTContext &C,
433 unsigned NumExprs = NumOutputs +
NumInputs;
437 std::copy(Names, Names + NumExprs, this->Names);
440 this->Exprs =
new (C)
Stmt*[NumExprs];
441 std::copy(Exprs, Exprs + NumExprs, this->Exprs);
445 std::copy(Constraints, Constraints + NumExprs, this->Constraints);
449 std::copy(Clobbers, Clobbers + NumClobbers, this->Clobbers);
456 unsigned NumPlusOperands = 0;
476 const ASTContext &C,
unsigned &DiagOffs)
const {
478 const char *StrStart = Str.begin();
479 const char *StrEnd = Str.end();
480 const char *CurPtr = StrStart;
486 for (; CurPtr != StrEnd; ++CurPtr) {
502 std::string CurStringPiece;
506 unsigned LastAsmStringToken = 0;
507 unsigned LastAsmStringOffset = 0;
511 if (CurPtr == StrEnd) {
512 if (!CurStringPiece.empty())
517 char CurChar = *CurPtr++;
519 case '$': CurStringPiece +=
"$$";
continue;
520 case '{': CurStringPiece += (HasVariants ?
"$(" :
"{");
continue;
521 case '|': CurStringPiece += (HasVariants ?
"$|" :
"|");
continue;
522 case '}': CurStringPiece += (HasVariants ?
"$)" :
"}");
continue;
526 CurStringPiece += CurChar;
531 if (CurPtr == StrEnd) {
533 DiagOffs = CurPtr-StrStart-1;
534 return diag::err_asm_invalid_escape;
537 char EscapedChar = *CurPtr++;
538 if (EscapedChar ==
'%') {
540 CurStringPiece +=
'%';
544 if (EscapedChar ==
'=') {
545 CurStringPiece +=
"${:uid}";
551 if (!CurStringPiece.empty()) {
553 CurStringPiece.clear();
559 const char *Begin = CurPtr - 1;
560 const char *Percent = Begin - 1;
563 if (CurPtr == StrEnd) {
564 DiagOffs = CurPtr-StrStart-1;
565 return diag::err_asm_invalid_escape;
567 EscapedChar = *CurPtr++;
580 while (CurPtr != StrEnd &&
isDigit(*CurPtr))
581 N = N*10 + ((*CurPtr++)-
'0');
583 unsigned NumOperands =
585 if (N >= NumOperands) {
586 DiagOffs = CurPtr-StrStart-1;
587 return diag::err_asm_invalid_operand_number;
591 std::string Str(Begin, CurPtr - Begin);
596 Percent - StrStart, SM, LO, TI, &LastAsmStringToken,
597 &LastAsmStringOffset);
599 CurPtr - StrStart, SM, LO, TI, &LastAsmStringToken,
600 &LastAsmStringOffset);
602 Pieces.emplace_back(N, std::move(Str), BeginLoc, EndLoc);
607 if (EscapedChar ==
'[') {
608 DiagOffs = CurPtr-StrStart-1;
611 const char *NameEnd = (
const char*)memchr(CurPtr,
']', StrEnd-CurPtr);
612 if (NameEnd ==
nullptr)
613 return diag::err_asm_unterminated_symbolic_operand_name;
614 if (NameEnd == CurPtr)
615 return diag::err_asm_empty_symbolic_operand_name;
617 StringRef SymbolicName(CurPtr, NameEnd - CurPtr);
622 DiagOffs = CurPtr-StrStart;
623 return diag::err_asm_unknown_symbolic_operand_name;
627 std::string Str(Begin, NameEnd + 1 - Begin);
632 Percent - StrStart, SM, LO, TI, &LastAsmStringToken,
633 &LastAsmStringOffset);
635 NameEnd + 1 - StrStart, SM, LO, TI, &LastAsmStringToken,
636 &LastAsmStringOffset);
638 Pieces.emplace_back(N, std::move(Str), BeginLoc, EndLoc);
644 DiagOffs = CurPtr-StrStart-1;
645 return diag::err_asm_invalid_escape;
657 std::string AsmString;
658 for (
unsigned i = 0, e = Pieces.size(); i != e; ++i) {
659 if (Pieces[i].isString())
660 AsmString += Pieces[i].getString();
662 AsmString +=
'$' + llvm::utostr(Pieces[i].getOperandNo());
664 AsmString +=
"${" + llvm::utostr(Pieces[i].getOperandNo()) +
':' +
665 Pieces[i].getModifier() +
'}';
677 return cast<Expr>(Exprs[i]);
692 bool issimple,
bool isvolatile,
unsigned numoutputs,
697 :
AsmStmt(GCCAsmStmtClass, asmloc, issimple, isvolatile, numoutputs,
698 numinputs, numclobbers), RParenLoc(rparenloc), AsmStr(asmstr) {
700 unsigned NumExprs = NumOutputs +
NumInputs;
703 std::copy(names, names + NumExprs, Names);
705 Exprs =
new (C)
Stmt*[NumExprs];
706 std::copy(exprs, exprs + NumExprs, Exprs);
709 std::copy(constraints, constraints + NumExprs, Constraints);
712 std::copy(clobbers, clobbers + NumClobbers, Clobbers);
722 :
AsmStmt(MSAsmStmtClass, asmloc, issimple, isvolatile, numoutputs,
723 numinputs, clobbers.size()), LBraceLoc(lbraceloc),
724 EndLoc(endloc), NumAsmToks(asmtoks.size()) {
726 initialize(C, asmstr, asmtoks, constraints, exprs, clobbers);
733 void MSAsmStmt::initialize(
const ASTContext &C, StringRef asmstr,
738 assert(NumAsmToks == asmtoks.size());
739 assert(NumClobbers == clobbers.size());
741 assert(exprs.size() == NumOutputs +
NumInputs);
742 assert(exprs.size() == constraints.size());
746 Exprs =
new (C)
Stmt*[exprs.size()];
747 std::copy(exprs.begin(), exprs.end(),
Exprs);
749 AsmToks =
new (C)
Token[asmtoks.size()];
750 std::copy(asmtoks.begin(), asmtoks.end(), AsmToks);
752 Constraints =
new (C) StringRef[exprs.size()];
753 std::transform(constraints.begin(), constraints.end(), Constraints,
754 [&](StringRef Constraint) {
758 Clobbers =
new (C) StringRef[NumClobbers];
760 std::transform(clobbers.begin(), clobbers.end(), Clobbers,
761 [&](StringRef Clobber) {
769 :
Stmt(IfStmtClass), IfLoc(IL), ElseLoc(EL) {
772 SubExprs[INIT] = init;
773 SubExprs[COND] = cond;
774 SubExprs[THEN] = then;
775 SubExprs[ELSE] = elsev;
782 DeclStmt *DS = cast<DeclStmt>(SubExprs[VAR]);
788 SubExprs[VAR] =
nullptr;
800 :
Stmt(ForStmtClass), ForLoc(FL), LParenLoc(LP), RParenLoc(RP)
802 SubExprs[INIT] = Init;
804 SubExprs[COND] = Cond;
806 SubExprs[BODY] = Body;
810 if (!SubExprs[CONDVAR])
813 DeclStmt *DS = cast<DeclStmt>(SubExprs[CONDVAR]);
819 SubExprs[CONDVAR] =
nullptr;
830 :
Stmt(SwitchStmtClass), FirstCase(nullptr,
false) {
832 SubExprs[INIT] = init;
833 SubExprs[COND] = cond;
834 SubExprs[BODY] =
nullptr;
841 DeclStmt *DS = cast<DeclStmt>(SubExprs[VAR]);
847 SubExprs[VAR] =
nullptr;
857 if (isa<CaseStmt>(
this))
864 :
Stmt(WhileStmtClass) {
866 SubExprs[COND] = cond;
867 SubExprs[BODY] = body;
875 DeclStmt *DS = cast<DeclStmt>(SubExprs[VAR]);
881 SubExprs[VAR] =
nullptr;
893 dyn_cast<AddrLabelExpr>(
getTarget()->IgnoreParenImpCasts()))
894 return E->getLabel();
900 return cast_or_null<Expr>(RetExpr);
903 return cast_or_null<Expr>(RetExpr);
906 SEHTryStmt::SEHTryStmt(
bool IsCXXTry,
910 :
Stmt(SEHTryStmtClass),
914 Children[TRY] = TryBlock;
915 Children[HANDLER] = Handler;
921 return new(C)
SEHTryStmt(IsCXXTry,TryLoc,TryBlock,Handler);
935 :
Stmt(SEHExceptStmtClass),
938 Children[FILTER_EXPR] = FilterExpr;
939 Children[
BLOCK] = Block;
949 :
Stmt(SEHFinallyStmtClass),
961 : VarAndKind(Var, Kind), Loc(Loc) {
964 assert(!Var &&
"'this' capture cannot have a variable!");
967 assert(Var &&
"capturing by reference must have a variable!");
970 assert(Var &&
"capturing by copy must have a variable!");
977 "captures by copy are expected to have a scalar type!");
981 "Variable-length array type capture cannot have a variable!");
988 return VarAndKind.getInt();
993 "No variable available for 'this' or VAT capture");
994 return VarAndKind.getPointer();
1001 unsigned FirstCaptureOffset = llvm::alignTo(Size, llvm::alignOf<Capture>());
1003 return reinterpret_cast<Capture *
>(
1004 reinterpret_cast<char *
>(
const_cast<CapturedStmt *
>(
this))
1005 + FirstCaptureOffset);
1013 :
Stmt(CapturedStmtClass), NumCaptures(Captures.size()),
1014 CapDeclAndKind(CD, Kind), TheRecordDecl(RD) {
1015 assert( S &&
"null captured statement");
1016 assert(CD &&
"null captured declaration for captured statement");
1017 assert(RD &&
"null record declaration for captured statement");
1020 Stmt **Stored = getStoredStmts();
1021 for (
unsigned I = 0, N = NumCaptures;
I != N; ++
I)
1022 *Stored++ = CaptureInits[
I];
1029 std::copy(Captures.begin(), Captures.end(),
Buffer);
1032 CapturedStmt::CapturedStmt(EmptyShell Empty,
unsigned NumCaptures)
1033 :
Stmt(CapturedStmtClass, Empty), NumCaptures(NumCaptures),
1034 CapDeclAndKind(nullptr,
CR_Default), TheRecordDecl(nullptr) {
1035 getStoredStmts()[NumCaptures] =
nullptr;
1053 assert(CaptureInits.size() == Captures.size() &&
"wrong number of arguments");
1055 unsigned Size =
sizeof(
CapturedStmt) +
sizeof(
Stmt *) * (Captures.size() + 1);
1056 if (!Captures.empty()) {
1058 Size = llvm::alignTo(Size, llvm::alignOf<Capture>());
1059 Size +=
sizeof(
Capture) * Captures.size();
1062 void *Mem = Context.
Allocate(Size);
1063 return new (Mem)
CapturedStmt(S, Kind, Captures, CaptureInits, CD, RD);
1067 unsigned NumCaptures) {
1069 if (NumCaptures > 0) {
1071 Size = llvm::alignTo(Size, llvm::alignOf<Capture>());
1072 Size +=
sizeof(
Capture) * NumCaptures;
1075 void *Mem = Context.
Allocate(Size);
1076 return new (Mem)
CapturedStmt(EmptyShell(), NumCaptures);
1081 return child_range(getStoredStmts(), getStoredStmts() + NumCaptures);
1085 return CapDeclAndKind.getPointer();
1088 return CapDeclAndKind.getPointer();
1093 assert(D &&
"null CapturedDecl");
1094 CapDeclAndKind.setPointer(D);
1099 return CapDeclAndKind.getInt();
1104 CapDeclAndKind.setInt(Kind);
1109 if (!
I.capturesVariable())
1115 if (
I.getCapturedVar() == Var)
static AttributedStmt * CreateEmpty(const ASTContext &C, unsigned NumAttrs)
void setConditionVariable(const ASTContext &C, VarDecl *V)
Defines the clang::ASTContext interface.
SourceLocation getEnd() const
Capture(SourceLocation Loc, VariableCaptureKind Kind, VarDecl *Var=nullptr)
Create a new capture.
This represents a GCC inline-assembly statement extension.
unsigned getNumOutputs() const
static LLVM_READONLY bool isDigit(unsigned char c)
Return true if this character is an ASCII digit: [0-9].
void setStmts(const ASTContext &C, ArrayRef< Stmt * > Stmts)
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names this declaration, if there is one.
const internal::VariadicAllOfMatcher< Stmt > stmt
Matches statements.
C Language Family Type Representation.
const Expr * getOutputExpr(unsigned i) const
static LLVM_READONLY bool isLetter(unsigned char c)
Return true if this character is an ASCII letter: [a-zA-Z].
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)
std::unique_ptr< llvm::MemoryBuffer > Buffer
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "for" statement, if any.
void setConditionVariable(const ASTContext &C, VarDecl *V)
std::string generateAsmString(const ASTContext &C) const
Assemble final IR asm string.
void setInputExpr(unsigned i, Expr *E)
void setInputExpr(unsigned i, Expr *E)
VarDecl - An instance of this class is created to represent a variable declaration or definition...
VarDecl * getCapturedVar() const
Retrieve the declaration of the variable being captured.
CapturedRegionKind getCapturedRegionKind() const
Retrieve the captured region kind.
Defines the Objective-C statement AST node classes.
static StringRef bytes(const std::vector< T, Allocator > &v)
Defines the clang::Expr interface and subclasses for C++ expressions.
static struct StmtClassNameTable StmtClassInfo[Stmt::lastStmtConstant+1]
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.
One of these records is kept for each identifier that is lexed.
bool isScalarType() 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
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
WhileStmt(const ASTContext &C, VarDecl *Var, Expr *cond, Stmt *body, SourceLocation WL)
bool isReferenceType() const
void Deallocate(void *Ptr) const
Token - This structure provides full information about a lexed token.
void setCapturedDecl(CapturedDecl *D)
Set the outlined function declaration.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
OpenMPLinearClauseKind getModifier() const
Return modifier.
StringRef getOutputConstraint(unsigned i) const
getOutputConstraint - Return the constraint string for the specified output operand.
const TargetInfo & getTargetInfo() const
const LangOptions & getLangOpts() const
StringRef getClobber(unsigned i) const
Expr * getOutputExpr(unsigned i)
StringLiteral * getClobberStringLiteral(unsigned i)
This represents the body of a CapturedStmt, and serves as its DeclContext.
detail::InMemoryDirectory::const_iterator I
static SEHTryStmt * Create(const ASTContext &C, bool isCXXTry, SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler)
Describes the capture of either a variable, or 'this', or variable-length array type.
Stmt * getHandler() const
StringRef getInputConstraint(unsigned i) const
getInputConstraint - Return the specified input constraint.
bool hasNoAsmVariants() const
Return true if {|} are normal characters in the asm string.
std::string generateAsmString(const ASTContext &C) const
Assemble final IR asm string.
std::string generateAsmString(const ASTContext &C) const
Assemble final IR asm string.
Exposes information about the current target.
LabelDecl * getDecl() const
Expr - This represents one expression.
const Expr * getInputExpr(unsigned i) const
bool capturesVariable(const VarDecl *Var) const
True if this variable has been captured.
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "while" statement, if any.
AsmStringPiece - this is part of a decomposed asm string specification (for use with the AnalyzeAsmSt...
LabelDecl * getConstantTarget()
getConstantTarget - Returns the fixed target of this indirect goto, if one exists.
StringRef getInputName(unsigned i) const
static StringRef copyIntoContext(const ASTContext &C, StringRef str)
This represents a Microsoft inline-assembly statement extension.
Expr * getInputExpr(unsigned i)
Expr * getOutputExpr(unsigned i)
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.
The result type of a method or function.
static SEHFinallyStmt * Create(const ASTContext &C, SourceLocation FinallyLoc, Stmt *Block)
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
const StringLiteral * getAsmString() const
This captures a statement into a function.
Encodes a location in the source.
char getModifier() const
getModifier - Get the modifier for this operand, if present.
const char * getNameStart() const
Return the beginning of the actual null-terminated string for this identifier.
void setConstexpr(bool C)
VariableCaptureKind getCaptureKind() const
Determine the kind of capture.
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
LabelDecl - Represents the declaration of a label.
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)
void setConditionVariable(const ASTContext &C, VarDecl *V)
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "switch" statement, if any.
SEHExceptStmt * getExceptHandler() const
Returns 0 if not defined.
Expr * getInputExpr(unsigned i)
SourceLocation getBegin() const
const T * castAs() const
Member-template castAs<specific type>.
StringRef getOutputName(unsigned i) const
SourceRange getSourceRange() const override LLVM_READONLY
const Decl * getSingleDecl() const
AddrLabelExpr - The GNU address of label extension, representing &&label.
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "if" statement, if any.
CompoundStmt(const ASTContext &C, ArrayRef< Stmt * > Stmts, SourceLocation LB, SourceLocation RB)
unsigned AnalyzeAsmString(SmallVectorImpl< AsmStringPiece > &Pieces, const ASTContext &C, unsigned &DiagOffs) const
AnalyzeAsmString - Analyze the asm string of the current asm, decomposing it into pieces...
static CapturedStmt * CreateDeserialized(const ASTContext &Context, unsigned NumCaptures)
const StringLiteral * getOutputConstraintLiteral(unsigned i) const
StringRef getString() const
static LLVM_ATTRIBUTE_UNUSED void check_implementations()
Check whether the various Stmt classes implement their member functions.
detail::InMemoryDirectory::const_iterator E
const Expr * getRetValue() const
void setConditionVariable(const ASTContext &C, VarDecl *V)
This file defines OpenMP AST classes for executable directives and clauses.
SwitchStmt(const ASTContext &C, Stmt *Init, VarDecl *Var, Expr *cond)
int getNamedOperand(StringRef SymbolicName) const
getNamedOperand - Given a symbolic operand reference like %[foo], translate this into a numeric value...
unsigned getNumPlusOperands() const
getNumPlusOperands - Return the number of output operands that have a "+" constraint.
Base for LValueReferenceType and RValueReferenceType.
ForStmt(const ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar, Expr *Inc, Stmt *Body, SourceLocation FL, SourceLocation LP, SourceLocation RP)
StringRef getClobber(unsigned i) const
SourceManager & getSourceManager()
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
const StringLiteral * getInputConstraintLiteral(unsigned i) const
void * Allocate(size_t Size, unsigned Align=8) 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.
Defines the clang::TargetInfo interface.
StringRef getOutputConstraint(unsigned i) const
getOutputConstraint - Return the constraint string for the specified output operand.
CapturedRegionKind
The different kinds of captured statement.
static StmtClassNameTable & getStmtInfoTableEntry(Stmt::StmtClass E)
A trivial tuple used to represent a source range.
SourceLocation getLocationOfByte(unsigned ByteNo, const SourceManager &SM, const LangOptions &Features, const TargetInfo &Target, unsigned *StartToken=nullptr, unsigned *StartTokenByteOffset=nullptr) const
getLocationOfByte - Return a source location that points to the specified byte of this string literal...
const char * getName() const
static SEHExceptStmt * Create(const ASTContext &C, SourceLocation ExceptLoc, Expr *FilterExpr, Stmt *Block)
This class handles loading and caching of source files into memory.
void setCapturedRegionKind(CapturedRegionKind Kind)
Set the captured region kind.
Attr - This represents one attribute.
SEHFinallyStmt * getFinallyHandler() const
#define BLOCK(DERIVED, BASE)