14 #ifndef LLVM_CLANG_AST_EXPR_H
15 #define LLVM_CLANG_AST_EXPR_H
27 #include "llvm/ADT/APFloat.h"
28 #include "llvm/ADT/APSInt.h"
29 #include "llvm/ADT/SmallVector.h"
30 #include "llvm/ADT/StringRef.h"
31 #include "llvm/Support/Compiler.h"
37 class CXXBaseSpecifier;
38 class CXXMemberCallExpr;
39 class CXXOperatorCallExpr;
43 class MaterializeTemporaryExpr;
45 class ObjCPropertyRefExpr;
46 class OpaqueValueExpr;
109 bool TD,
bool VD,
bool ID,
bool ContainsUnexpandedParameterPack)
112 ExprBits.TypeDependent = TD;
113 ExprBits.ValueDependent = VD;
114 ExprBits.InstantiationDependent =
ID;
115 ExprBits.ValueKind = VK;
116 ExprBits.ObjectKind = OK;
117 ExprBits.ContainsUnexpandedParameterPack = ContainsUnexpandedParameterPack;
122 explicit Expr(StmtClass SC, EmptyShell) :
Stmt(SC) { }
134 "Expressions can't have reference type");
150 ExprBits.ValueDependent = VD;
152 ExprBits.InstantiationDependent =
true;
170 ExprBits.TypeDependent = TD;
172 ExprBits.InstantiationDependent =
true;
193 return ExprBits.InstantiationDependent;
198 ExprBits.InstantiationDependent =
ID;
216 return ExprBits.ContainsUnexpandedParameterPack;
222 ExprBits.ContainsUnexpandedParameterPack = PP;
337 unsigned short Modifiable;
340 :
Kind(k), Modifiable(m)
348 assert(Modifiable !=
CM_Untested &&
"Did not test for modifiability.");
377 return ClassifyImpl(Ctx,
nullptr);
389 return ClassifyImpl(Ctx, &Loc);
396 return (isa<LValueReferenceType>(RT)
398 : (RT->getPointeeType()->isFunctionType()
470 return BT->getKind() == K;
489 bool isEvaluated =
true)
const;
528 const Expr **Culprit =
nullptr)
const;
597 bool IncludePossibleEffects =
true)
const;
695 return cast<Expr>(Stmt::IgnoreImplicit());
804 return T->getStmtClass() >= firstExprConstant &&
805 T->getStmtClass() <= lastExprConstant;
827 Expr *SourceExpr =
nullptr)
828 :
Expr(OpaqueValueExprClass, T, VK, OK,
829 T->isDependentType(),
830 T->isDependentType() ||
832 T->isInstantiationDependentType(),
834 SourceExpr(SourceExpr), Loc(Loc) {
843 :
Expr(OpaqueValueExprClass, Empty) { }
849 return SourceExpr ? SourceExpr->getLocStart() : Loc;
852 return SourceExpr ? SourceExpr->getLocEnd() : Loc;
855 if (SourceExpr)
return SourceExpr->
getExprLoc();
872 return T->getStmtClass() == OpaqueValueExprClass;
918 return const_cast<DeclRefExpr *
>(
this)->getInternalQualifierLoc();
923 bool hasFoundDecl()
const {
return DeclRefExprBits.HasFoundDecl; }
928 assert(hasFoundDecl());
930 return *
reinterpret_cast<NamedDecl **
>(&getInternalQualifierLoc() + 1);
931 return *
reinterpret_cast<NamedDecl **
>(
this + 1);
936 NamedDecl *getInternalFoundDecl()
const {
937 return const_cast<DeclRefExpr *
>(
this)->getInternalFoundDecl();
943 ValueDecl *D,
bool RefersToEnlosingVariableOrCapture,
951 :
Expr(DeclRefExprClass, Empty) { }
962 D(D), Loc(L), DNLoc(LocInfo) {
963 DeclRefExprBits.HasQualifier = 0;
964 DeclRefExprBits.HasTemplateKWAndArgsInfo = 0;
965 DeclRefExprBits.HasFoundDecl = 0;
966 DeclRefExprBits.HadMultipleCandidates = 0;
967 DeclRefExprBits.RefersToEnclosingVariableOrCapture =
968 RefersToEnclosingVariableOrCapture;
982 bool RefersToEnclosingVariableOrCapture,
991 bool HasTemplateKWAndArgsInfo,
992 unsigned NumTemplateArgs);
1026 return getInternalQualifierLoc();
1035 return hasFoundDecl() ? getInternalFoundDecl() : D;
1041 return hasFoundDecl() ? getInternalFoundDecl() : D;
1045 return DeclRefExprBits.HasTemplateKWAndArgsInfo;
1055 &getInternalFoundDecl() + 1);
1058 return reinterpret_cast<ASTTemplateKWAndArgsInfo *>(
1059 &getInternalQualifierLoc() + 1);
1147 return DeclRefExprBits.HadMultipleCandidates;
1153 DeclRefExprBits.HadMultipleCandidates = V;
1159 return DeclRefExprBits.RefersToEnclosingVariableOrCapture;
1163 return T->getStmtClass() == DeclRefExprClass;
1199 :
Expr(PredefinedExprClass, Empty), Loc(),
Type(
Func), FnName(nullptr) {}
1218 return T->getStmtClass() == PredefinedExprClass;
1222 child_range
children() {
return child_range(&FnName, &FnName + 1); }
1242 bool hasAllocation()
const {
return llvm::APInt::getNumWords(BitWidth) > 1; }
1251 unsigned NumWords = llvm::APInt::getNumWords(BitWidth);
1253 return llvm::APInt(BitWidth, NumWords,
pVal);
1255 return llvm::APInt(BitWidth,
VAL);
1270 llvm::APFloat
getValue(
const llvm::fltSemantics &Semantics)
const {
1283 :
Expr(IntegerLiteralClass, Empty) { }
1309 return T->getStmtClass() == IntegerLiteralClass;
1334 Value(value), Loc(l) {
1335 CharacterLiteralBits.Kind =
kind;
1343 return static_cast<CharacterKind>(CharacterLiteralBits.Kind);
1356 return T->getStmtClass() == CharacterLiteralClass;
1381 assert(&
getSemantics() == &Val.getSemantics() &&
"Inconsistent semantics");
1388 return static_cast<APFloatSemantics
>(FloatingLiteralBits.Semantics);
1394 FloatingLiteralBits.Semantics = Sem;
1403 bool isExact()
const {
return FloatingLiteralBits.IsExact; }
1404 void setExact(
bool E) { FloatingLiteralBits.IsExact = E; }
1418 return T->getStmtClass() == FloatingLiteralClass;
1440 :
Expr(ImaginaryLiteralClass, Empty) { }
1450 return T->getStmtClass() == ImaginaryLiteralClass;
1454 child_range
children() {
return child_range(&Val, &Val+1); }
1492 unsigned CharByteWidth : 4;
1494 unsigned IsPascal : 1;
1495 unsigned NumConcatenated;
1502 static int mapCharByteWidth(TargetInfo
const &target,
StringKind k);
1507 static StringLiteral *
Create(
const ASTContext &C, StringRef Str,
1509 const SourceLocation *Loc,
unsigned NumStrs);
1515 return Create(C, Str, Kind, Pascal, Ty, &Loc, 1);
1522 assert(CharByteWidth==1
1523 &&
"This function is used in places that assume strings use char");
1531 if (CharByteWidth == 1)
1533 if (CharByteWidth == 4)
1534 return StringRef(reinterpret_cast<const char*>(StrData.asUInt32),
1536 assert(CharByteWidth == 2 &&
"unsupported CharByteWidth");
1537 return StringRef(reinterpret_cast<const char*>(StrData.asUInt16),
1544 assert(i < Length &&
"out of bounds access");
1545 if (CharByteWidth == 1)
1546 return static_cast<unsigned char>(StrData.asChar[i]);
1547 if (CharByteWidth == 4)
1548 return StrData.asUInt32[i];
1549 assert(CharByteWidth == 2 &&
"unsupported CharByteWidth");
1550 return StrData.asUInt16[i];
1573 for (
unsigned i = 0, e = Str.size(); i != e; ++i)
1574 if (!
isASCII(Str[i]) || !Str[i])
1584 assert(TokNum < NumConcatenated &&
"Invalid tok number");
1585 return TokLocs[TokNum];
1588 assert(TokNum < NumConcatenated &&
"Invalid tok number");
1589 TokLocs[TokNum] = L;
1609 return TokLocs[NumConcatenated - 1];
1613 return T->getStmtClass() == StringLiteralClass;
1632 L(l), R(r), Val(val) {}
1636 :
Expr(ParenExprClass, Empty) { }
1654 return T->getStmtClass() == ParenExprClass;
1658 child_range
children() {
return child_range(&Val, &Val+1); }
1684 :
Expr(UnaryOperatorClass, type, VK, OK,
1688 type->isInstantiationDependentType()),
1690 Opc(opc), Loc(l), Val(input) {}
1756 return isPostfix() ? Val->getLocStart() : Loc;
1759 return isPostfix() ? Loc : Val->getLocEnd();
1764 return T->getStmtClass() == UnaryOperatorClass;
1768 child_range
children() {
return child_range(&Val, &Val+1); }
1804 enum { MaskBits = 2, Mask = 0x03 };
1824 : Range(LBracketLoc, RBracketLoc), Data((Index << 2) |
Array) { }
1829 : Range(DotLoc.isValid()? DotLoc : NameLoc, NameLoc),
1830 Data(reinterpret_cast<uintptr_t>(Field) |
OffsetOfNode::Field) { }
1835 : Range(DotLoc.isValid()? DotLoc : NameLoc, NameLoc),
1836 Data(reinterpret_cast<uintptr_t>(Name) |
Identifier) { }
1840 : Range(), Data(reinterpret_cast<uintptr_t>(Base) |
OffsetOfNode::Base) {}
1844 return static_cast<Kind>(Data & Mask);
1857 return reinterpret_cast<FieldDecl *
>(Data & ~(uintptr_t)Mask);
1896 explicit OffsetOfExpr(
unsigned numComps,
unsigned numExprs)
1897 :
Expr(OffsetOfExprClass, EmptyShell()),
1898 TSInfo(nullptr), NumComps(numComps), NumExprs(numExprs) {}
1902 static OffsetOfExpr *
Create(
const ASTContext &C, QualType
type,
1903 SourceLocation OperatorLoc, TypeSourceInfo *tsi,
1904 ArrayRef<OffsetOfNode> comps,
1905 ArrayRef<Expr*> exprs, SourceLocation RParenLoc);
1907 static OffsetOfExpr *
CreateEmpty(
const ASTContext &C,
1908 unsigned NumComps,
unsigned NumExprs);
1926 assert(Idx < NumComps &&
"Subscript out of range");
1927 return reinterpret_cast<const OffsetOfNode *
> (
this + 1)[Idx];
1931 assert(Idx < NumComps &&
"Subscript out of range");
1940 assert(Idx < NumExprs &&
"Subscript out of range");
1941 return reinterpret_cast<Expr **
>(
1942 reinterpret_cast<OffsetOfNode *
>(
this+1) + NumComps)[Idx];
1949 assert(Idx < NumComps &&
"Subscript out of range");
1950 reinterpret_cast<Expr **
>(
1951 reinterpret_cast<OffsetOfNode *
>(
this+1) + NumComps)[Idx] = E;
1962 return T->getStmtClass() == OffsetOfExprClass;
1970 return child_range(begin, begin + NumExprs);
1991 TInfo->
getType()->isDependentType(),
1992 TInfo->
getType()->isInstantiationDependentType(),
1994 OpLoc(op), RParenLoc(rp) {
1995 UnaryExprOrTypeTraitExprBits.Kind = ExprKind;
1996 UnaryExprOrTypeTraitExprBits.IsType =
true;
1997 Argument.Ty = TInfo;
2006 :
Expr(UnaryExprOrTypeTraitExprClass, Empty) { }
2018 assert(
isArgumentType() &&
"calling getArgumentType() when arg is expr");
2022 assert(!
isArgumentType() &&
"calling getArgumentExpr() when arg is type");
2023 return static_cast<Expr*
>(Argument.Ex);
2031 UnaryExprOrTypeTraitExprBits.IsType =
false;
2034 Argument.Ty = TInfo;
2035 UnaryExprOrTypeTraitExprBits.IsType =
true;
2054 return T->getStmtClass() == UnaryExprOrTypeTraitExprClass;
2067 enum { LHS, RHS, END_EXPR=2 };
2068 Stmt* SubExprs[END_EXPR];
2074 :
Expr(ArraySubscriptExprClass, t, VK, OK,
2081 RBracketLoc(rbracketloc) {
2082 SubExprs[LHS] = lhs;
2083 SubExprs[RHS] = rhs;
2088 :
Expr(ArraySubscriptExprClass, Shell) { }
2124 return getLHS()->getLocStart();
2136 return T->getStmtClass() == ArraySubscriptExprClass;
2141 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
2153 enum { FN=0, PREARGS_START=1 };
2167 assert(i <
getNumPreArgs() &&
"Prearg access out of range!");
2168 return SubExprs[PREARGS_START+i];
2171 assert(i <
getNumPreArgs() &&
"Prearg access out of range!");
2172 return SubExprs[PREARGS_START+i];
2175 assert(i <
getNumPreArgs() &&
"Prearg access out of range!");
2176 SubExprs[PREARGS_START+i] = PreArg;
2217 assert(Arg < NumArgs &&
"Arg access out of range!");
2218 return cast_or_null<Expr>(SubExprs[Arg +
getNumPreArgs() + PREARGS_START]);
2221 assert(Arg < NumArgs &&
"Arg access out of range!");
2222 return cast_or_null<Expr>(SubExprs[Arg +
getNumPreArgs() + PREARGS_START]);
2227 assert(Arg < NumArgs &&
"Arg access out of range!");
2262 return llvm::makeArrayRef(SubExprs,
2290 return T->getStmtClass() >= firstCallExprConstant &&
2291 T->getStmtClass() <= lastCallExprConstant;
2296 return child_range(&SubExprs[0],
2305 struct MemberNameQualifier {
2340 bool HasQualifierOrFoundDecl : 1;
2349 bool HasTemplateKWAndArgsInfo : 1;
2353 bool HadMultipleCandidates : 1;
2356 MemberNameQualifier *getMemberQualifier() {
2357 assert(HasQualifierOrFoundDecl);
2358 return reinterpret_cast<MemberNameQualifier *
> (
this + 1);
2362 const MemberNameQualifier *getMemberQualifier()
const {
2363 return const_cast<MemberExpr *
>(
this)->getMemberQualifier();
2373 Base(base), MemberDecl(memberdecl), MemberDNLoc(NameInfo.
getInfo()),
2374 MemberLoc(NameInfo.getLoc()), OperatorLoc(operatorloc),
2375 IsArrow(isarrow), HasQualifierOrFoundDecl(
false),
2376 HasTemplateKWAndArgsInfo(
false), HadMultipleCandidates(
false) {
2390 Base(base), MemberDecl(memberdecl), MemberDNLoc(), MemberLoc(l),
2391 OperatorLoc(operatorloc), IsArrow(isarrow),
2392 HasQualifierOrFoundDecl(
false), HasTemplateKWAndArgsInfo(
false),
2393 HadMultipleCandidates(
false) {}
2416 if (!HasQualifierOrFoundDecl)
2419 return getMemberQualifier()->FoundDecl;
2431 if (!HasQualifierOrFoundDecl)
2434 return getMemberQualifier()->QualifierLoc.getNestedNameSpecifier();
2444 return getMemberQualifier()->QualifierLoc;
2449 if (!HasTemplateKWAndArgsInfo)
2452 if (!HasQualifierOrFoundDecl)
2456 getMemberQualifier() + 1);
2543 MemberLoc, MemberDNLoc);
2569 return HadMultipleCandidates;
2575 HadMultipleCandidates = V;
2579 return T->getStmtClass() == MemberExprClass;
2600 llvm::PointerIntPair<TypeSourceInfo *, 1, bool> TInfoAndScope;
2606 tinfo->
getType()->isDependentType(),
2609 tinfo->
getType()->isInstantiationDependentType()),
2611 LParenLoc(lparenloc), TInfoAndScope(tinfo, fileScope), Init(init) {}
2615 :
Expr(CompoundLiteralExprClass, Empty) { }
2628 return TInfoAndScope.getPointer();
2631 TInfoAndScope.setPointer(tinfo);
2639 return Init->getLocStart();
2646 return Init->getLocEnd();
2650 return T->getStmtClass() == CompoundLiteralExprClass;
2654 child_range
children() {
return child_range(&Init, &Init+1); }
2665 bool CastConsistency()
const;
2668 return const_cast<CastExpr*
>(
this)->path_buffer();
2672 void setBasePathSize(
unsigned basePathSize) {
2673 CastExprBits.BasePathSize = basePathSize;
2674 assert(CastExprBits.BasePathSize == basePathSize &&
2675 "basePathSize doesn't fit in bits of CastExprBits.BasePathSize!");
2680 Expr *op,
unsigned BasePathSize)
2684 ty->isDependentType(),
2688 (ty->isInstantiationDependentType() ||
2692 ((SC != ImplicitCastExprClass &&
2696 assert(kind !=
CK_Invalid &&
"creating cast with invalid cast kind");
2697 CastExprBits.Kind =
kind;
2698 setBasePathSize(BasePathSize);
2699 assert(CastConsistency());
2703 CastExpr(StmtClass SC, EmptyShell Empty,
unsigned BasePathSize)
2705 setBasePathSize(BasePathSize);
2727 bool path_empty()
const {
return CastExprBits.BasePathSize == 0; }
2728 unsigned path_size()
const {
return CastExprBits.BasePathSize; }
2737 return T->getStmtClass() >= firstCastExprConstant &&
2738 T->getStmtClass() <= lastCastExprConstant;
2742 child_range
children() {
return child_range(&Op, &Op+1); }
2769 :
CastExpr(ImplicitCastExprClass, ty, VK, kind, op, BasePathLength) {
2774 :
CastExpr(ImplicitCastExprClass, Shell, PathSize) { }
2780 :
CastExpr(ImplicitCastExprClass, ty, VK, kind, op, 0) {
2799 return T->getStmtClass() == ImplicitCastExprClass;
2806 e = ice->getSubExpr();
2835 :
CastExpr(SC, exprTy, VK, kind, op, PathSize), TInfo(writtenTy) {}
2839 :
CastExpr(SC, Shell, PathSize) { }
2852 return T->getStmtClass() >= firstExplicitCastExprConstant &&
2853 T->getStmtClass() <= lastExplicitCastExprConstant;
2868 writtenTy), LPLoc(l), RPLoc(r) {}
2896 return T->getStmtClass() == CStyleCastExprClass;
2929 unsigned FPContractable : 1;
2932 enum { LHS, RHS, END_EXPR };
2933 Stmt* SubExprs[END_EXPR];
2939 :
Expr(BinaryOperatorClass, ResTy, VK, OK,
2946 Opc(opc), FPContractable(fpContractable), OpLoc(opLoc) {
2947 SubExprs[LHS] = lhs;
2948 SubExprs[RHS] = rhs;
2950 "Use CompoundAssignOperator for compound assignments");
2970 return getLHS()->getLocStart();
2973 return getRHS()->getLocEnd();
3013 llvm_unreachable(
"Not a comparsion operator.");
3026 llvm_unreachable(
"Not a comparsion operator.");
3067 return S->getStmtClass() >= firstBinaryOperatorConstant &&
3068 S->getStmtClass() <= lastBinaryOperatorConstant;
3073 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
3088 :
Expr(CompoundAssignOperatorClass, ResTy, VK, OK,
3095 Opc(opc), FPContractable(fpContractable), OpLoc(opLoc) {
3096 SubExprs[LHS] = lhs;
3097 SubExprs[RHS] = rhs;
3118 :
BinaryOperator(lhs, rhs, opc, ResType, VK, OK, OpLoc, fpContractable,
3120 ComputationLHSType(CompLHSType),
3121 ComputationResultType(CompResultType) {
3123 "Only should be used for compound assignments");
3140 return S->getStmtClass() == CompoundAssignOperatorClass;
3153 bool TD,
bool VD,
bool ID,
3154 bool ContainsUnexpandedParameterPack,
3157 :
Expr(SC, T, VK, OK, TD, VD, ID, ContainsUnexpandedParameterPack),
3158 QuestionLoc(qloc),
ColonLoc(cloc) {}
3161 :
Expr(SC, Empty) { }
3181 return T->getStmtClass() == ConditionalOperatorClass ||
3182 T->getStmtClass() == BinaryConditionalOperatorClass;
3189 enum { COND, LHS, RHS, END_EXPR };
3190 Stmt* SubExprs[END_EXPR];
3211 SubExprs[COND] = cond;
3212 SubExprs[LHS] = lhs;
3213 SubExprs[RHS] = rhs;
3237 return getCond()->getLocStart();
3240 return getRHS()->getLocEnd();
3244 return T->getStmtClass() == ConditionalOperatorClass;
3249 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
3259 enum { COMMON, COND, LHS, RHS, NUM_SUBEXPRS };
3266 Stmt *SubExprs[NUM_SUBEXPRS];
3283 OpaqueValue(opaqueValue) {
3284 SubExprs[COMMON] = common;
3285 SubExprs[COND] = cond;
3286 SubExprs[LHS] = lhs;
3287 SubExprs[RHS] = rhs;
3288 assert(OpaqueValue->
getSourceExpr() == common &&
"Wrong opaque value");
3311 return cast<Expr>(SubExprs[LHS]);
3318 return cast<Expr>(SubExprs[RHS]);
3329 return T->getStmtClass() == BinaryConditionalOperatorClass;
3334 return child_range(SubExprs, SubExprs + NUM_SUBEXPRS);
3340 return co->getCond();
3341 return cast<BinaryConditionalOperator>(
this)->
getCond();
3346 return co->getTrueExpr();
3347 return cast<BinaryConditionalOperator>(
this)->
getTrueExpr();
3352 return co->getFalseExpr();
3353 return cast<BinaryConditionalOperator>(
this)->
getFalseExpr();
3365 AmpAmpLoc(AALoc), LabelLoc(LLoc), Label(L) {}
3369 :
Expr(AddrLabelExprClass, Empty) { }
3383 return T->getStmtClass() == AddrLabelExprClass;
3407 SubStmt(substmt), LParenLoc(lp), RParenLoc(rp) { }
3425 return T->getStmtClass() == StmtExprClass;
3429 child_range
children() {
return child_range(&SubStmt, &SubStmt+1); }
3455 :
Expr(ShuffleVectorExprClass, Empty), SubExprs(nullptr) { }
3467 return T->getStmtClass() == ShuffleVectorExprClass;
3480 assert((Index < NumExprs) &&
"Arg access out of range!");
3481 return cast<Expr>(SubExprs[Index]);
3484 assert((Index < NumExprs) &&
"Arg access out of range!");
3485 return cast<Expr>(SubExprs[Index]);
3491 assert((N < NumExprs - 2) &&
"Shuffle idx out of range!");
3497 return child_range(&SubExprs[0], &SubExprs[0]+NumExprs);
3518 :
Expr(ConvertVectorExprClass, DstType, VK, OK,
3519 DstType->isDependentType(),
3521 (DstType->isInstantiationDependentType() ||
3525 SrcExpr(SrcExpr), TInfo(TI), BuiltinLoc(BuiltinLoc), RParenLoc(RParenLoc) {}
3548 return T->getStmtClass() == ConvertVectorExprClass;
3552 child_range
children() {
return child_range(&SrcExpr, &SrcExpr+1); }
3565 enum { COND, LHS, RHS, END_EXPR };
3566 Stmt* SubExprs[END_EXPR];
3573 bool TypeDependent,
bool ValueDependent)
3574 :
Expr(ChooseExprClass, t, VK, OK, TypeDependent, ValueDependent,
3581 BuiltinLoc(BLoc), RParenLoc(RP), CondIsTrue(condIsTrue) {
3582 SubExprs[COND] = cond;
3583 SubExprs[LHS] = lhs;
3584 SubExprs[RHS] = rhs;
3594 "Dependent condition isn't true or false");
3626 return T->getStmtClass() == ChooseExprClass;
3631 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
3662 return T->getStmtClass() == GNUNullExprClass;
3678 t->isDependentType(),
false,
3679 (TInfo->
getType()->isInstantiationDependentType() ||
3683 Val(e), TInfo(TInfo),
3685 RParenLoc(RPLoc) { }
3707 return T->getStmtClass() == VAArgExprClass;
3711 child_range
children() {
return child_range(&Val, &Val+1); }
3770 llvm::PointerIntPair<InitListExpr *, 1, bool> AltForm;
3779 llvm::PointerUnion<Expr *, FieldDecl *> ArrayFillerOrUnionFieldInit;
3787 :
Expr(InitListExprClass, Empty) { }
3795 assert(Init <
getNumInits() &&
"Initializer access out of range!");
3796 return cast_or_null<Expr>(InitExprs[Init]);
3800 assert(Init <
getNumInits() &&
"Initializer access out of range!");
3801 return cast_or_null<Expr>(InitExprs[Init]);
3805 assert(Init <
getNumInits() &&
"Initializer access out of range!");
3806 InitExprs[Init] =
expr;
3812 ExprBits.ContainsUnexpandedParameterPack |=
3841 return ArrayFillerOrUnionFieldInit.dyn_cast<
Expr *>();
3859 return ArrayFillerOrUnionFieldInit.dyn_cast<
FieldDecl *>();
3865 assert((FD ==
nullptr
3868 &&
"Only one field of a union may be initialized at a time!");
3869 ArrayFillerOrUnionFieldInit = FD;
3896 AltForm.setPointer(Init);
3897 AltForm.setInt(
true);
3898 Init->AltForm.setPointer(
this);
3899 Init->AltForm.setInt(
false);
3903 return InitListExprBits.HadArrayRangeDesignator != 0;
3906 InitListExprBits.HadArrayRangeDesignator = ARD;
3913 return T->getStmtClass() == InitListExprClass;
3919 if (InitExprs.
empty())
return child_range();
3920 return child_range(&InitExprs[0], &InitExprs[0] + InitExprs.
size());
3976 unsigned NumDesignators : 15;
3981 unsigned NumSubExprs : 16;
3994 :
Expr(DesignatedInitExprClass, EmptyShell()),
3995 NumDesignators(0), NumSubExprs(NumSubExprs), Designators(
nullptr) { }
4040 ArrayRangeDesignator
4066 :
Kind(ArrayDesignator) {
4076 :
Kind(ArrayRangeDesignator) {
4113 assert((
Kind == ArrayDesignator ||
Kind == ArrayRangeDesignator) &&
4114 "Only valid on an array or array-range designator");
4119 assert((
Kind == ArrayDesignator ||
Kind == ArrayRangeDesignator) &&
4120 "Only valid on an array or array-range designator");
4125 assert(
Kind == ArrayRangeDesignator &&
4126 "Only valid on an array-range designator");
4131 assert((
Kind == ArrayDesignator ||
Kind == ArrayRangeDesignator) &&
4132 "Only valid on an array or array-range designator");
4152 unsigned NumDesignators,
4155 bool GNUSyntax,
Expr *Init);
4158 unsigned NumIndexExprs);
4161 unsigned size()
const {
return NumDesignators; }
4167 return Designators + NumDesignators;
4173 return Designators + NumDesignators;
4181 typedef llvm::iterator_range<const_designators_iterator>
4187 typedef std::reverse_iterator<designators_iterator>
4196 typedef std::reverse_iterator<const_designators_iterator>
4208 unsigned NumDesigs);
4230 *child_begin() = init;
4240 assert(Idx < NumSubExprs &&
"Subscript out of range");
4241 return cast<Expr>(
reinterpret_cast<Stmt *
const *
>(
this + 1)[Idx]);
4245 assert(Idx < NumSubExprs &&
"Subscript out of range");
4246 reinterpret_cast<Stmt **
>(
this + 1)[Idx] = E;
4260 return T->getStmtClass() == DesignatedInitExprClass;
4265 Stmt **begin =
reinterpret_cast<Stmt**
>(
this + 1);
4266 return child_range(begin, begin + NumSubExprs);
4286 :
Expr(NoInitExprClass, Empty) { }
4289 return T->getStmtClass() == NoInitExprClass;
4313 Stmt *BaseAndUpdaterExprs[2];
4320 :
Expr(DesignatedInitUpdateExprClass, Empty) { }
4326 return T->getStmtClass() == DesignatedInitUpdateExprClass;
4333 return cast<InitListExpr>(BaseAndUpdaterExprs[1]);
4340 return child_range(&BaseAndUpdaterExprs[0], &BaseAndUpdaterExprs[0] + 2);
4360 :
Expr(ImplicitValueInitExprClass, Empty) { }
4363 return T->getStmtClass() == ImplicitValueInitExprClass;
4389 assert(Init <
getNumExprs() &&
"Initializer access out of range!");
4390 return cast_or_null<Expr>(Exprs[Init]);
4394 assert(Init <
getNumExprs() &&
"Initializer access out of range!");
4395 return cast_or_null<Expr>(Exprs[Init]);
4407 return T->getStmtClass() == ParenListExprClass;
4412 return child_range(&Exprs[0], &Exprs[0]+NumExprs);
4447 enum { CONTROLLING, END_EXPR };
4450 unsigned NumAssocs, ResultIndex;
4459 bool ContainsUnexpandedParameterPack,
4460 unsigned ResultIndex);
4468 bool ContainsUnexpandedParameterPack);
4471 :
Expr(GenericSelectionExprClass, Empty) { }
4480 return cast<Expr>(SubExprs[END_EXPR+i]);
4485 return AssocTypes[i];
4491 return TS->getType();
4497 return cast<Expr>(SubExprs[CONTROLLING]);
4521 return T->getStmtClass() == GenericSelectionExprClass;
4525 return child_range(SubExprs, SubExprs+END_EXPR+NumAssocs);
4550 :
Expr(ExtVectorElementExprClass, ty, VK,
4555 Base(base), Accessor(&accessor), AccessorLoc(loc) {}
4559 :
Expr(ExtVectorElementExprClass, Empty) { }
4583 return getBase()->getLocStart();
4592 return T->getStmtClass() == ExtVectorElementExprClass;
4608 ty->isDependentType(), ty->isDependentType(),
4609 ty->isInstantiationDependentType() || BD->isDependentContext(),
4632 return T->getStmtClass() == BlockExprClass;
4649 explicit AsTypeExpr(EmptyShell Empty) :
Expr(AsTypeExprClass, Empty) {}
4655 :
Expr(AsTypeExprClass, DstType, VK, OK,
4656 DstType->isDependentType(),
4658 (DstType->isInstantiationDependentType() ||
4662 SrcExpr(SrcExpr), BuiltinLoc(BuiltinLoc), RParenLoc(RParenLoc) {}
4677 return T->getStmtClass() == AsTypeExprClass;
4681 child_range
children() {
return child_range(&SrcExpr, &SrcExpr+1); }
4724 Expr **getSubExprsBuffer() {
return reinterpret_cast<Expr**
>(
this + 1); }
4725 const Expr *
const *getSubExprsBuffer()
const {
4726 return reinterpret_cast<const Expr *
const *
>(
this + 1);
4733 unsigned resultIndex);
4737 unsigned getNumSubExprs()
const {
4738 return PseudoObjectExprBits.NumSubExprs;
4748 unsigned resultIndex);
4751 unsigned numSemanticExprs);
4762 if (PseudoObjectExprBits.ResultIndex == 0)
return NoResult;
4763 return PseudoObjectExprBits.ResultIndex - 1;
4768 if (PseudoObjectExprBits.ResultIndex == 0)
4770 return getSubExprsBuffer()[PseudoObjectExprBits.ResultIndex];
4781 return getSubExprsBuffer() + 1;
4784 return getSubExprsBuffer() + 1;
4787 return getSubExprsBuffer() + getNumSubExprs();
4790 return getSubExprsBuffer() + getNumSubExprs();
4793 assert(index + 1 < getNumSubExprs());
4794 return getSubExprsBuffer()[index + 1];
4812 Stmt **cs =
reinterpret_cast<Stmt**
>(getSubExprsBuffer());
4813 return child_range(cs, cs + getNumSubExprs());
4817 return T->getStmtClass() == PseudoObjectExprClass;
4829 #define BUILTIN(ID, TYPE, ATTRS)
4830 #define ATOMIC_BUILTIN(ID, TYPE, ATTRS) AO ## ID,
4831 #include "clang/Basic/Builtins.def"
4847 enum { PTR, ORDER, VAL1, ORDER_FAIL, VAL2, WEAK, END_EXPR };
4848 Stmt* SubExprs[END_EXPR];
4849 unsigned NumSubExprs;
4850 SourceLocation BuiltinLoc, RParenLoc;
4867 return cast<Expr>(SubExprs[
PTR]);
4870 return cast<Expr>(SubExprs[ORDER]);
4873 if (Op == AO__c11_atomic_init)
4874 return cast<Expr>(SubExprs[ORDER]);
4875 assert(NumSubExprs > VAL1);
4876 return cast<Expr>(SubExprs[VAL1]);
4879 assert(NumSubExprs > ORDER_FAIL);
4880 return cast<Expr>(SubExprs[ORDER_FAIL]);
4883 if (Op == AO__atomic_exchange)
4884 return cast<Expr>(SubExprs[ORDER_FAIL]);
4885 assert(NumSubExprs > VAL2);
4886 return cast<Expr>(SubExprs[VAL2]);
4889 assert(NumSubExprs > WEAK);
4890 return cast<Expr>(SubExprs[WEAK]);
4903 return getOp() == AO__c11_atomic_compare_exchange_strong ||
4904 getOp() == AO__c11_atomic_compare_exchange_weak ||
4905 getOp() == AO__atomic_compare_exchange ||
4906 getOp() == AO__atomic_compare_exchange_n;
4916 return T->getStmtClass() == AtomicExprClass;
4921 return child_range(SubExprs, SubExprs+NumSubExprs);
4935 assert(T->
isDependentType() &&
"TypoExpr given a non-dependent type");
SourceLocation getRParenLoc() const
GenericSelectionExpr(const ASTContext &Context, SourceLocation GenericLoc, Expr *ControllingExpr, ArrayRef< TypeSourceInfo * > AssocTypes, ArrayRef< Expr * > AssocExprs, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool ContainsUnexpandedParameterPack, unsigned ResultIndex)
LValueClassification ClassifyLValue(ASTContext &Ctx) const
Reasons why an expression might not be an l-value.
Represents a single C99 designator.
SourceLocation getRParenLoc() const
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
void setCastPath(const CXXCastPath &Path)
reverse_designators_iterator designators_rbegin()
void setValueDependent(bool VD)
Set whether this expression is value-dependent or not.
tokloc_iterator tokloc_begin() const
unsigned getNumInits() const
SourceLocation getEnd() const
bool containsDuplicateElements() const
containsDuplicateElements - Return true if any element access is repeated.
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
SourceLocation getLocStart() const LLVM_READONLY
static std::string ComputeName(IdentType IT, const Decl *CurrentDecl)
CastKind getCastKind() const
ExprObjectKind getObjectKind() const
NamedDecl * getFoundDecl()
Get the NamedDecl through which this reference occurred.
void setSubStmt(CompoundStmt *S)
TypeSourceInfo * getTypeSourceInfo() const
void setPreArg(unsigned i, Stmt *PreArg)
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
SourceLocation getLocStart() const LLVM_READONLY
Expr ** getArgs()
Retrieve the call arguments.
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
BlockExpr(EmptyShell Empty)
Build an empty block expression.
ImplicitCastExpr(OnStack_t _, QualType ty, CastKind kind, Expr *op, ExprValueKind VK)
Expr * getSyntacticForm()
reverse_iterator rbegin()
void setArrayFiller(Expr *filler)
ASTTemplateKWAndArgsInfo * getTemplateKWAndArgsInfo()
Return the optional template keyword and arguments info.
bool hasTemplateKeyword() const
Determines whether the name in this declaration reference was preceded by the template keyword...
bool containsUnexpandedParameterPack() const
Whether this expression contains an unexpanded parameter pack (for C++11 variadic templates)...
bool isEvaluatable(const ASTContext &Ctx) const
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation getLocEnd() const LLVM_READONLY
void setOperatorLoc(SourceLocation L)
static Opcode getOpForCompoundAssignment(Opcode Opc)
bool isResultDependent() const
Whether this generic selection is result-dependent.
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
static StringLiteral * CreateEmpty(const ASTContext &C, unsigned NumStrs)
Construct an empty string literal.
void setRawSemantics(APFloatSemantics Sem)
Defines enumerations for the type traits support.
Expr(StmtClass SC, QualType T, ExprValueKind VK, ExprObjectKind OK, bool TD, bool VD, bool ID, bool ContainsUnexpandedParameterPack)
static const CastKind CK_Invalid
Expr * getExpr(unsigned Index)
getExpr - Return the Expr at the specified index.
DeclarationNameInfo getMemberNameInfo() const
Retrieve the member declaration name info.
Designator(unsigned Index, SourceLocation LBracketLoc, SourceLocation RBracketLoc)
Initializes an array designator.
unsigned FieldLoc
The location of the field name in the designated initializer.
CharacterLiteral(EmptyShell Empty)
Construct an empty character literal.
const Expr * getIdx() const
CompoundStmt * getSubStmt()
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding the member name, if any.
InitExprsTy::const_iterator const_iterator
SourceLocation getLocEnd() const LLVM_READONLY
Designator(const IdentifierInfo *FieldName, SourceLocation DotLoc, SourceLocation FieldLoc)
Initializes a field designator.
Expr * getControllingExpr()
CharacterKind getKind() const
Expr *const * semantics_iterator
DesignatedInitUpdateExpr(const ASTContext &C, SourceLocation lBraceLoc, Expr *baseExprs, SourceLocation rBraceLoc)
bool isArgumentType() const
CompoundLiteralExpr(EmptyShell Empty)
Construct an empty compound literal.
Expr * getInit() const
Retrieve the initializer value.
StmtExpr(CompoundStmt *substmt, QualType T, SourceLocation lp, SourceLocation rp)
tokloc_iterator tokloc_end() const
SourceLocation getLocEnd() const LLVM_READONLY
reverse_iterator rbegin()
TypeSourceInfo * getTypeSourceInfo() const
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
NestedNameSpecifier * getQualifier() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name...
void setSemantics(const llvm::fltSemantics &Sem)
Set the APFloat semantics this literal uses.
bool isMultiplicativeOp() const
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getLParenLoc() const
unsigned size() const
Returns the number of designators in this initializer.
static bool classof(const Stmt *T)
SourceLocation getLocEnd() const LLVM_READONLY
static bool classof(const Stmt *T)
const CastExpr * BasePath
void setComputationResultType(QualType T)
const Expr * getIndexExpr(unsigned Idx) const
const ASTTemplateKWAndArgsInfo * getTemplateKWAndArgsInfo() const
Return the optional template keyword and arguments info.
const ASTTemplateKWAndArgsInfo * getTemplateKWAndArgsInfo() const
Return the optional template keyword and arguments info.
Is the identifier known as a GNU-style attribute?
const char * getCastKindName() const
Kind
The kind of offsetof node we have.
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation getBuiltinLoc() const
getBuiltinLoc - Return the location of the __builtin_astype token.
ImplicitValueInitExpr(QualType ty)
SourceLocation getRBracketLoc() const
unsigned getResultIndex() const
SourceLocation getLabelLoc() const
InitListExpr * getSyntacticForm() const
const Expr * getResultExpr() const
CastExpr(StmtClass SC, EmptyShell Empty, unsigned BasePathSize)
Construct an empty cast.
static bool isShiftOp(Opcode Opc)
static ExprValueKind getValueKindForType(QualType T)
InitExprsTy::iterator iterator
SourceLocation getLocStart() const LLVM_READONLY
A container of type source information.
path_const_iterator path_end() const
SourceLocation getOperatorLoc() const
SourceLocation getLocStart() const LLVM_READONLY
static StringLiteral * Create(const ASTContext &C, StringRef Str, StringKind Kind, bool Pascal, QualType Ty, const SourceLocation *Loc, unsigned NumStrs)
SourceLocation getLocStart() const LLVM_READONLY
unsigned getRawEncoding() const
When a SourceLocation itself cannot be used, this returns an (opaque) 32-bit integer encoding for it...
SourceLocation getEllipsisLoc() const
static bool classof(const Stmt *T)
SourceLocation getExprLoc() const LLVM_READONLY
arg_const_range arguments() const
const_iterator begin() const
bool HasSideEffects(const ASTContext &Ctx, bool IncludePossibleEffects=true) const
ShuffleVectorExpr(EmptyShell Empty)
Build an empty vector-shuffle expression.
const_arg_iterator arg_end() const
SourceLocation getLocStart() const LLVM_READONLY
Expr * ignoreParenBaseCasts() LLVM_READONLY
Ignore parentheses and derived-to-base casts.
bool hasExplicitTemplateArgs() const
Determines whether the member name was followed by an explicit template argument list.
IdentType getIdentType() const
ASTTemplateArgumentListInfo & getExplicitTemplateArgs()
Retrieve the explicit template argument list that follow the member template name. This must only be called on an expression with explicit template arguments.
bool isConditionTrue() const
Expr * getIndexExpr(unsigned Idx)
bool hadArrayRangeDesignator() const
const CXXBaseSpecifier *const * path_const_iterator
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
SourceLocation getLocStart() const LLVM_READONLY
static OffsetOfExpr * CreateEmpty(const ASTContext &C, unsigned NumComps, unsigned NumExprs)
static const OpaqueValueExpr * findInCopyConstruct(const Expr *expr)
const Expr * getResultExpr() const
UnaryOperator(Expr *input, Opcode opc, QualType type, ExprValueKind VK, ExprObjectKind OK, SourceLocation l)
GenericSelectionExpr(EmptyShell Empty)
static LLVM_READNONE bool isASCII(char c)
Returns true if this is an ASCII character.
SourceLocation getLocEnd() const LLVM_READONLY
void setSubExpr(unsigned Idx, Expr *E)
const Expr * getCallee() const
static bool isArithmeticOp(Opcode Op)
Classification ClassifyModifiable(ASTContext &Ctx, SourceLocation &Loc) const
ClassifyModifiable - Classify this expression according to the C++11 expression taxonomy, and see if it is valid on the left side of an assignment.
void setInitializer(Expr *E)
reverse_designators_iterator designators_rend()
SourceLocation getLocEnd() const LLVM_READONLY
llvm::iterator_range< arg_iterator > arg_range
const FunctionProtoType * getFunctionType() const
getFunctionType - Return the underlying function type for this block.
void resizeInits(const ASTContext &Context, unsigned NumInits)
Specify the number of initializers.
BlockExpr(BlockDecl *BD, QualType ty)
void setInit(unsigned Init, Expr *expr)
SourceLocation getLocStart() const LLVM_READONLY
AddrLabelExpr(EmptyShell Empty)
Build an empty address of a label expression.
void setValue(unsigned Val)
SourceLocation getLocation() const
Retrieve the location of the literal.
PredefinedExpr(SourceLocation L, QualType FNTy, IdentType IT, StringLiteral *SL)
const TypeSourceInfo * getAssocTypeSourceInfo(unsigned i) const
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>". This is safe to be used inside an AST node, in contrast with TemplateArgumentListInfo.
Expr * IgnoreImplicit() LLVM_READONLY
UnaryExprOrTypeTrait getKind() const
static DeclRefExpr * CreateEmpty(const ASTContext &Context, bool HasQualifier, bool HasFoundDecl, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Construct an empty declaration reference expression.
void setContainsUnexpandedParameterPack(bool PP=true)
Set the bit that describes whether this expression contains an unexpanded parameter pack...
ConditionalOperator(EmptyShell Empty)
Build an empty conditional operator.
void setGNUSyntax(bool GNU)
const_semantics_iterator semantics_begin() const
Expr * getCond() const
getCond - Return the condition expression; this is defined in terms of the opaque value...
static DesignatedInitExpr * Create(const ASTContext &C, Designator *Designators, unsigned NumDesignators, ArrayRef< Expr * > IndexExprs, SourceLocation EqualOrColonLoc, bool GNUSyntax, Expr *Init)
const FunctionDecl * getDirectCallee() const
unsigned getValue() const
static bool isAssignmentOp(Opcode Opc)
NullPointerConstantKind isNullPointerConstant(ASTContext &Ctx, NullPointerConstantValueDependence NPC) const
unsigned path_size() const
SourceLocation getLocation() const
const Expr * IgnoreParenNoopCasts(ASTContext &Ctx) const LLVM_READONLY
SourceLocation getLocStart() const LLVM_READONLY
Expr * getArrayIndex(const Designator &D) const
FieldDecl * getSourceBitField()
If this expression refers to a bit-field, retrieve the declaration of that bit-field.
std::reverse_iterator< iterator > reverse_iterator
static bool classof(const Stmt *T)
Expr * IgnoreImpCasts() LLVM_READONLY
SourceLocation getRParenLoc() const
Return the location of the right parentheses.
InitExprsTy::const_reverse_iterator const_reverse_iterator
void setStrTokenLoc(unsigned TokNum, SourceLocation L)
Represents a C99 designated initializer expression.
bool isComparisonOp() const
AbstractConditionalOperator(StmtClass SC, EmptyShell Empty)
designators_range designators()
static bool classof(const Stmt *T)
DeclarationName getName() const
getName - Returns the embedded declaration name.
Expr * getSubExpr(unsigned Idx) const
ASTTemplateArgumentListInfo & getExplicitTemplateArgs()
Retrieve the explicit template argument list that followed the member template name.
AddrLabelExpr(SourceLocation AALoc, SourceLocation LLoc, LabelDecl *L, QualType t)
static Opcode reverseComparisonOp(Opcode Opc)
A vector component is an element or range of elements on a vector.
ShuffleVectorExpr(const ASTContext &C, ArrayRef< Expr * > args, QualType Type, SourceLocation BLoc, SourceLocation RP)
static bool classof(const Stmt *T)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
unsigned getNumSemanticExprs() const
unsigned getNumAssocs() const
SourceLocation getExprLoc() const LLVM_READONLY
static SourceLocation getFromRawEncoding(unsigned Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
bool isReferenceType() const
bool isImplicitCXXThis() const
Whether this expression is an implicit reference to 'this' in C++.
SourceLocation getAmpAmpLoc() const
SourceLocation getLocStart() const LLVM_READONLY
bool isSemanticForm() const
Represents a place-holder for an object not to be initialized by anything.
void setNumArgs(const ASTContext &C, unsigned NumArgs)
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
const FieldDecl * getInitializedFieldInUnion() const
static bool isIncrementDecrementOp(Opcode Op)
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
unsigned getNumCommas() const
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
const Stmt * getBody() const
const Expr * getSyntacticForm() const
ExtVectorElementExpr(EmptyShell Empty)
Build an empty vector element expression.
UnaryOperator(EmptyShell Empty)
Build an empty unary operator.
ArrayRef< Stmt * > getRawSubExprs()
SourceLocation getExprLoc() const LLVM_READONLY
IdentifierInfo * getFieldName() const
For a field or identifier offsetof node, returns the name of the field.
static bool classof(const Stmt *T)
void setArg(unsigned Arg, Expr *ArgExpr)
setArg - Set the specified argument.
void setRParen(SourceLocation Loc)
static DeclRefExpr * Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, ValueDecl *D, bool RefersToEnclosingVariableOrCapture, SourceLocation NameLoc, QualType T, ExprValueKind VK, NamedDecl *FoundD=nullptr, const TemplateArgumentListInfo *TemplateArgs=nullptr)
GNUNullExpr(EmptyShell Empty)
Build an empty GNU __null expression.
llvm::APSInt getShuffleMaskIdx(const ASTContext &Ctx, unsigned N) const
CallExpr(const ASTContext &C, StmtClass SC, Expr *fn, unsigned NumPreArgs, ArrayRef< Expr * > args, QualType t, ExprValueKind VK, SourceLocation rparenloc)
IdentifierInfo & getAccessor() const
const Decl * getCalleeDecl() const
bool refersToVectorElement() const
Returns whether this expression refers to a vector element.
SourceLocation getLocEnd() const LLVM_READONLY
llvm::iterator_range< const_designators_iterator > designators_const_range
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
void setComponent(unsigned Idx, OffsetOfNode ON)
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
const ObjCPropertyRefExpr * getObjCProperty() const
If this expression is an l-value for an Objective C property, find the underlying property reference ...
SourceLocation getRParenLoc() const
void setRParenLoc(SourceLocation L)
bool isFPContractable() const
static bool classof(const Stmt *T)
static OffsetOfExpr * Create(const ASTContext &C, QualType type, SourceLocation OperatorLoc, TypeSourceInfo *tsi, ArrayRef< OffsetOfNode > comps, ArrayRef< Expr * > exprs, SourceLocation RParenLoc)
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
OffsetOfNode(SourceLocation DotLoc, FieldDecl *Field, SourceLocation NameLoc)
Create an offsetof node that refers to a field.
struct FieldDesignator Field
A field designator, e.g., ".x".
const Expr *const * const_semantics_iterator
static bool classof(const Stmt *T)
static bool isRelationalOp(Opcode Opc)
SourceLocation getLocStart() const LLVM_READONLY
void setLBraceLoc(SourceLocation Loc)
const Expr *const * getArgs() const
Describes an C or C++ initializer list.
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getLocStart() const LLVM_READONLY
uint32_t getCodeUnit(size_t i) const
Expr * getChosenSubExpr() const
AsTypeExpr(Expr *SrcExpr, QualType DstType, ExprValueKind VK, ExprObjectKind OK, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
void setValue(const ASTContext &C, const llvm::APInt &Val)
SourceLocation getLocEnd() const LLVM_READONLY
void setBuiltinLoc(SourceLocation L)
SmallVectorImpl< PartialDiagnosticAt > * Diag
static bool isEqualityOp(Opcode Opc)
SourceLocation getLocEnd() const LLVM_READONLY
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
Expr * getTrueExpr() const
static bool classof(const Stmt *T)
unsigned getLength() const
const uint16_t * asUInt16
APValue Val
Val - This is the value the expression can be folded to.
DeclarationNameInfo getNameInfo() const
static bool classof(const Stmt *T)
An x-value expression is a reference to an object with independent storage but which can be "moved"...
SourceLocation getLocStart() const LLVM_READONLY
path_iterator path_begin()
const_iterator end() const
SourceLocation getLParen() const
Get the location of the left parentheses '('.
NullPointerConstantValueDependence
Enumeration used to describe how isNullPointerConstant() should cope with value-dependent expressions...
SourceLocation getLocEnd() const LLVM_READONLY
static bool classof(const Stmt *T)
const Expr * getSubExpr() const
semantics_iterator semantics_end()
SourceLocation getRParenLoc() const
A builtin binary operation expression such as "x + y" or "x <= y".
const Expr * skipRValueSubobjectAdjustments(SmallVectorImpl< const Expr * > &CommaLHS, SmallVectorImpl< SubobjectAdjustment > &Adjustments) const
static bool classof(const Stmt *T)
SourceLocation RAngleLoc
The source location of the right angle bracket ('>').
SourceLocation getRBraceLoc() const
bool isValueDependent() const
unsigned RBracketLoc
The location of the ']' terminating the array range designator.
void setAccessor(IdentifierInfo *II)
static bool isPostfix(Opcode Op)
isPostfix - Return true if this is a postfix operation, like x++.
static bool classof(const Stmt *T)
ChooseExpr(EmptyShell Empty)
Build an empty __builtin_choose_expr.
static bool classof(const Stmt *T)
Expr * IgnoreParenCasts() LLVM_READONLY
QualType getTypeAsWritten() const
BinaryOperator(EmptyShell Empty)
Construct an empty binary operator.
SourceLocation getLocStart() const LLVM_READONLY
void setOperatorLoc(SourceLocation L)
bool isConditionDependent() const
SourceLocation getLocEnd() const LLVM_READONLY
An adjustment to be made to the temporary created when emitting a reference binding, which accesses a particular subobject of that temporary.
std::reverse_iterator< const_iterator > const_reverse_iterator
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getLocEnd() const LLVM_READONLY
unsigned getBuiltinCallee() const
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
TypeSourceInfo * getTypeInfoAsWritten() const
An ordinary object is located at an address in memory.
SourceLocation getLocEnd() const LLVM_READONLY
ASTTemplateKWAndArgsInfo * getTemplateKWAndArgsInfo()
Return the optional template keyword and arguments info.
bool hadMultipleCandidates() const
Returns true if this member expression refers to a method that was resolved from an overloaded set ha...
SourceLocation getLocation() const
Expression is a GNU-style __null constant.
bool isEqualityOp() const
void setRParenLoc(SourceLocation R)
SourceLocation getLParenLoc() const
SourceLocation getDefaultLoc() const
static Classification makeSimpleLValue()
Create a simple, modifiably lvalue.
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO, bool Postfix)
Retrieve the unary opcode that corresponds to the given overloaded operator.
const Expr * getLHS() const
GNUNullExpr(QualType Ty, SourceLocation Loc)
ConvertVectorExpr(Expr *SrcExpr, TypeSourceInfo *TI, QualType DstType, ExprValueKind VK, ExprObjectKind OK, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
void setIntValue(const ASTContext &C, const llvm::APInt &Val)
bool isCXX11ConstantExpr(const ASTContext &Ctx, APValue *Result=nullptr, SourceLocation *Loc=nullptr) const
void setRParenLoc(SourceLocation L)
NestedNameSpecifier * getQualifier() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name. Otherwise, returns NULL.
uint64_t * pVal
Used to store the >64 bits integer value.
void setCastKind(CastKind K)
Extends ASTTemplateArgumentListInfo with the source location information for the template keyword; th...
SourceLocation getRParenLoc() const
getRParenLoc - Return the location of final right parenthesis.
SourceLocation getBuiltinLoc() const
Expr ** getSubExprs()
Retrieve the array of expressions.
ChooseExpr(SourceLocation BLoc, Expr *cond, Expr *lhs, Expr *rhs, QualType t, ExprValueKind VK, ExprObjectKind OK, SourceLocation RP, bool condIsTrue, bool TypeDependent, bool ValueDependent)
static bool classof(const Stmt *T)
SourceLocation getOperatorLoc() const LLVM_READONLY
void setEqualOrColonLoc(SourceLocation L)
CXXBaseSpecifier * getBase() const
For a base class node, returns the base specifier.
void setArgument(Expr *E)
void setTypeSourceInfo(TypeSourceInfo *tsi)
static Opcode negateComparisonOp(Opcode Opc)
InitListExpr * getSemanticForm() const
static bool classof(const Stmt *T)
const ASTTemplateArgumentListInfo * getOptionalExplicitTemplateArgs() const
Retrieves the optional explicit template arguments. This points to the same data as getExplicitTempla...
void setField(FieldDecl *FD)
Expr * getFalseExpr() const
llvm::APInt getValue() const
ParenExpr(SourceLocation l, SourceLocation r, Expr *val)
bool isAssignmentOp() const
void setAmpAmpLoc(SourceLocation L)
SourceLocation getTokenLocation() const
getTokenLocation - The location of the __null token.
IdentifierInfo * getFieldName() const
void setBlockDecl(BlockDecl *BD)
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
SubobjectAdjustment(FieldDecl *Field)
Expr * IgnoreParenNoopCasts(ASTContext &Ctx) LLVM_READONLY
bool isOBJCGCCandidate(ASTContext &Ctx) const
const Expr * getControllingExpr() const
CastKind
CastKind - The kind of operation required for a conversion.
bool EvaluateAsRValue(EvalResult &Result, const ASTContext &Ctx) const
The return type of classify(). Represents the C++11 expression taxonomy.
const Expr * IgnoreParenCasts() const LLVM_READONLY
SourceRange getDesignatorsSourceRange() const
Used by IntegerLiteral/FloatingLiteral to store the numeric without leaking memory.
static ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat)
Specifies that the expression should never be value-dependent.
llvm::iterator_range< designators_iterator > designators_range
SourceLocation getLocEnd() const LLVM_READONLY
const Expr * getRHS() const
Stmt * getPreArg(unsigned i)
void setLParen(SourceLocation Loc)
const Expr * IgnoreImplicit() const LLVM_READONLY
A field in a dependent type, known only by its name.
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on a template...
ConditionalOperator(Expr *cond, SourceLocation QLoc, Expr *lhs, SourceLocation CLoc, Expr *rhs, QualType t, ExprValueKind VK, ExprObjectKind OK)
VAArgExpr, used for the builtin function __builtin_va_arg.
ID
Defines the set of possible language-specific address spaces.
QualType getPointeeType() const
static StringLiteral * Create(const ASTContext &C, StringRef Str, StringKind Kind, bool Pascal, QualType Ty, SourceLocation Loc)
Simple constructor for string literals made from one token.
Kinds
The various classification results. Most of these mean prvalue.
Exposes information about the current target.
InitListExpr(const ASTContext &C, SourceLocation lbraceloc, ArrayRef< Expr * > initExprs, SourceLocation rbraceloc)
designators_iterator designators_begin()
bool isObjCSelfExpr() const
Check if this expression is the ObjC 'self' implicit parameter.
void setString(const ASTContext &C, StringRef Str, StringKind Kind, bool IsPascal)
Sets the string data to the given string data.
unsigned getNumExprs() const
void setLocation(SourceLocation Location)
SourceLocation getLocStart() const LLVM_READONLY
unsigned getArrayExprIndex() const
For an array element node, returns the index into the array of expressions.
static bool classof(const Stmt *T)
bool isKnownToHaveBooleanValue() const
bool isOrdinaryOrBitFieldObject() const
void setDesignators(const ASTContext &C, const Designator *Desigs, unsigned NumDesigs)
void setRBraceLoc(SourceLocation Loc)
SourceLocation getLocStart() const LLVM_READONLY
const Expr * getExpr(unsigned Init) const
SourceLocation getRParenLoc() const
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
void outputString(raw_ostream &OS) const
void setRParenLoc(SourceLocation L)
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getRParenLoc() const
static bool classof(const Stmt *T)
TypeSourceInfo * getTypeSourceInfo() const
getTypeSourceInfo - Return the destination type.
SourceLocation getLocation() const
Retrieve the location of this expression.
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs. The actual template arguments (if any) are stored a...
double getValueAsApproximateDouble() const
void setSyntacticForm(InitListExpr *Init)
SourceLocation getLBraceLoc() const
SourceLocation getLocEnd() const LLVM_READONLY
void setMemberLoc(SourceLocation L)
SourceLocation getLocEnd() const LLVM_READONLY
unsigned getNumExpressions() const
void setTypeDependent(bool TD)
Set whether this expression is type-dependent or not.
bool isArithmeticOp() const
bool isUnusedResultAWarning(const Expr *&WarnExpr, SourceLocation &Loc, SourceRange &R1, SourceRange &R2, ASTContext &Ctx) const
const_reverse_designators_iterator designators_rbegin() const
llvm::APInt getIntValue() const
static bool classof(const Stmt *T)
An array or GNU array-range designator, e.g., "[9]" or "[10..15]".
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getEqualOrColonLoc() const
Retrieve the location of the '=' that precedes the initializer value itself, if present.
void setTypeSourceInfo(TypeSourceInfo *ti)
const ValueDecl * getDecl() const
const_designators_iterator designators_end() const
void setWrittenTypeInfo(TypeSourceInfo *TI)
const CompoundStmt * getSubStmt() const
Expr * getArrayRangeStart(const Designator &D) const
ParenExpr(EmptyShell Empty)
Construct an empty parenthesized expression.
void setObjectKind(ExprObjectKind Cat)
setObjectKind - Set the object kind produced by this expression.
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given unary opcode. ...
BinaryOperator(Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy, ExprValueKind VK, ExprObjectKind OK, SourceLocation opLoc, bool fpContractable)
Classification Classify(ASTContext &Ctx) const
Classify - Classify this expression according to the C++11 expression taxonomy.
static FloatingLiteral * Create(const ASTContext &C, const llvm::APFloat &V, bool isexact, QualType Type, SourceLocation L)
isModifiableLvalueResult isModifiableLvalue(ASTContext &Ctx, SourceLocation *Loc=nullptr) const
void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const
Copies the template arguments (if present) into the given structure.
SourceLocation getLocStart() const LLVM_READONLY
ArraySubscriptExpr(EmptyShell Shell)
Create an empty array subscript expression.
Specifies that a value-dependent expression of integral or dependent type should be considered a null...
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation getQuestionLoc() const
SourceLocation getLocEnd() const LLVM_READONLY
std::reverse_iterator< designators_iterator > reverse_designators_iterator
static bool isPotentialConstantExpr(const FunctionDecl *FD, SmallVectorImpl< PartialDiagnosticAt > &Diags)
Expr * getSubExpr() const
bool isDependentType() const
void setValueKind(ExprValueKind Cat)
setValueKind - Set the value kind produced by this expression.
void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const
Copies the template arguments (if present) into the given structure.
bool EvaluateAsInt(llvm::APSInt &Result, const ASTContext &Ctx, SideEffectsKind AllowSideEffects=SE_NoSideEffects) const
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
void setMemberDecl(ValueDecl *D)
unsigned getNumComponents() const
ModifiableType
The results of modification testing.
void setRParenLoc(SourceLocation L)
Expr * getSubExprAsWritten()
Retrieve the cast subexpression as it was written in the source code, looking through any implicit ca...
bool hasPlaceholderType(BuiltinType::Kind K) const
Returns whether this expression has a specific placeholder type.
DeclarationName getDeclName() const
TemplateArgumentLoc * getTemplateArgs()
Retrieve the template arguments.
static bool classof(const Stmt *T)
QualType getComputationLHSType() const
The result type of a method or function.
Designator(unsigned Index, SourceLocation LBracketLoc, SourceLocation EllipsisLoc, SourceLocation RBracketLoc)
Initializes a GNU array-range designator.
SourceLocation getLocEnd() const LLVM_READONLY
NestedNameSpecifierLoc getQualifierLoc() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name, with source-location information.
const Expr * getArg(unsigned Arg) const
SourceLocation getLParenLoc() const
const ASTTemplateArgumentListInfo * getOptionalExplicitTemplateArgs() const
Retrieves the optional explicit template arguments. This points to the same data as getExplicitTempla...
static bool classof(const Stmt *T)
const Stmt * getPreArg(unsigned i) const
void getEncodedElementAccess(SmallVectorImpl< unsigned > &Elts) const
getEncodedElementAccess - We encode the fields as a llvm ConstantArray.
SourceLocation getLocEnd() const LLVM_READONLY
void EvaluateForOverflow(const ASTContext &Ctx) const
Expr * getTrueExpr() const
APFloatSemantics getRawSemantics() const
SourceLocation getLocationOfByte(unsigned ByteNo, const SourceManager &SM, const LangOptions &Features, const TargetInfo &Target) const
ExplicitCastExpr(StmtClass SC, QualType exprTy, ExprValueKind VK, CastKind kind, Expr *op, unsigned PathSize, TypeSourceInfo *writtenTy)
const Designator * const_designators_iterator
SourceLocation getLocStart() const LLVM_READONLY
unsigned getNumSubExprs() const
Retrieve the total number of subexpressions in this designated initializer expression, including the actual initialized value and any expressions that occur within array and array-range designators.
void setRParenLoc(SourceLocation L)
InitListExpr * getUpdater() const
bool EvaluateAsInitializer(APValue &Result, const ASTContext &Ctx, const VarDecl *VD, SmallVectorImpl< PartialDiagnosticAt > &Notes) const
bool isArrayRangeDesignator() const
QualType getComputationResultType() const
SourceLocation getCaretLocation() const
unsigned getNumSubExprs() const
Expr * IgnoreCasts() LLVM_READONLY
Ignore casts. Strip off any CastExprs, returning their operand.
bool isBoundMemberFunction(ASTContext &Ctx) const
Returns true if this expression is a bound member function.
static bool isBitwiseOp(Opcode Opc)
SourceLocation getOperatorLoc() const
const llvm::fltSemantics & getSemantics() const
Return the APFloat semantics this literal uses.
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO)
Retrieve the binary opcode that corresponds to the given overloaded operator.
SourceLocation getDotLoc() const
Expr * IgnoreConversionOperator() LLVM_READONLY
void setTypeSourceInfo(TypeSourceInfo *tinfo)
static bool classof(const Stmt *T)
unsigned DotLoc
The location of the '.' in the designated initializer.
UnaryExprOrTypeTraitExpr(UnaryExprOrTypeTrait ExprKind, TypeSourceInfo *TInfo, QualType resultType, SourceLocation op, SourceLocation rp)
void ExpandDesignator(const ASTContext &C, unsigned Idx, const Designator *First, const Designator *Last)
Replaces the designator at index Idx with the series of designators in [First, Last).
OffsetOfNode(SourceLocation DotLoc, IdentifierInfo *Name, SourceLocation NameLoc)
Create an offsetof node that refers to an identifier.
void setComputationLHSType(QualType T)
bool EvaluateAsBooleanCondition(bool &Result, const ASTContext &Ctx) const
SourceLocation getLocStart() const LLVM_READONLY
Expr * getArrayRangeEnd(const Designator &D) const
DesignatedInitUpdateExpr(EmptyShell Empty)
void setLParenLoc(SourceLocation L)
SmallVector< CXXBaseSpecifier *, 4 > CXXCastPath
A simple array of base specifiers.
ConstExprIterator const_arg_iterator
void setAccessorLoc(SourceLocation L)
void setLocation(SourceLocation L)
unsigned getResultExprIndex() const
const Expr * IgnoreParenImpCasts() const LLVM_READONLY
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
void setLocation(SourceLocation L)
void setValue(const ASTContext &C, const llvm::APFloat &Val)
const Expr * IgnoreParens() const LLVM_READONLY
Expression is not a Null pointer constant.
Expr * getSourceExpr() const
SourceLocation getExprLoc() const LLVM_READONLY
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
void setUpdater(Expr *Updater)
bool hasSideEffects() const
NoInitExpr(EmptyShell Empty)
bool isImplicitAccess() const
Determine whether the base of this explicit is implicit.
bool isValid() const
Return true if this is a valid SourceLocation object.
FieldDecl * getField() const
designators_const_range designators() const
SourceLocation getLocStart() const LLVM_READONLY
pointer data()
data - Return a pointer to the vector's buffer, even if empty().
ASTContext & getASTContext() const LLVM_READONLY
static bool isPlaceholderTypeKind(Kind K)
Determines whether the given kind corresponds to a placeholder type.
bool refersToEnclosingVariableOrCapture() const
Does this DeclRefExpr refer to an enclosing local or a captured variable?
static bool classof(const Stmt *T)
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
llvm::APSInt EvaluateKnownConstInt(const ASTContext &Ctx, SmallVectorImpl< PartialDiagnosticAt > *Diag=nullptr) const
static bool classof(const Stmt *T)
void setLabelLoc(SourceLocation L)
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
StmtExpr(EmptyShell Empty)
Build an empty statement expression.
CompoundAssignOperator(EmptyShell Empty)
Build an empty compound assignment operator expression.
const CXXRecordDecl * getBestDynamicClassType() const
For an expression of class type or pointer to class type, return the most derived class decl the expr...
bool isCompoundAssignmentOp() const
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
Expr * getAssocExpr(unsigned i)
SourceLocation getGenericLoc() const
SourceLocation getLBracketLoc() const
static bool classof(const Stmt *T)
SourceLocation getStrTokenLoc(unsigned TokNum) const
uint64_t VAL
Used to store the <= 64 bits integer value.
bool isIntegerConstantExpr(llvm::APSInt &Result, const ASTContext &Ctx, SourceLocation *Loc=nullptr, bool isEvaluated=true) const
MemberExpr(Expr *base, bool isarrow, SourceLocation operatorloc, ValueDecl *memberdecl, SourceLocation l, QualType ty, ExprValueKind VK, ExprObjectKind OK)
static bool classof(const Stmt *T)
Specifies that a value-dependent expression should be considered to never be a null pointer constant...
Expr * updateInit(const ASTContext &C, unsigned Init, Expr *expr)
Updates the initializer at index Init with the new expression expr, and returns the old expression at...
bool isUnevaluatedBuiltinCall(const ASTContext &Ctx) const
Returns true if this is a call to a builtin which does not evaluate side-effects within its arguments...
unsigned getCharByteWidth() const
Expr * getExpr(unsigned Init)
const Expr * IgnoreCasts() const LLVM_READONLY
Strip off casts, but keep parentheses.
static bool classof(const Stmt *T)
void setDecl(ValueDecl *NewD)
StringLiteral * getFunctionName()
void setArgument(TypeSourceInfo *TInfo)
ParenListExpr(const ASTContext &C, SourceLocation lparenloc, ArrayRef< Expr * > exprs, SourceLocation rparenloc)
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs. ...
QualType getAssocType(unsigned i) const
static QualType findBoundMemberType(const Expr *expr)
Given an expression of bound-member type, find the type of the member. Returns null if this is an ove...
path_const_iterator path_begin() const
Expr ** getInits()
Retrieve the set of initializers.
bool containsNonAsciiOrNull() const
static bool classof(const Stmt *T)
SourceLocation getBegin() const
InitListExpr(EmptyShell Empty)
Build an empty initializer list.
bool isTypeDependent() const
AtomicExpr(EmptyShell Empty)
Build an empty AtomicExpr.
static DesignatedInitExpr * CreateEmpty(const ASTContext &C, unsigned NumIndexExprs)
const Expr * getSemanticExpr(unsigned index) const
static bool isLogicalOp(Opcode Opc)
SourceLocation getLocStart() const LLVM_READONLY
OpaqueValueExpr(EmptyShell Empty)
const Expr * getBase() const
unsigned LBracketLoc
The location of the '[' starting the array range designator.
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
const SourceLocation * tokloc_iterator
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
SourceLocation getLocStart() const LLVM_READONLY
const BlockDecl * getBlockDecl() const
bool refersToBitField() const
Returns true if this expression is a gl-value that potentially refers to a bit-field.
void sawArrayRangeDesignator(bool ARD=true)
bool isCXX98IntegralConstantExpr(const ASTContext &Ctx) const
SourceLocation getLocStart() const LLVM_READONLY
QualType getType() const
Return the type wrapped by this type source info.
SourceLocation getRParenLoc() const
const Expr * getArrayFiller() const
bool isGlobalLValue() const
static MemberExpr * Create(const ASTContext &C, Expr *base, bool isarrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, ValueDecl *memberdecl, DeclAccessPair founddecl, DeclarationNameInfo MemberNameInfo, const TemplateArgumentListInfo *targs, QualType ty, ExprValueKind VK, ExprObjectKind OK)
const OffsetOfNode & getComponent(unsigned Idx) const
SourceLocation getExprLoc() const LLVM_READONLY
const Expr * getSubExprAsWritten() const
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getRBracketLoc() const
bool isPtrMemOp() const
predicates to categorize the respective opcodes.
Represents a C11 generic selection.
bool isAdditiveOp() const
QualType getCallReturnType(const ASTContext &Ctx) const
EvalStatus is a struct with detailed info about an evaluation in progress.
AddrLabelExpr - The GNU address of label extension, representing &&label.
Expr * getResultExpr()
Return the result-bearing expression, or null if there is none.
const Expr * getExpr(unsigned Index) const
Expr(StmtClass SC, EmptyShell)
Construct an empty expression.
SourceLocation getLocation() const
Expr * getCommon() const
getCommon - Return the common expression, written to the left of the condition. The opaque value will...
static bool classof(const Stmt *T)
BinaryOperator(StmtClass SC, EmptyShell Empty)
void setLocation(SourceLocation L)
SourceLocation getExprLoc() const LLVM_READONLY
static bool classof(const Stmt *T)
const_reverse_iterator rend() const
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getLParenLoc() const
const Expr * getAssocExpr(unsigned i) const
StringRef getOpcodeStr() const
void setExprs(const ASTContext &C, ArrayRef< Expr * > Exprs)
void setBuiltinLoc(SourceLocation L)
bool hadMultipleCandidates() const
Returns true if this expression refers to a function that was resolved from an overloaded set having ...
[C99 6.4.2.2] - A predefined identifier such as func.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
SourceLocation getLocStart() const LLVM_READONLY
unsigned getByteLength() const
EvalResult is a struct with detailed info about an evaluated expression.
SourceLocation getLocEnd() const LLVM_READONLY
const_designators_iterator designators_begin() const
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
FunctionDecl * getDirectCallee()
If the callee is a FunctionDecl, return it. Otherwise return 0.
void setRParenLoc(SourceLocation L)
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
bool isTemporaryObject(ASTContext &Ctx, const CXXRecordDecl *TempTy) const
Determine whether the result of this expression is a temporary object of the given class type...
void setLabel(LabelDecl *L)
AtomicExpr(SourceLocation BLoc, ArrayRef< Expr * > args, QualType t, AtomicOp op, SourceLocation RP)
static bool isShiftAssignOp(Opcode Opc)
void setTypeInfoAsWritten(TypeSourceInfo *writtenTy)
SourceLocation getLocStart() const LLVM_READONLY
BinaryConditionalOperator(EmptyShell Empty)
Build an empty conditional operator.
Reads an AST files chain containing the contents of a translation unit.
A field designator, e.g., ".x".
InitExprsTy::reverse_iterator reverse_iterator
SourceLocation getLocEnd() const LLVM_READONLY
NestedNameSpecifierLoc getQualifierLoc() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name...
The same as PrettyFunction, except that the 'virtual' keyword is omitted for virtual member functions...
ExtVectorElementExpr(QualType ty, ExprValueKind VK, Expr *base, IdentifierInfo &accessor, SourceLocation loc)
const_reverse_designators_iterator designators_rend() const
designators_iterator designators_end()
bool isDefaultArgument() const
Determine whether this expression is a default function argument.
void setFileScope(bool FS)
OpaqueValueExpr(SourceLocation Loc, QualType T, ExprValueKind VK, ExprObjectKind OK=OK_Ordinary, Expr *SourceExpr=nullptr)
SourceLocation getLocEnd() const LLVM_READONLY
ModifiableType getModifiable() const
SourceLocation getLocStart() const LLVM_READONLY
Kind getKind() const
Determine what kind of offsetof node this is.
SourceLocation getLocStart() const LLVM_READONLY
Expression is a Null pointer constant built from a zero integer expression that is not a simple...
SourceLocation getLocStart() const LLVM_READONLY
StringRef getString() const
StringRef getBytes() const
void setInstantiationDependent(bool ID)
Set whether this expression is instantiation-dependent or not.
llvm::iterator_range< const_arg_iterator > arg_const_range
StringKind getKind() const
const_arg_iterator arg_begin() const
SourceLocation LAngleLoc
The source location of the left angle bracket ('<').
Expression is a C++11 nullptr.
bool usesGNUSyntax() const
Determines whether this designated initializer used the deprecated GNU syntax for designated initiali...
VAArgExpr(EmptyShell Empty)
Create an empty __builtin_va_arg expression.
semantics_iterator semantics_begin()
unsigned getNumArgs() const
void setLParenLoc(SourceLocation L)
unsigned getNumConcatenated() const
static bool isPrefix(Opcode Op)
isPrefix - Return true if this is a prefix operation, like –x.
void setInitializedFieldInUnion(FieldDecl *FD)
static PseudoObjectExpr * Create(const ASTContext &Context, Expr *syntactic, ArrayRef< Expr * > semantic, unsigned resultIndex)
SourceLocation getLocStart() const LLVM_READONLY
static bool classof(const Stmt *T)
ExplicitCastExpr(StmtClass SC, EmptyShell Shell, unsigned PathSize)
Construct an empty explicit cast.
SourceLocation getLocEnd() const LLVM_READONLY
llvm::APFloat getValue() const
Expr * IgnoreParenImpCasts() LLVM_READONLY
FieldDecl * getField() const
For a field offsetof node, returns the field.
const Expr * getBase() const
SourceLocation getLocStart() const LLVM_READONLY
void setRBracketLoc(SourceLocation L)
bool isConstantInitializer(ASTContext &Ctx, bool ForRef, const Expr **Culprit=nullptr) const
SourceLocation getMemberLoc() const
bool hasQualifier() const
Determine whether this declaration reference was preceded by a C++ nested-name-specifier, e.g., N::foo.
DeclRefExpr(ValueDecl *D, bool RefersToEnclosingVariableOrCapture, QualType T, ExprValueKind VK, SourceLocation L, const DeclarationNameLoc &LocInfo=DeclarationNameLoc())
static bool classof(const Stmt *T)
struct ArrayOrRangeDesignator ArrayOrRange
An array or GNU array-range designator, e.g., "[9]" or "[10..15]".
OffsetOfNode(SourceLocation LBracketLoc, unsigned Index, SourceLocation RBracketLoc)
Create an offsetof node that refers to an array element.
bool isDecrementOp() const
SourceLocation getRParenLoc() const
getRParenLoc - Return the location of final right parenthesis.
void setHadMultipleCandidates(bool V=true)
Sets the flag telling whether this expression refers to a method that was resolved from an overloaded...
MemberExpr(Expr *base, bool isarrow, SourceLocation operatorloc, ValueDecl *memberdecl, const DeclarationNameInfo &NameInfo, QualType ty, ExprValueKind VK, ExprObjectKind OK)
static const TypeInfo & getInfo(unsigned id)
SourceLocation getLocEnd() const LLVM_READONLY
CompoundLiteralExpr(SourceLocation lparenloc, TypeSourceInfo *tinfo, QualType T, ExprValueKind VK, Expr *init, bool fileScope)
static bool classof(const Stmt *S)
Expr * getFalseExpr() const
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
QualType getTypeOfArgument() const
SourceLocation getLocEnd() const LLVM_READONLY
static bool classof(const Stmt *S)
TypeSourceInfo * getAssocTypeSourceInfo(unsigned i)
OpaqueValueExpr * getOpaqueValue() const
getOpaqueValue - Return the opaque value placeholder.
static StringRef getIdentTypeName(IdentType IT)
SourceLocation getLocEnd() const LLVM_READONLY
void setIndexExpr(unsigned Idx, Expr *E)
SourceLocation getBuiltinLoc() const
static CStyleCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind K, Expr *Op, const CXXCastPath *BasePath, TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation R)
const Expr * getArgumentExpr() const
static ImplicitCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize)
SourceLocation getLocStart() const LLVM_READONLY
TypeSourceInfo * getWrittenTypeInfo() const
static bool classof(const Stmt *T)
ImaginaryLiteral(Expr *val, QualType Ty)
void setKind(UnaryExprOrTypeTrait K)
Expr * IgnoreParenLValueCasts() LLVM_READONLY
void setRParenLoc(SourceLocation L)
static bool isAdditiveOp(Opcode Opc)
llvm::APFloat getValue(const llvm::fltSemantics &Semantics) const
SourceLocation getLocStart() const LLVM_READONLY
void setOperatorLoc(SourceLocation L)
void setValue(const ASTContext &C, const llvm::APFloat &Val)
std::reverse_iterator< const_designators_iterator > const_reverse_designators_iterator
const_semantics_iterator semantics_end() const
bool hasTemplateKeyword() const
Determines whether the member name was preceded by the template keyword.
const Expr * getSubExpr() const
SourceLocation getLocStart() const LLVM_READONLY
UnaryExprOrTypeTraitExpr(EmptyShell Empty)
Construct an empty sizeof/alignof expression.
const Expr * IgnoreImpCasts() const LLVM_READONLY
ParenListExpr(EmptyShell Empty)
Build an empty paren list.
SubobjectAdjustment(const MemberPointerType *MPT, Expr *RHS)
SourceLocation getLocEnd() const LLVM_READONLY
PredefinedExpr(EmptyShell Empty)
Construct an empty predefined expression.
ExprIterator arg_iterator
SourceLocation getBuiltinLoc() const
getBuiltinLoc - Return the location of the __builtin_convertvector token.
void setLParenLoc(SourceLocation L)
SourceLocation getExprLoc() const LLVM_READONLY
LabelDecl * getLabel() const
void setFPContractable(bool FPC)
SourceLocation getAccessorLoc() const
bool isIncrementOp() const
ArraySubscriptExpr(Expr *lhs, Expr *rhs, QualType t, ExprValueKind VK, ExprObjectKind OK, SourceLocation rbracketloc)
Represents a base class of a C++ class.
SourceLocation getLocStart() const LLVM_READONLY
CharacterLiteral(unsigned value, CharacterKind kind, QualType type, SourceLocation l)
A bitfield object is a bitfield on a C or C++ record.
SourceLocation getLocStart() const LLVM_READONLY
const Expr * getInitializer() const
SourceLocation getRParenLoc() const
const Expr * getSubExpr() const
void setOperatorLoc(SourceLocation L)
void setLocation(SourceLocation Location)
enum clang::SubobjectAdjustment::@40 Kind
static bool isIncrementOp(Opcode Op)
Expr * getFalseExpr() const
getFalseExpr - Return the subexpression which will be evaluated if the condnition evaluates to false;...
void setHadMultipleCandidates(bool V=true)
Sets the flag telling whether this expression refers to a function that was resolved from an overload...
static CStyleCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize)
ImplicitValueInitExpr(EmptyShell Empty)
Construct an empty implicit value initialization.
BinaryOperatorKind Opcode
static bool classof(const Stmt *T)
SourceLocation getLocEnd() const LLVM_READONLY
static bool classof(const Stmt *T)
const NamedDecl * getFoundDecl() const
Get the NamedDecl through which this reference occurred. See non-const variant.
void setBuiltinLoc(SourceLocation L)
static bool classof(const Stmt *T)
Expression is a Null pointer constant built from a literal zero.
BinaryOperator(Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy, ExprValueKind VK, ExprObjectKind OK, SourceLocation opLoc, bool fpContractable, bool dead2)
SourceLocation getLocEnd() const LLVM_READONLY
BinaryConditionalOperator(Expr *common, OpaqueValueExpr *opaqueValue, Expr *cond, Expr *lhs, Expr *rhs, SourceLocation qloc, SourceLocation cloc, QualType t, ExprValueKind VK, ExprObjectKind OK)
CXXBaseSpecifier ** path_iterator
const Expr * getSubExpr() const
SourceLocation getBuiltinLoc() const
bool hasArrayFiller() const
Return true if this is an array initializer and its array "filler" has been set.
Represents a C++ struct/union/class.
static bool isCompoundAssignmentOp(Opcode Opc)
bool hasNonTrivialCall(const ASTContext &Ctx) const
Determine whether this expression involves a call to any function that is not trivial.
bool isPlaceholderType() const
Designator * designators_iterator
static bool classof(const Stmt *T)
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation getBuiltinLoc() const
static bool classof(const Stmt *T)
bool hasQualifier() const
Determines whether this member expression actually had a C++ nested-name-specifier prior to the name ...
bool isShiftAssignOp() const
SourceLocation getLocEnd() const LLVM_READONLY
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
bool isRelationalOp() const
SourceLocation getLocEnd() const LLVM_READONLY
const ASTTemplateArgumentListInfo & getExplicitTemplateArgs() const
Retrieve the explicit template argument list that followed the member template name.
unsigned kind
All of the diagnostics that can be emitted by the frontend.
unsigned getNumSubExprs()
void copyInto(TemplateArgumentListInfo &List) const
Expr * getInit(unsigned Init)
bool hasTemplateKWAndArgsInfo() const
void setTokenLocation(SourceLocation L)
bool hasExplicitTemplateArgs() const
Determines whether this declaration reference was followed by an explicit template argument list...
SourceLocation getTemplateKeywordLoc() const
Get the source location of the template keyword.
const MemberPointerType * MPT
Designator * getDesignator(unsigned Idx)
static bool hasAnyTypeDependentArguments(ArrayRef< Expr * > Exprs)
void reserveInits(const ASTContext &C, unsigned NumInits)
Reserve space for some number of initializers.
AbstractConditionalOperator(StmtClass SC, QualType T, ExprValueKind VK, ExprObjectKind OK, bool TD, bool VD, bool ID, bool ContainsUnexpandedParameterPack, SourceLocation qloc, SourceLocation cloc)
const StringLiteral * getFunctionName() const
bool isStringLiteralInit() const
const ASTTemplateArgumentListInfo & getExplicitTemplateArgs() const
Retrieve the explicit template argument list that followed the member template name. This must only be called on an expression with explicit template arguments.
static bool classof(const Stmt *T)
bool isModifiable() const
void setKind(CharacterKind kind)
A reference to a declared variable, function, enum, etc. [C99 6.5.1p2].
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
Expr * getSemanticExpr(unsigned index)
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given binary opcode.
CompoundAssignOperator(Expr *lhs, Expr *rhs, Opcode opc, QualType ResType, ExprValueKind VK, ExprObjectKind OK, QualType CompLHSType, QualType CompResultType, SourceLocation OpLoc, bool fpContractable)
SourceLocation getLocStart() const LLVM_READONLY
const Expr * getInit(unsigned Init) const
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
bool isFieldDesignator() const
static bool isPotentialConstantExprUnevaluated(Expr *E, const FunctionDecl *FD, SmallVectorImpl< PartialDiagnosticAt > &Diags)
Expr * getTrueExpr() const
getTrueExpr - Return the subexpression which will be evaluated if the condition evaluates to true; th...
An l-value expression is a reference to an object with independent storage.
const_reverse_iterator rbegin() const
SourceLocation getLocEnd() const LLVM_READONLY
unsigned getFirstExprIndex() const
A trivial tuple used to represent a source range.
static StringRef getOpcodeStr(Opcode Op)
unsigned getNumElements() const
getNumElements - Get the number of components being selected.
const FieldDecl * getSourceBitField() const
SourceLocation getRParenLoc() const
OffsetOfNode(const CXXBaseSpecifier *Base)
Create an offsetof node that refers into a C++ base class.
static bool classof(const Stmt *T)
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range that covers this offsetof node.
bool isIncrementDecrementOp() const
static bool isDecrementOp(Opcode Op)
SourceLocation getLocation() const
bool EvaluateAsLValue(EvalResult &Result, const ASTContext &Ctx) const
bool EvaluateWithSubstitution(APValue &Value, ASTContext &Ctx, const FunctionDecl *Callee, ArrayRef< const Expr * > Args) const
bool isNull() const
isNull - Return true if this QualType doesn't point to a type yet.
const CXXRecordDecl * DerivedClass
BlockDecl * getBlockDecl()
static bool classof(const Stmt *T)
const uint32_t * asUInt32
SourceLocation getLocStart() const LLVM_READONLY
unsigned getNumPreArgs() const
SubobjectAdjustment(const CastExpr *BasePath, const CXXRecordDecl *DerivedClass)
ImaginaryLiteral(EmptyShell Empty)
Build an empty imaginary literal.
static bool isComparisonOp(Opcode Opc)
SourceLocation ColonLoc
Location of ':'.
CastExpr(StmtClass SC, QualType ty, ExprValueKind VK, const CastKind kind, Expr *op, unsigned BasePathSize)
Expr * getOrderFail() const
SourceLocation getFieldLoc() const
VAArgExpr(SourceLocation BLoc, Expr *e, TypeSourceInfo *TInfo, SourceLocation RPLoc, QualType t)
This class handles loading and caching of source files into memory.
bool isArrayDesignator() const
Represents an implicitly-generated value initialization of an object of a given type.
NullPointerConstantKind
Enumeration used to describe the kind of Null pointer constant returned from isNullPointerConstant()...
SourceLocation getRParenLoc() const
SourceLocation getLocEnd() const LLVM_READONLY
bool isIntegerType() const
SourceLocation getColonLoc() const
Expr * IgnoreParens() LLVM_READONLY
DeclAccessPair getFoundDecl() const
Retrieves the declaration found by lookup.
static bool classof(const Stmt *T)
void setIsConditionTrue(bool isTrue)
TypeSourceInfo * getArgumentTypeInfo() const
SourceRange getSourceRange() const LLVM_READONLY
QualType getArgumentType() const
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getLocStart() const LLVM_READONLY