31 #include "llvm/ADT/SmallVector.h" 32 #include "llvm/ADT/StringExtras.h" 33 #include "llvm/ADT/StringRef.h" 34 #include "llvm/Support/Casting.h" 35 #include "llvm/Support/Compiler.h" 36 #include "llvm/Support/ErrorHandling.h" 37 #include "llvm/Support/MathExtras.h" 38 #include "llvm/Support/raw_ostream.h" 45 using namespace clang;
60 #define ABSTRACT_STMT(STMT) 61 #define STMT(CLASS, PARENT) \ 62 StmtClassInfo[(unsigned)Stmt::CLASS##Class].Name = #CLASS; \ 63 StmtClassInfo[(unsigned)Stmt::CLASS##Class].Size = sizeof(CLASS); 64 #include "clang/AST/StmtNodes.inc" 71 return ::operator
new(
bytes,
C, alignment);
83 llvm::errs() <<
"\n*** Stmt/Expr Stats:\n";
84 for (
int i = 0; i != Stmt::lastStmtConstant+1; i++) {
88 llvm::errs() <<
" " << sum <<
" stmts/exprs total.\n";
90 for (
int i = 0; i != Stmt::lastStmtConstant+1; i++) {
100 llvm::errs() <<
"Total bytes = " << sum <<
"\n";
107 bool Stmt::StatisticsEnabled =
false;
109 StatisticsEnabled =
true;
115 if (
auto *ewc = dyn_cast<ExprWithCleanups>(s))
116 s = ewc->getSubExpr();
118 if (
auto *mte = dyn_cast<MaterializeTemporaryExpr>(s))
119 s = mte->GetTemporaryExpr();
121 if (
auto *bte = dyn_cast<CXXBindTemporaryExpr>(s))
122 s = bte->getSubExpr();
124 while (
auto *ice = dyn_cast<ImplicitCastExpr>(s))
125 s = ice->getSubExpr();
135 if (
auto CapS = dyn_cast_or_null<CapturedStmt>(S))
136 S = CapS->getCapturedStmt();
138 if (
auto AS = dyn_cast_or_null<AttributedStmt>(S))
139 S = AS->getSubStmt();
140 else if (
auto CS = dyn_cast_or_null<CompoundStmt>(S)) {
155 const Stmt *S =
this;
157 if (
const LabelStmt *LS = dyn_cast<LabelStmt>(S))
158 S = LS->getSubStmt();
159 else if (
const SwitchCase *SC = dyn_cast<SwitchCase>(S))
160 S = SC->getSubStmt();
162 S = AS->getSubStmt();
176 static inline good is_good(good) {
return good(); }
179 template <
class T> good implements_children(children_t
T::*) {
182 LLVM_ATTRIBUTE_UNUSED
183 static inline bad implements_children(children_t
Stmt::*) {
188 template <
class T> good implements_getLocStart(getLocStart_t
T::*) {
191 LLVM_ATTRIBUTE_UNUSED
192 static inline bad implements_getLocStart(getLocStart_t
Stmt::*) {
197 template <
class T> good implements_getLocEnd(getLocEnd_t
T::*) {
200 LLVM_ATTRIBUTE_UNUSED
201 static inline bad implements_getLocEnd(getLocEnd_t
Stmt::*) {
205 #define ASSERT_IMPLEMENTS_children(type) \ 206 (void) is_good(implements_children(&type::children)) 207 #define ASSERT_IMPLEMENTS_getLocStart(type) \ 208 (void) is_good(implements_getLocStart(&type::getLocStart)) 209 #define ASSERT_IMPLEMENTS_getLocEnd(type) \ 210 (void) is_good(implements_getLocEnd(&type::getLocEnd)) 216 LLVM_ATTRIBUTE_UNUSED
218 #define ABSTRACT_STMT(type) 219 #define STMT(type, base) \ 220 ASSERT_IMPLEMENTS_children(type); \ 221 ASSERT_IMPLEMENTS_getLocStart(type); \ 222 ASSERT_IMPLEMENTS_getLocEnd(type); 223 #include "clang/AST/StmtNodes.inc" 227 switch (getStmtClass()) {
229 #define ABSTRACT_STMT(type) 230 #define STMT(type, base) \ 231 case Stmt::type##Class: \ 232 return static_cast<type*>(this)->children(); 233 #include "clang/AST/StmtNodes.inc" 235 llvm_unreachable(
"unknown statement kind!");
246 template <
class S,
class T>
259 return SourceRange(static_cast<const S*>(stmt)->getLocStart(),
260 static_cast<const S*>(stmt)->getLocEnd());
266 switch (getStmtClass()) {
268 #define ABSTRACT_STMT(type) 269 #define STMT(type, base) \ 270 case Stmt::type##Class: \ 271 return getSourceRangeImpl<type>(this, &type::getSourceRange); 272 #include "clang/AST/StmtNodes.inc" 274 llvm_unreachable(
"unknown statement kind!");
279 switch (getStmtClass()) {
281 #define ABSTRACT_STMT(type) 282 #define STMT(type, base) \ 283 case Stmt::type##Class: \ 284 return static_cast<const type*>(this)->getLocStart(); 285 #include "clang/AST/StmtNodes.inc" 287 llvm_unreachable(
"unknown statement kind");
291 switch (getStmtClass()) {
293 #define ABSTRACT_STMT(type) 294 #define STMT(type, base) \ 295 case Stmt::type##Class: \ 296 return static_cast<const type*>(this)->getLocEnd(); 297 #include "clang/AST/StmtNodes.inc" 299 llvm_unreachable(
"unknown statement kind");
304 :
Stmt(CompoundStmtClass), LBraceLoc(LB), RBraceLoc(RB) {
305 CompoundStmtBits.NumStmts = Stmts.size();
310 assert(CompoundStmtBits.NumStmts == Stmts.size() &&
311 "NumStmts doesn't fit in bits of CompoundStmtBits.NumStmts!");
313 std::copy(Stmts.begin(), Stmts.end(), body_begin());
333 return getDecl()->getIdentifier()->getNameStart();
339 assert(!Attrs.empty() &&
"Attrs should not be empty");
340 void *Mem = C.
Allocate(totalSizeToAlloc<const Attr *>(Attrs.size()),
347 assert(NumAttrs > 0 &&
"NumAttrs should be greater than zero");
348 void *Mem = C.
Allocate(totalSizeToAlloc<const Attr *>(NumAttrs),
354 if (
const GCCAsmStmt *gccAsmStmt = dyn_cast<GCCAsmStmt>(
this))
355 return gccAsmStmt->generateAsmString(C);
356 if (
const MSAsmStmt *msAsmStmt = dyn_cast<MSAsmStmt>(
this))
357 return msAsmStmt->generateAsmString(C);
358 llvm_unreachable(
"unknown asm statement kind!");
362 if (
const GCCAsmStmt *gccAsmStmt = dyn_cast<GCCAsmStmt>(
this))
363 return gccAsmStmt->getOutputConstraint(i);
364 if (
const MSAsmStmt *msAsmStmt = dyn_cast<MSAsmStmt>(
this))
365 return msAsmStmt->getOutputConstraint(i);
366 llvm_unreachable(
"unknown asm statement kind!");
370 if (
const GCCAsmStmt *gccAsmStmt = dyn_cast<GCCAsmStmt>(
this))
371 return gccAsmStmt->getOutputExpr(i);
372 if (
const MSAsmStmt *msAsmStmt = dyn_cast<MSAsmStmt>(
this))
373 return msAsmStmt->getOutputExpr(i);
374 llvm_unreachable(
"unknown asm statement kind!");
378 if (
const GCCAsmStmt *gccAsmStmt = dyn_cast<GCCAsmStmt>(
this))
379 return gccAsmStmt->getInputConstraint(i);
380 if (
const MSAsmStmt *msAsmStmt = dyn_cast<MSAsmStmt>(
this))
381 return msAsmStmt->getInputConstraint(i);
382 llvm_unreachable(
"unknown asm statement kind!");
386 if (
const GCCAsmStmt *gccAsmStmt = dyn_cast<GCCAsmStmt>(
this))
387 return gccAsmStmt->getInputExpr(i);
388 if (
const MSAsmStmt *msAsmStmt = dyn_cast<MSAsmStmt>(
this))
389 return msAsmStmt->getInputExpr(i);
390 llvm_unreachable(
"unknown asm statement kind!");
394 if (
const GCCAsmStmt *gccAsmStmt = dyn_cast<GCCAsmStmt>(
this))
395 return gccAsmStmt->getClobber(i);
396 if (
const MSAsmStmt *msAsmStmt = dyn_cast<MSAsmStmt>(
this))
397 return msAsmStmt->getClobber(i);
398 llvm_unreachable(
"unknown asm statement kind!");
405 for (
unsigned i = 0, e = getNumOutputs(); i != e; ++i)
406 if (isOutputPlusConstraint(i))
412 assert(isOperand() &&
"Only Operands can have modifiers.");
413 return isLetter(Str[0]) ? Str[0] :
'\0';
417 return getClobberStringLiteral(i)->getString();
421 return cast<Expr>(Exprs[i]);
428 return getOutputConstraintLiteral(i)->getString();
432 return cast<Expr>(Exprs[i + NumOutputs]);
436 Exprs[i + NumOutputs] = E;
442 return getInputConstraintLiteral(i)->getString();
445 void GCCAsmStmt::setOutputsAndInputsAndClobbers(
const ASTContext &
C,
452 unsigned NumClobbers) {
453 this->NumOutputs = NumOutputs;
454 this->NumInputs = NumInputs;
455 this->NumClobbers = NumClobbers;
457 unsigned NumExprs = NumOutputs + NumInputs;
461 std::copy(Names, Names + NumExprs, this->Names);
464 this->Exprs =
new (
C)
Stmt*[NumExprs];
465 std::copy(Exprs, Exprs + NumExprs, this->Exprs);
469 std::copy(Constraints, Constraints + NumExprs, this->Constraints);
473 std::copy(Clobbers, Clobbers + NumClobbers, this->Clobbers);
480 unsigned NumPlusOperands = 0;
483 for (
unsigned i = 0, e = getNumOutputs(); i != e; ++i) {
484 if (getOutputName(i) == SymbolicName)
488 for (
unsigned i = 0, e = getNumInputs(); i != e; ++i)
489 if (getInputName(i) == SymbolicName)
490 return getNumOutputs() + NumPlusOperands + i;
500 const ASTContext &C,
unsigned &DiagOffs)
const {
501 StringRef Str = getAsmString()->getString();
502 const char *StrStart = Str.begin();
503 const char *StrEnd = Str.end();
504 const char *CurPtr = StrStart;
510 for (; CurPtr != StrEnd; ++CurPtr) {
526 std::string CurStringPiece;
530 unsigned LastAsmStringToken = 0;
531 unsigned LastAsmStringOffset = 0;
535 if (CurPtr == StrEnd) {
536 if (!CurStringPiece.empty())
541 char CurChar = *CurPtr++;
543 case '$': CurStringPiece +=
"$$";
continue;
544 case '{': CurStringPiece += (HasVariants ?
"$(" :
"{");
continue;
545 case '|': CurStringPiece += (HasVariants ?
"$|" :
"|");
continue;
546 case '}': CurStringPiece += (HasVariants ?
"$)" :
"}");
continue;
550 CurStringPiece += CurChar;
555 if (CurPtr == StrEnd) {
557 DiagOffs = CurPtr-StrStart-1;
558 return diag::err_asm_invalid_escape;
561 char EscapedChar = *CurPtr++;
562 switch (EscapedChar) {
568 CurStringPiece += EscapedChar;
571 CurStringPiece +=
"${:uid}";
577 if (!CurStringPiece.empty()) {
579 CurStringPiece.clear();
585 const char *
Begin = CurPtr - 1;
586 const char *Percent = Begin - 1;
589 if (CurPtr == StrEnd) {
590 DiagOffs = CurPtr-StrStart-1;
591 return diag::err_asm_invalid_escape;
593 EscapedChar = *CurPtr++;
606 while (CurPtr != StrEnd &&
isDigit(*CurPtr))
607 N = N*10 + ((*CurPtr++)-
'0');
609 unsigned NumOperands =
610 getNumOutputs() + getNumPlusOperands() + getNumInputs();
611 if (N >= NumOperands) {
612 DiagOffs = CurPtr-StrStart-1;
613 return diag::err_asm_invalid_operand_number;
617 std::string Str(Begin, CurPtr - Begin);
622 Percent - StrStart, SM, LO, TI, &LastAsmStringToken,
623 &LastAsmStringOffset);
625 CurPtr - StrStart, SM, LO, TI, &LastAsmStringToken,
626 &LastAsmStringOffset);
628 Pieces.emplace_back(N, std::move(Str), BeginLoc, EndLoc);
633 if (EscapedChar ==
'[') {
634 DiagOffs = CurPtr-StrStart-1;
637 const char *NameEnd = (
const char*)memchr(CurPtr,
']', StrEnd-CurPtr);
638 if (NameEnd ==
nullptr)
639 return diag::err_asm_unterminated_symbolic_operand_name;
640 if (NameEnd == CurPtr)
641 return diag::err_asm_empty_symbolic_operand_name;
643 StringRef SymbolicName(CurPtr, NameEnd - CurPtr);
645 int N = getNamedOperand(SymbolicName);
648 DiagOffs = CurPtr-StrStart;
649 return diag::err_asm_unknown_symbolic_operand_name;
653 std::string Str(Begin, NameEnd + 1 - Begin);
658 Percent - StrStart, SM, LO, TI, &LastAsmStringToken,
659 &LastAsmStringOffset);
661 NameEnd + 1 - StrStart, SM, LO, TI, &LastAsmStringToken,
662 &LastAsmStringOffset);
664 Pieces.emplace_back(N, std::move(Str), BeginLoc, EndLoc);
670 DiagOffs = CurPtr-StrStart-1;
671 return diag::err_asm_invalid_escape;
681 AnalyzeAsmString(Pieces, C, DiagOffs);
683 std::string AsmString;
684 for (
unsigned i = 0, e = Pieces.size(); i != e; ++i) {
685 if (Pieces[i].isString())
686 AsmString += Pieces[i].getString();
688 AsmString +=
'$' + llvm::utostr(Pieces[i].getOperandNo());
690 AsmString +=
"${" + llvm::utostr(Pieces[i].getOperandNo()) +
':' +
691 Pieces[i].getModifier() +
'}';
703 return cast<Expr>(Exprs[i]);
707 return cast<Expr>(Exprs[i + NumOutputs]);
711 Exprs[i + NumOutputs] = E;
719 bool issimple,
bool isvolatile,
unsigned numoutputs,
724 :
AsmStmt(GCCAsmStmtClass, asmloc, issimple, isvolatile, numoutputs,
725 numinputs, numclobbers), RParenLoc(rparenloc), AsmStr(asmstr) {
729 std::copy(names, names + NumExprs, Names);
731 Exprs =
new (
C)
Stmt*[NumExprs];
732 std::copy(exprs, exprs + NumExprs, Exprs);
735 std::copy(constraints, constraints + NumExprs, Constraints);
738 std::copy(clobbers, clobbers +
NumClobbers, Clobbers);
748 :
AsmStmt(MSAsmStmtClass, asmloc, issimple, isvolatile, numoutputs,
749 numinputs, clobbers.size()), LBraceLoc(lbraceloc),
750 EndLoc(endloc), NumAsmToks(asmtoks.size()) {
751 initialize(C, asmstr, asmtoks, constraints, exprs, clobbers);
758 void MSAsmStmt::initialize(
const ASTContext &C, StringRef asmstr,
763 assert(NumAsmToks == asmtoks.size());
767 assert(exprs.size() == constraints.size());
771 Exprs =
new (
C)
Stmt*[exprs.size()];
772 std::copy(exprs.begin(), exprs.end(),
Exprs);
774 AsmToks =
new (
C)
Token[asmtoks.size()];
775 std::copy(asmtoks.begin(), asmtoks.end(), AsmToks);
777 Constraints =
new (
C) StringRef[exprs.size()];
778 std::transform(constraints.begin(), constraints.end(), Constraints,
779 [&](StringRef Constraint) {
785 std::transform(clobbers.begin(), clobbers.end(), Clobbers,
786 [&](StringRef Clobber) {
794 :
Stmt(IfStmtClass), IfLoc(IL), ElseLoc(EL) {
797 SubExprs[INIT] = init;
798 SubExprs[COND] = cond;
799 SubExprs[THEN] = then;
800 SubExprs[ELSE] = elsev;
807 DeclStmt *DS = cast<DeclStmt>(SubExprs[VAR]);
813 SubExprs[VAR] =
nullptr;
823 return isa<ObjCAvailabilityCheckExpr>(SubExprs[COND]);
829 :
Stmt(ForStmtClass), ForLoc(FL), LParenLoc(LP), RParenLoc(RP)
831 SubExprs[INIT] = Init;
833 SubExprs[COND] = Cond;
835 SubExprs[BODY] = Body;
839 if (!SubExprs[CONDVAR])
842 DeclStmt *DS = cast<DeclStmt>(SubExprs[CONDVAR]);
848 SubExprs[CONDVAR] =
nullptr;
859 :
Stmt(SwitchStmtClass), FirstCase(nullptr,
false) {
861 SubExprs[INIT] = init;
862 SubExprs[COND] = cond;
863 SubExprs[BODY] =
nullptr;
870 DeclStmt *DS = cast<DeclStmt>(SubExprs[VAR]);
876 SubExprs[VAR] =
nullptr;
886 if (isa<CaseStmt>(
this))
887 return cast<CaseStmt>(
this)->getSubStmt();
888 return cast<DefaultStmt>(
this)->getSubStmt();
893 :
Stmt(WhileStmtClass) {
895 SubExprs[COND] = cond;
896 SubExprs[BODY] = body;
904 DeclStmt *DS = cast<DeclStmt>(SubExprs[VAR]);
910 SubExprs[VAR] =
nullptr;
922 dyn_cast<AddrLabelExpr>(getTarget()->IgnoreParenImpCasts()))
923 return E->getLabel();
929 return cast_or_null<Expr>(RetExpr);
932 return cast_or_null<Expr>(RetExpr);
937 :
Stmt(SEHTryStmtClass), IsCXXTry(IsCXXTry), TryLoc(TryLoc) {
938 Children[TRY] = TryBlock;
939 Children[HANDLER] = Handler;
945 return new(
C)
SEHTryStmt(IsCXXTry,TryLoc,TryBlock,Handler);
957 :
Stmt(SEHExceptStmtClass), Loc(Loc) {
958 Children[FILTER_EXPR] = FilterExpr;
959 Children[
BLOCK] = Block;
968 :
Stmt(SEHFinallyStmtClass), Loc(Loc), Block(Block) {}
977 : VarAndKind(Var, Kind), Loc(Loc) {
980 assert(!Var &&
"'this' capture cannot have a variable!");
983 assert(Var &&
"capturing by reference must have a variable!");
986 assert(Var &&
"capturing by copy must have a variable!");
993 "captures by copy are expected to have a scalar type!");
997 "Variable-length array type capture cannot have a variable!");
1004 return VarAndKind.getInt();
1009 "No variable available for 'this' or VAT capture");
1010 return VarAndKind.getPointer();
1017 unsigned FirstCaptureOffset = llvm::alignTo(Size,
alignof(
Capture));
1019 return reinterpret_cast<Capture *
>(
1020 reinterpret_cast<char *
>(
const_cast<CapturedStmt *
>(
this))
1021 + FirstCaptureOffset);
1029 :
Stmt(CapturedStmtClass), NumCaptures(Captures.size()),
1030 CapDeclAndKind(CD,
Kind), TheRecordDecl(RD) {
1031 assert( S &&
"null captured statement");
1032 assert(CD &&
"null captured declaration for captured statement");
1033 assert(RD &&
"null record declaration for captured statement");
1036 Stmt **Stored = getStoredStmts();
1037 for (
unsigned I = 0, N = NumCaptures; I != N; ++I)
1038 *Stored++ = CaptureInits[I];
1044 Capture *Buffer = getStoredCaptures();
1045 std::copy(Captures.begin(), Captures.end(), Buffer);
1048 CapturedStmt::CapturedStmt(
EmptyShell Empty,
unsigned NumCaptures)
1049 :
Stmt(CapturedStmtClass, Empty), NumCaptures(NumCaptures),
1051 getStoredStmts()[NumCaptures] =
nullptr;
1069 assert(CaptureInits.size() == Captures.size() &&
"wrong number of arguments");
1071 unsigned Size =
sizeof(
CapturedStmt) +
sizeof(
Stmt *) * (Captures.size() + 1);
1072 if (!Captures.empty()) {
1074 Size = llvm::alignTo(Size,
alignof(
Capture));
1075 Size +=
sizeof(
Capture) * Captures.size();
1078 void *Mem = Context.
Allocate(Size);
1079 return new (Mem)
CapturedStmt(S, Kind, Captures, CaptureInits, CD, RD);
1083 unsigned NumCaptures) {
1085 if (NumCaptures > 0) {
1087 Size = llvm::alignTo(Size,
alignof(
Capture));
1088 Size +=
sizeof(
Capture) * NumCaptures;
1091 void *Mem = Context.
Allocate(Size);
1097 return child_range(getStoredStmts(), getStoredStmts() + NumCaptures);
1101 return CapDeclAndKind.getPointer();
1105 return CapDeclAndKind.getPointer();
1110 assert(D &&
"null CapturedDecl");
1111 CapDeclAndKind.setPointer(D);
1116 return CapDeclAndKind.getInt();
1121 CapDeclAndKind.setInt(Kind);
1126 if (!I.capturesVariable() && !I.capturesVariableByCopy())
static AttributedStmt * CreateEmpty(const ASTContext &C, unsigned NumAttrs)
void setConditionVariable(const ASTContext &C, VarDecl *V)
Defines the clang::ASTContext interface.
Capture(SourceLocation Loc, VariableCaptureKind Kind, VarDecl *Var=nullptr)
Create a new capture.
This represents a GCC inline-assembly statement extension.
const internal::VariadicAllOfMatcher< Stmt > stmt
Matches statements.
Stmt - This represents one statement.
VarDecl * getCapturedVar() const
Retrieve the declaration of the variable being captured.
C Language Family Type Representation.
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)
llvm::iterator_range< child_iterator > child_range
const TargetInfo & getTargetInfo() const
Stmt * IgnoreImplicit()
Skip past any implicit AST nodes which might surround this statement, such as ExprWithCleanups or Imp...
static AttributedStmt * Create(const ASTContext &C, SourceLocation Loc, ArrayRef< const Attr *> Attrs, Stmt *SubStmt)
static void addStmtClass(const StmtClass s)
void setConditionVariable(const ASTContext &C, VarDecl *V)
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "while" statement, if any.
bool capturesVariable(const VarDecl *Var) const
True if this variable has been captured.
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...
unsigned AnalyzeAsmString(SmallVectorImpl< AsmStringPiece > &Pieces, const ASTContext &C, unsigned &DiagOffs) const
AnalyzeAsmString - Analyze the asm string of the current asm, decomposing it into pieces...
const char * getName() const
Defines the Objective-C statement AST node classes.
static StringRef bytes(const std::vector< T, Allocator > &v)
int getNamedOperand(StringRef SymbolicName) const
getNamedOperand - Given a symbolic operand reference like %[foo], translate this into a numeric value...
Defines the clang::Expr interface and subclasses for C++ expressions.
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "switch" statement, if any.
Stmt(StmtClass SC, EmptyShell)
Construct an empty statement.
static struct StmtClassNameTable StmtClassInfo[Stmt::lastStmtConstant+1]
const char * getStmtClassName() const
LabelStmt - Represents a label, which has a substatement.
RecordDecl - Represents a struct/union/class.
One of these records is kept for each identifier that is lexed.
IfStmt(const ASTContext &C, SourceLocation IL, bool IsConstexpr, Stmt *init, VarDecl *var, Expr *cond, Stmt *then, SourceLocation EL=SourceLocation(), Stmt *elsev=nullptr)
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)
LLVM_READONLY bool isLetter(unsigned char c)
Return true if this character is an ASCII letter: [a-zA-Z].
const Expr * getRetValue() const
bool isReferenceType() const
Token - This structure provides full information about a lexed token.
void setCapturedDecl(CapturedDecl *D)
Set the outlined function declaration.
bool hasNoAsmVariants() const
Return true if {|} are normal characters in the asm string.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
static CapturedStmt * Create(const ASTContext &Context, Stmt *S, CapturedRegionKind Kind, ArrayRef< Capture > Captures, ArrayRef< Expr *> CaptureInits, CapturedDecl *CD, RecordDecl *RD)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
const Expr * getOutputExpr(unsigned i) const
Expr * getOutputExpr(unsigned i)
static CompoundStmt * Create(const ASTContext &C, ArrayRef< Stmt *> Stmts, SourceLocation LB, SourceLocation RB)
std::string generateAsmString(const ASTContext &C) const
Assemble final IR asm string.
unsigned getNumPlusOperands() const
getNumPlusOperands - Return the number of output operands that have a "+" constraint.
bool isScalarType() const
This represents the body of a CapturedStmt, and serves as its DeclContext.
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "for" statement, if any.
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)
static SEHTryStmt * Create(const ASTContext &C, bool isCXXTry, SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler)
StringRef getClobber(unsigned i) const
CompoundStmt - This represents a group of statements like { stmt stmt }.
Describes the capture of either a variable, or 'this', or variable-length array type.
SourceLocation getLocEnd() const LLVM_READONLY
std::string generateAsmString(const ASTContext &C) const
Assemble final IR asm string.
Exposes information about the current target.
Expr - This represents one expression.
const FunctionProtoType * T
Stmt * IgnoreContainers(bool IgnoreCaptured=false)
Skip no-op (attributed, compound) container stmts and skip captured stmt at the top, if IgnoreCaptured is true.
const T * castAs() const
Member-template castAs<specific type>.
AsmStringPiece - this is part of a decomposed asm string specification (for use with the AnalyzeAsmSt...
VariableCaptureKind getCaptureKind() const
Determine the kind of capture.
LabelDecl * getConstantTarget()
getConstantTarget - Returns the fixed target of this indirect goto, if one exists.
CompoundStmtBitfields CompoundStmtBits
static StringRef copyIntoContext(const ASTContext &C, StringRef str)
This represents a Microsoft inline-assembly statement extension.
StringRef getInputConstraint(unsigned i) const
getInputConstraint - Return the specified input constraint.
SourceLocation getEnd() const
Expr * getInputExpr(unsigned i)
Expr * getOutputExpr(unsigned i)
StringRef getClobber(unsigned i) const
The result type of a method or function.
VarDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
static SEHFinallyStmt * Create(const ASTContext &C, SourceLocation FinallyLoc, Stmt *Block)
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
StringRef getInputConstraint(unsigned i) const
getInputConstraint - Return the specified input constraint.
This captures a statement into a function.
StringRef getOutputConstraint(unsigned i) const
getOutputConstraint - Return the constraint string for the specified output operand.
Encodes a location in the source.
std::string generateAsmString(const ASTContext &C) const
Assemble final IR asm string.
void setConstexpr(bool C)
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
LabelDecl - Represents the declaration of a label.
bool capturesVariable() const
Determine whether this capture handles a variable (by reference).
void setConditionVariable(const ASTContext &C, VarDecl *V)
StringRef getOutputConstraint(unsigned i) const
getOutputConstraint - Return the constraint string for the specified output operand.
Expr * getInputExpr(unsigned i)
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
A placeholder type used to construct an empty shell of a type, that will be filled in later (e...
void * Allocate(size_t Size, unsigned Align=8) const
AddrLabelExpr - The GNU address of label extension, representing &&label.
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "if" statement, if any.
Dataflow Directional Tag Classes.
static CapturedStmt * CreateDeserialized(const ASTContext &Context, unsigned NumCaptures)
const Stmt * stripLabelLikeStatements() const
Strip off all label-like statements.
SEHExceptStmt * getExceptHandler() const
Returns 0 if not defined.
const Decl * getSingleDecl() const
static LLVM_ATTRIBUTE_UNUSED void check_implementations()
Check whether the various Stmt classes implement their member functions.
char getModifier() const
getModifier - Get the modifier for this operand, if present.
bool isObjCAvailabilityCheck() const
static CompoundStmt * CreateEmpty(const ASTContext &C, unsigned NumStmts)
bool capturesVariableByCopy() const
Determine whether this capture handles a variable by copy.
LLVM_READONLY bool isDigit(unsigned char c)
Return true if this character is an ASCII digit: [0-9].
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)
Base for LValueReferenceType and RValueReferenceType.
const Expr * getInputExpr(unsigned i) const
ForStmt(const ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar, Expr *Inc, Stmt *Body, SourceLocation FL, SourceLocation LP, SourceLocation RP)
SourceManager & getSourceManager()
SEHFinallyStmt * getFinallyHandler() const
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
void Deallocate(void *Ptr) const
Defines the clang::SourceLocation class and associated facilities.
OpenMPLinearClauseKind getModifier() const
Return modifier.
VariableCaptureKind
The different capture forms: by 'this', by reference, capture for variable-length array type etc...
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
StringLiteral - This represents a string literal expression, e.g.
Defines the clang::TargetInfo interface.
CapturedRegionKind
The different kinds of captured statement.
static StmtClassNameTable & getStmtInfoTableEntry(Stmt::StmtClass E)
A trivial tuple used to represent a source range.
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation getBegin() const
const LangOptions & getLangOpts() 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.
CapturedRegionKind getCapturedRegionKind() const
Retrieve the captured region kind.
static void EnableStatistics()
#define BLOCK(DERIVED, BASE)