13#ifndef LLVM_CLANG_AST_EXPR_H
14#define LLVM_CLANG_AST_EXPR_H
31#include "llvm/ADT/APFloat.h"
32#include "llvm/ADT/APSInt.h"
33#include "llvm/ADT/SmallVector.h"
34#include "llvm/ADT/StringRef.h"
35#include "llvm/ADT/iterator.h"
36#include "llvm/ADT/iterator_range.h"
37#include "llvm/Support/AtomicOrdering.h"
38#include "llvm/Support/Compiler.h"
39#include "llvm/Support/TrailingObjects.h"
46 class CXXBaseSpecifier;
47 class CXXMemberCallExpr;
48 class CXXOperatorCallExpr;
52 class MaterializeTemporaryExpr;
54 class ObjCPropertyRefExpr;
55 class OpaqueValueExpr;
126 assert(
ExprBits.ObjectKind == OK &&
"truncated kind");
136 ExprBits.Dependent =
static_cast<unsigned>(Deps);
151 "Expressions can't have reference type");
176 return static_cast<bool>(
getDependence() & ExprDependence::Value);
193 return static_cast<bool>(
getDependence() & ExprDependence::Type);
222 return static_cast<bool>(
getDependence() & ExprDependence::Instantiation);
240 return static_cast<bool>(
getDependence() & ExprDependence::UnexpandedPack);
246 return static_cast<bool>(
getDependence() & ExprDependence::Error);
366 unsigned short Modifiable;
369 : Kind(k), Modifiable(m)
377 assert(Modifiable !=
CM_Untested &&
"Did not test for modifiability.");
406 return ClassifyImpl(Ctx,
nullptr);
418 return ClassifyImpl(Ctx, &Loc);
429 return (isa<LValueReferenceType>(RT)
431 : (RT->getPointeeType()->isFunctionType()
524 return BT->getKind() == K;
547 bool IgnoreTemplateOrMacroSubstitution =
false)
const;
556 std::optional<llvm::APSInt>
597 const Expr **Culprit =
nullptr)
const;
658 bool InConstantContext =
false)
const;
665 bool InConstantContext =
false)
const;
678 bool InConstantContext =
false)
const;
685 bool InConstantContext =
false)
const;
691 bool InConstantContext =
false)
const;
706 bool IncludePossibleEffects =
true)
const;
728 bool InConstantContext =
false)
const;
737 bool IsConstantInitializer)
const;
746 const Expr *This =
nullptr)
const;
777 unsigned Type)
const;
786 const Expr *SizeExpression,
788 EvalResult &Status)
const;
1022 return T->getStmtClass() >= firstExprConstant &&
1023 T->getStmtClass() <= lastExprConstant;
1029 llvm::detail::ConstantLog2<
alignof(Expr)>::value,
1030 "PointerLikeTypeTraits<Expr*> assumes too much alignment.");
1050 :
Expr(SC, Empty) {}
1060 return T->getStmtClass() >= firstFullExprConstant &&
1061 T->getStmtClass() <= lastFullExprConstant;
1072 private llvm::TrailingObjects<ConstantExpr, APValue, uint64_t> {
1073 static_assert(std::is_same<uint64_t, llvm::APInt::WordType>::value,
1074 "ConstantExpr assumes that llvm::APInt::WordType is uint64_t "
1075 "for tail-allocated storage");
1076 friend TrailingObjects;
1080 size_t numTrailingObjects(OverloadToken<APValue>)
const {
1083 size_t numTrailingObjects(OverloadToken<uint64_t>)
const {
1087 uint64_t &Int64Result() {
1089 "invalid accessor");
1090 return *getTrailingObjects<uint64_t>();
1092 const uint64_t &Int64Result()
const {
1093 return const_cast<ConstantExpr *
>(
this)->Int64Result();
1097 "invalid accessor");
1098 return *getTrailingObjects<APValue>();
1100 APValue &APValueResult()
const {
1101 return const_cast<ConstantExpr *
>(
this)->APValueResult();
1105 bool IsImmediateInvocation);
1109 static ConstantExpr *
Create(
const ASTContext &Context, Expr *E,
1111 static ConstantExpr *
1112 Create(
const ASTContext &Context, Expr *E,
1114 bool IsImmediateInvocation =
false);
1115 static ConstantExpr *
CreateEmpty(
const ASTContext &Context,
1120 const ASTContext &Context);
1130 return T->getStmtClass() == ConstantExprClass;
1175 :
Expr(OpaqueValueExprClass,
T, VK, OK), SourceExpr(SourceExpr) {
1187 :
Expr(OpaqueValueExprClass, Empty) {}
1221 assert((!
V || SourceExpr) &&
1222 "unique OVEs are expected to have source expressions");
1229 return T->getStmtClass() == OpaqueValueExprClass;
1258 private llvm::TrailingObjects<DeclRefExpr, NestedNameSpecifierLoc,
1259 NamedDecl *, ASTTemplateKWAndArgsInfo,
1260 TemplateArgumentLoc> {
1263 friend TrailingObjects;
1272 size_t numTrailingObjects(OverloadToken<NestedNameSpecifierLoc>)
const {
1276 size_t numTrailingObjects(OverloadToken<NamedDecl *>)
const {
1277 return hasFoundDecl();
1280 size_t numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>)
const {
1288 DeclRefExpr(
const ASTContext &Ctx, NestedNameSpecifierLoc QualifierLoc,
1289 SourceLocation TemplateKWLoc, ValueDecl *D,
1290 bool RefersToEnlosingVariableOrCapture,
1291 const DeclarationNameInfo &NameInfo, NamedDecl *FoundD,
1292 const TemplateArgumentListInfo *TemplateArgs, QualType
T,
1296 explicit DeclRefExpr(EmptyShell Empty) :
Expr(DeclRefExprClass, Empty) {}
1299 DeclRefExpr(
const ASTContext &Ctx, ValueDecl *D,
1300 bool RefersToEnclosingVariableOrCapture, QualType
T,
1302 const DeclarationNameLoc &LocInfo = DeclarationNameLoc(),
1305 static DeclRefExpr *
1306 Create(
const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc,
1307 SourceLocation TemplateKWLoc, ValueDecl *D,
1308 bool RefersToEnclosingVariableOrCapture, SourceLocation NameLoc,
1310 const TemplateArgumentListInfo *TemplateArgs =
nullptr,
1313 static DeclRefExpr *
1314 Create(
const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc,
1315 SourceLocation TemplateKWLoc, ValueDecl *D,
1316 bool RefersToEnclosingVariableOrCapture,
1317 const DeclarationNameInfo &NameInfo, QualType
T,
ExprValueKind VK,
1318 NamedDecl *FoundD =
nullptr,
1319 const TemplateArgumentListInfo *TemplateArgs =
nullptr,
1323 static DeclRefExpr *
CreateEmpty(
const ASTContext &Context,
bool HasQualifier,
1325 bool HasTemplateKWAndArgsInfo,
1326 unsigned NumTemplateArgs);
1350 return *getTrailingObjects<NestedNameSpecifierLoc>();
1366 return hasFoundDecl() ? *getTrailingObjects<NamedDecl *>() : D;
1372 return hasFoundDecl() ? *getTrailingObjects<NamedDecl *>() : D;
1384 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->TemplateKWLoc;
1392 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->LAngleLoc;
1400 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->RAngleLoc;
1415 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->copyInto(
1416 getTrailingObjects<TemplateArgumentLoc>(), List);
1424 return getTrailingObjects<TemplateArgumentLoc>();
1432 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->NumTemplateArgs;
1471 return DeclRefExprBits.CapturedByCopyInLambdaWithExplicitObjectParameter;
1481 return T->getStmtClass() == DeclRefExprClass;
1499 :
Expr(IntegerLiteralClass, Empty) { }
1525 return T->getStmtClass() == IntegerLiteralClass;
1543 :
Expr(FixedPointLiteralClass, Empty) {}
1551 const llvm::APInt &
V,
1570 return T->getStmtClass() == FixedPointLiteralClass;
1594 Value(value), Loc(l) {
1619 return T->getStmtClass() == CharacterLiteralClass;
1651 assert(&
getSemantics() == &Val.getSemantics() &&
"Inconsistent semantics");
1658 return static_cast<llvm::APFloatBase::Semantics
>(
1670 return llvm::APFloatBase::EnumToSemantics(
1671 static_cast<llvm::APFloatBase::Semantics
>(
1695 return T->getStmtClass() == FloatingLiteralClass;
1722 :
Expr(ImaginaryLiteralClass, Empty) { }
1734 return T->getStmtClass() == ImaginaryLiteralClass;
1772 private llvm::TrailingObjects<StringLiteral, unsigned, SourceLocation,
1775 friend TrailingObjects;
1791 unsigned numTrailingObjects(OverloadToken<unsigned>)
const {
return 1; }
1792 unsigned numTrailingObjects(OverloadToken<SourceLocation>)
const {
1796 unsigned numTrailingObjects(OverloadToken<char>)
const {
1800 char *getStrDataAsChar() {
return getTrailingObjects<char>(); }
1801 const char *getStrDataAsChar()
const {
return getTrailingObjects<char>(); }
1803 const uint16_t *getStrDataAsUInt16()
const {
1804 return reinterpret_cast<const uint16_t *
>(getTrailingObjects<char>());
1807 const uint32_t *getStrDataAsUInt32()
const {
1808 return reinterpret_cast<const uint32_t *
>(getTrailingObjects<char>());
1813 bool Pascal, QualType Ty,
const SourceLocation *Loc,
1814 unsigned NumConcatenated);
1817 StringLiteral(EmptyShell Empty,
unsigned NumConcatenated,
unsigned Length,
1818 unsigned CharByteWidth);
1821 static unsigned mapCharByteWidth(TargetInfo
const &
Target,
1825 void setStrTokenLoc(
unsigned TokNum, SourceLocation L) {
1827 getTrailingObjects<SourceLocation>()[TokNum] = L;
1833 static StringLiteral *
Create(
const ASTContext &Ctx, StringRef Str,
1835 const SourceLocation *Loc,
1836 unsigned NumConcatenated);
1842 return Create(Ctx, Str, Kind, Pascal, Ty, &Loc, 1);
1847 unsigned NumConcatenated,
unsigned Length,
1848 unsigned CharByteWidth);
1852 "This function is used in places that assume strings use char");
1866 assert(i <
getLength() &&
"out of bounds access");
1869 return static_cast<unsigned char>(getStrDataAsChar()[i]);
1871 return getStrDataAsUInt16()[i];
1873 return getStrDataAsUInt32()[i];
1875 llvm_unreachable(
"Unsupported character width!");
1883 llvm::APInt AInt(Width, (uint64_t)
V);
1884 V = AInt.getSExtValue();
1890 unsigned getLength()
const {
return *getTrailingObjects<unsigned>(); }
1928 return getTrailingObjects<SourceLocation>()[TokNum];
1941 unsigned *StartToken =
nullptr,
1942 unsigned *StartTokenByteOffset =
nullptr)
const;
1947 return getTrailingObjects<SourceLocation>();
1958 return T->getStmtClass() == StringLiteralClass;
1986 private llvm::TrailingObjects<PredefinedExpr, Stmt *> {
1988 friend TrailingObjects;
2003 assert(hasFunctionName() &&
2004 "This PredefinedExpr has no storage for a function name!");
2005 *getTrailingObjects<Stmt *>() = SL;
2013 static PredefinedExpr *
Create(
const ASTContext &Ctx, SourceLocation L,
2015 bool IsTransparent, StringLiteral *SL);
2018 static PredefinedExpr *
CreateEmpty(
const ASTContext &Ctx,
2019 bool HasFunctionName);
2031 return hasFunctionName()
2032 ?
static_cast<StringLiteral *
>(*getTrailingObjects<Stmt *>())
2037 return hasFunctionName()
2038 ?
static_cast<StringLiteral *
>(*getTrailingObjects<Stmt *>())
2048 const Decl *CurrentDecl,
2049 bool ForceElaboratedPrinting =
false);
2055 return T->getStmtClass() == PredefinedExprClass;
2061 getTrailingObjects<Stmt *>() + hasFunctionName());
2066 getTrailingObjects<Stmt *>() + hasFunctionName());
2087 void setLParenLocation(SourceLocation L) { LParen = L; }
2088 void setRParenLocation(SourceLocation L) { RParen = L; }
2108 return T->getStmtClass() == SYCLUniqueStableNameExprClass;
2137 L(l), R(r), Val(val) {
2143 :
Expr(ParenExprClass, Empty) { }
2161 return T->getStmtClass() == ParenExprClass;
2183 private llvm::TrailingObjects<UnaryOperator, FPOptionsOverride> {
2186 size_t numTrailingObjects(OverloadToken<FPOptionsOverride>)
const {
2192 return *getTrailingObjects<FPOptionsOverride>();
2197 return *getTrailingObjects<FPOptionsOverride>();
2210 :
Expr(UnaryOperatorClass, Empty) {
2258 return Op == UO_PostInc || Op == UO_PostDec;
2263 return Op == UO_PreInc || Op == UO_PreDec;
2270 return Op == UO_PreInc || Op == UO_PostInc;
2277 return Op == UO_PreDec || Op == UO_PostDec;
2289 return Op >= UO_Plus && Op <= UO_LNot;
2314 return T->getStmtClass() == UnaryOperatorClass;
2328 return getTrailingFPFeatures();
2375 enum { MaskBits = 2, Mask = 0x03 };
2395 : Range(LBracketLoc, RBracketLoc),
Data((Index << 2) |
Array) {}
2399 : Range(DotLoc.isValid() ? DotLoc : NameLoc, NameLoc),
2405 : Range(DotLoc.isValid() ? DotLoc : NameLoc, NameLoc),
2465 private llvm::TrailingObjects<OffsetOfExpr, OffsetOfNode, Expr *> {
2474 size_t numTrailingObjects(OverloadToken<OffsetOfNode>)
const {
2483 explicit OffsetOfExpr(
unsigned numComps,
unsigned numExprs)
2485 TSInfo(
nullptr), NumComps(numComps), NumExprs(numExprs) {}
2495 unsigned NumComps,
unsigned NumExprs);
2513 assert(Idx < NumComps &&
"Subscript out of range");
2514 return getTrailingObjects<OffsetOfNode>()[Idx];
2518 assert(Idx < NumComps &&
"Subscript out of range");
2519 getTrailingObjects<OffsetOfNode>()[Idx] = ON;
2527 assert(Idx < NumExprs &&
"Subscript out of range");
2528 return getTrailingObjects<Expr *>()[Idx];
2532 assert(Idx < NumExprs &&
"Subscript out of range");
2533 return getTrailingObjects<Expr *>()[Idx];
2537 assert(Idx < NumComps &&
"Subscript out of range");
2538 getTrailingObjects<Expr *>()[Idx] = E;
2549 return T->getStmtClass() == OffsetOfExprClass;
2554 Stmt **begin =
reinterpret_cast<Stmt **
>(getTrailingObjects<Expr *>());
2558 Stmt *
const *begin =
2559 reinterpret_cast<Stmt *
const *
>(getTrailingObjects<Expr *>());
2581 OpLoc(op), RParenLoc(rp) {
2582 assert(ExprKind <=
UETT_Last &&
"invalid enum value!");
2584 assert(
static_cast<unsigned>(ExprKind) ==
2586 "UnaryExprOrTypeTraitExprBits.Kind overflow!");
2588 Argument.Ty = TInfo;
2598 :
Expr(UnaryExprOrTypeTraitExprClass, Empty) { }
2604 assert(K <=
UETT_Last &&
"invalid enum value!");
2607 "UnaryExprOrTypeTraitExprBits.Kind overflow!");
2615 assert(
isArgumentType() &&
"calling getArgumentType() when arg is expr");
2619 assert(!
isArgumentType() &&
"calling getArgumentExpr() when arg is type");
2620 return static_cast<Expr*
>(Argument.Ex);
2631 Argument.Ty = TInfo;
2651 return T->getStmtClass() == UnaryExprOrTypeTraitExprClass;
2665 enum { LHS, RHS, END_EXPR };
2666 Stmt *SubExprs[END_EXPR];
2673 :
Expr(ArraySubscriptExprClass, t, VK, OK) {
2674 SubExprs[LHS] = lhs;
2675 SubExprs[RHS] = rhs;
2682 :
Expr(ArraySubscriptExprClass, Shell) { }
2724 return T->getStmtClass() == ArraySubscriptExprClass;
2729 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
2743 enum { BASE, ROW_IDX, COLUMN_IDX, END_EXPR };
2744 Stmt *SubExprs[END_EXPR];
2751 SubExprs[BASE] =
Base;
2752 SubExprs[ROW_IDX] = RowIdx;
2753 SubExprs[COLUMN_IDX] = ColumnIdx;
2760 :
Expr(MatrixSubscriptExprClass, Shell) {}
2764 assert((SubExprs[COLUMN_IDX] || IsIncomplete) &&
2765 "expressions without column index must be marked as incomplete");
2766 return IsIncomplete;
2779 "cannot get the column index of an incomplete expression");
2780 return cast<Expr>(SubExprs[COLUMN_IDX]);
2802 return T->getStmtClass() == MatrixSubscriptExprClass;
2807 return child_range(&SubExprs[0], &SubExprs[0] + END_EXPR);
2821 enum { FN = 0, PREARGS_START = 1 };
2854 Stmt **getTrailingStmts() {
2855 return reinterpret_cast<Stmt **
>(
reinterpret_cast<char *
>(
this) +
2858 Stmt *
const *getTrailingStmts()
const {
2859 return const_cast<CallExpr *
>(
this)->getTrailingStmts();
2864 static unsigned offsetToTrailingObjects(
StmtClass SC);
2866 unsigned getSizeOfTrailingStmts()
const {
2870 size_t getOffsetOfTrailingFPFeatures()
const {
2872 return CallExprBits.OffsetToTrailingObjects + getSizeOfTrailingStmts();
2895 bool HasFPFeatures) {
2896 return (1 + NumPreArgs + NumArgs) *
sizeof(
Stmt *) +
2901 assert(I <
getNumPreArgs() &&
"Prearg access out of range!");
2902 return getTrailingStmts()[PREARGS_START + I];
2905 assert(I <
getNumPreArgs() &&
"Prearg access out of range!");
2906 return getTrailingStmts()[PREARGS_START + I];
2909 assert(I <
getNumPreArgs() &&
"Prearg access out of range!");
2910 getTrailingStmts()[PREARGS_START + I] = PreArg;
2919 reinterpret_cast<char *
>(
this) +
CallExprBits.OffsetToTrailingObjects +
2920 getSizeOfTrailingStmts());
2925 reinterpret_cast<const char *
>(
this) +
2926 CallExprBits.OffsetToTrailingObjects + getSizeOfTrailingStmts());
2968 bool HasFPFeatures, EmptyShell Empty);
3002 return reinterpret_cast<Expr **
>(getTrailingStmts() + PREARGS_START +
3006 return reinterpret_cast<const Expr *
const *
>(
3012 assert(Arg <
getNumArgs() &&
"Arg access out of range!");
3016 assert(Arg <
getNumArgs() &&
"Arg access out of range!");
3025 assert(Arg <
getNumArgs() &&
"Arg access out of range!");
3033 reinterpret_cast<Expr **
>(getTrailingStmts() + PREARGS_START),
3045 "shrinkNumArgs cannot increase the number of arguments!");
3046 NumArgs = NewNumArgs;
3065 return getTrailingStmts() + PREARGS_START +
getNumPreArgs();
3070 return getTrailingStmts() + PREARGS_START +
getNumPreArgs();
3149 return T->getStmtClass() >= firstCallExprConstant &&
3150 T->getStmtClass() <= lastCallExprConstant;
3155 return child_range(getTrailingStmts(), getTrailingStmts() + PREARGS_START +
3161 getTrailingStmts() + PREARGS_START +
3170 private llvm::TrailingObjects<MemberExpr, NestedNameSpecifierLoc,
3171 DeclAccessPair, ASTTemplateKWAndArgsInfo,
3172 TemplateArgumentLoc> {
3176 friend TrailingObjects;
3193 size_t numTrailingObjects(OverloadToken<NestedNameSpecifierLoc>)
const {
3197 size_t numTrailingObjects(OverloadToken<DeclAccessPair>)
const {
3198 return hasFoundDecl();
3201 size_t numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>)
const {
3202 return hasTemplateKWAndArgsInfo();
3205 bool hasFoundDecl()
const {
return MemberExprBits.HasFoundDecl; }
3207 bool hasTemplateKWAndArgsInfo()
const {
3211 MemberExpr(
Expr *
Base,
bool IsArrow, SourceLocation OperatorLoc,
3212 NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc,
3213 ValueDecl *MemberDecl, DeclAccessPair FoundDecl,
3214 const DeclarationNameInfo &NameInfo,
3215 const TemplateArgumentListInfo *TemplateArgs, QualType
T,
3217 MemberExpr(EmptyShell Empty)
3218 :
Expr(MemberExprClass, Empty),
Base(), MemberDecl() {}
3221 static MemberExpr *
Create(
const ASTContext &
C,
Expr *
Base,
bool IsArrow,
3222 SourceLocation OperatorLoc,
3223 NestedNameSpecifierLoc QualifierLoc,
3224 SourceLocation TemplateKWLoc, ValueDecl *MemberDecl,
3225 DeclAccessPair FoundDecl,
3226 DeclarationNameInfo MemberNameInfo,
3227 const TemplateArgumentListInfo *TemplateArgs,
3245 bool HasTemplateKWAndArgsInfo,
3246 unsigned NumTemplateArgs);
3260 if (!hasFoundDecl())
3263 return *getTrailingObjects<DeclAccessPair>();
3277 return *getTrailingObjects<NestedNameSpecifierLoc>();
3290 if (!hasTemplateKWAndArgsInfo())
3292 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->TemplateKWLoc;
3298 if (!hasTemplateKWAndArgsInfo())
3300 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->LAngleLoc;
3306 if (!hasTemplateKWAndArgsInfo())
3308 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->RAngleLoc;
3322 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->copyInto(
3323 getTrailingObjects<TemplateArgumentLoc>(), List);
3332 return getTrailingObjects<TemplateArgumentLoc>();
3341 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->NumTemplateArgs;
3351 MemberLoc, MemberDNLoc);
3401 return T->getStmtClass() == MemberExprClass;
3422 llvm::PointerIntPair<TypeSourceInfo *, 1, bool> TInfoAndScope;
3428 LParenLoc(lparenloc), TInfoAndScope(tinfo, fileScope), Init(init) {
3434 :
Expr(CompoundLiteralExprClass, Empty) { }
3447 return TInfoAndScope.getPointer();
3450 TInfoAndScope.setPointer(tinfo);
3458 return Init->getBeginLoc();
3465 return Init->getEndLoc();
3469 return T->getStmtClass() == CompoundLiteralExprClass;
3486 bool CastConsistency()
const;
3489 return const_cast<CastExpr*
>(
this)->path_buffer();
3497 Expr *op,
unsigned BasePathSize,
bool HasFPFeatures)
3503 "BasePathSize overflow!");
3504 assert(CastConsistency());
3516 "BasePathSize overflow!");
3570 llvm::iterator_range<path_iterator>
path() {
3573 llvm::iterator_range<path_const_iterator>
path()
const {
3623 return T->getStmtClass() >= firstCastExprConstant &&
3624 T->getStmtClass() <= lastCastExprConstant;
3654 private llvm::TrailingObjects<ImplicitCastExpr, CXXBaseSpecifier *,
3655 FPOptionsOverride> {
3660 :
CastExpr(ImplicitCastExprClass, ty, VK, kind, op, BasePathLength,
3670 :
CastExpr(ImplicitCastExprClass, Shell, PathSize, HasFPFeatures) {}
3672 unsigned numTrailingObjects(OverloadToken<CXXBaseSpecifier *>)
const {
3680 :
CastExpr(ImplicitCastExprClass, ty, VK, kind, op, 0,
3681 FPO.requiresTrailingStorage()) {
3697 unsigned PathSize,
bool HasFPFeatures);
3707 return T->getStmtClass() == ImplicitCastExprClass;
3739 :
CastExpr(SC, exprTy, VK, kind, op, PathSize, HasFPFeatures),
3747 :
CastExpr(SC, Shell, PathSize, HasFPFeatures) {}
3760 return T->getStmtClass() >= firstExplicitCastExprConstant &&
3761 T->getStmtClass() <= lastExplicitCastExprConstant;
3770 private llvm::TrailingObjects<CStyleCastExpr, CXXBaseSpecifier *,
3771 FPOptionsOverride> {
3780 LPLoc(l), RPLoc(r) {
3790 unsigned numTrailingObjects(OverloadToken<CXXBaseSpecifier *>)
const {
3801 unsigned PathSize,
bool HasFPFeatures);
3815 return T->getStmtClass() == CStyleCastExprClass;
3841 enum { LHS, RHS, END_EXPR };
3842 Stmt *SubExprs[END_EXPR];
3917 return Opc == BO_PtrMemD || Opc == BO_PtrMemI;
3922 return Opc >= BO_Mul && Opc <= BO_Rem;
3948 llvm_unreachable(
"Not a comparison operator.");
3949 case BO_LT:
return BO_GE;
3950 case BO_GT:
return BO_LE;
3951 case BO_LE:
return BO_GT;
3952 case BO_GE:
return BO_LT;
3953 case BO_EQ:
return BO_NE;
3954 case BO_NE:
return BO_EQ;
3961 llvm_unreachable(
"Not a comparison operator.");
3962 case BO_LT:
return BO_GT;
3963 case BO_GT:
return BO_LT;
3964 case BO_LE:
return BO_GE;
3965 case BO_GE:
return BO_LE;
3976 return Opc >= BO_Assign && Opc <= BO_OrAssign;
3981 return Opc > BO_Assign && Opc <= BO_OrAssign;
3988 if (Opc >= BO_AndAssign)
3989 return Opcode(
unsigned(Opc) - BO_AndAssign + BO_And);
3991 return Opcode(
unsigned(Opc) - BO_MulAssign + BO_Mul);
3995 return Opc == BO_ShlAssign || Opc == BO_ShrAssign;
4009 return S->getStmtClass() >= firstBinaryOperatorConstant &&
4010 S->getStmtClass() <= lastBinaryOperatorConstant;
4015 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
4102 :
BinaryOperator(
C, lhs, rhs, opc, ResType, VK, OK, OpLoc, FPFeatures,
4104 ComputationLHSType(CompLHSType), ComputationResultType(CompResultType) {
4106 "Only should be used for compound assignments");
4111 bool hasFPFeatures);
4129 return S->getStmtClass() == CompoundAssignOperatorClass;
4149 :
Expr(SC,
T, VK, OK), QuestionLoc(qloc), ColonLoc(cloc) {}
4152 :
Expr(SC, Empty) { }
4172 return T->getStmtClass() == ConditionalOperatorClass ||
4173 T->getStmtClass() == BinaryConditionalOperatorClass;
4180 enum { COND, LHS, RHS, END_EXPR };
4181 Stmt* SubExprs[END_EXPR];
4190 SubExprs[COND] = cond;
4191 SubExprs[LHS] = lhs;
4192 SubExprs[RHS] = rhs;
4224 return T->getStmtClass() == ConditionalOperatorClass;
4229 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
4242 enum { COMMON, COND, LHS, RHS, NUM_SUBEXPRS };
4249 Stmt *SubExprs[NUM_SUBEXPRS];
4260 OpaqueValue(opaqueValue) {
4261 SubExprs[COMMON] = common;
4262 SubExprs[COND] = cond;
4263 SubExprs[LHS] = lhs;
4264 SubExprs[RHS] = rhs;
4265 assert(OpaqueValue->
getSourceExpr() == common &&
"Wrong opaque value");
4289 return cast<Expr>(SubExprs[LHS]);
4296 return cast<Expr>(SubExprs[RHS]);
4307 return T->getStmtClass() == BinaryConditionalOperatorClass;
4312 return child_range(SubExprs, SubExprs + NUM_SUBEXPRS);
4321 return co->getCond();
4322 return cast<BinaryConditionalOperator>(
this)->getCond();
4327 return co->getTrueExpr();
4328 return cast<BinaryConditionalOperator>(
this)->getTrueExpr();
4333 return co->getFalseExpr();
4334 return cast<BinaryConditionalOperator>(
this)->getFalseExpr();
4345 LabelLoc(LLoc),
Label(L) {
4351 :
Expr(AddrLabelExprClass, Empty) { }
4365 return T->getStmtClass() == AddrLabelExprClass;
4390 LParenLoc(LParenLoc), RParenLoc(RParenLoc) {
4415 return T->getStmtClass() == StmtExprClass;
4447 :
Expr(ShuffleVectorExprClass, Empty), SubExprs(nullptr) { }
4459 return T->getStmtClass() == ShuffleVectorExprClass;
4472 assert((Index < NumExprs) &&
"Arg access out of range!");
4473 return cast<Expr>(SubExprs[Index]);
4476 assert((Index < NumExprs) &&
"Arg access out of range!");
4477 return cast<Expr>(SubExprs[Index]);
4483 assert((N < NumExprs - 2) &&
"Shuffle idx out of range!");
4489 return child_range(&SubExprs[0], &SubExprs[0]+NumExprs);
4513 :
Expr(ConvertVectorExprClass, DstType, VK, OK), SrcExpr(SrcExpr),
4514 TInfo(TI), BuiltinLoc(BuiltinLoc), RParenLoc(RParenLoc) {
4539 return T->getStmtClass() == ConvertVectorExprClass;
4559 enum { COND, LHS, RHS, END_EXPR };
4560 Stmt* SubExprs[END_EXPR];
4567 :
Expr(ChooseExprClass, t, VK, OK), BuiltinLoc(BLoc), RParenLoc(RP),
4568 CondIsTrue(condIsTrue) {
4569 SubExprs[COND] = cond;
4570 SubExprs[LHS] = lhs;
4571 SubExprs[RHS] = rhs;
4583 "Dependent condition isn't true or false");
4615 return T->getStmtClass() == ChooseExprClass;
4620 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
4654 return T->getStmtClass() == GNUNullExprClass;
4669 llvm::PointerIntPair<TypeSourceInfo *, 1, bool> TInfo;
4675 TInfo(TInfo, IsMS), BuiltinLoc(BLoc), RParenLoc(RPLoc) {
4681 :
Expr(VAArgExprClass, Empty), Val(nullptr), TInfo(nullptr,
false) {}
4704 return T->getStmtClass() == VAArgExprClass;
4742 const Expr *DefaultExpr)
const;
4763 llvm_unreachable(
"unknown source location expression kind");
4784 return T->getStmtClass() == SourceLocExprClass;
4858 llvm::PointerIntPair<InitListExpr *, 1, bool> AltForm;
4867 llvm::PointerUnion<Expr *, FieldDecl *> ArrayFillerOrUnionFieldInit;
4875 :
Expr(InitListExprClass, Empty), AltForm(nullptr,
true) { }
4884 return reinterpret_cast<Expr *
const *
>(InitExprs.
data());
4895 return cast_or_null<Expr>(InitExprs[
Init]);
4900 return cast_or_null<Expr>(InitExprs[
Init]);
4942 return ArrayFillerOrUnionFieldInit.dyn_cast<
Expr *>();
4956 return isa<DesignatedInitExpr>(S);
4967 return ArrayFillerOrUnionFieldInit.dyn_cast<
FieldDecl *>();
4973 assert((FD ==
nullptr
4976 &&
"Only one field of a union may be initialized at a time!");
4977 ArrayFillerOrUnionFieldInit = FD;
5011 return !AltForm.getInt() || !AltForm.getPointer();
5018 AltForm.setPointer(
Init);
5019 AltForm.setInt(
true);
5020 Init->AltForm.setPointer(
this);
5021 Init->AltForm.setInt(
false);
5035 return T->getStmtClass() == InitListExprClass;
5047 if (InitExprs.
empty())
5092 private llvm::TrailingObjects<DesignatedInitExpr, Stmt *> {
5104 LLVM_PREFERRED_TYPE(
bool)
5105 unsigned GNUSyntax : 1;
5108 unsigned NumDesignators : 15;
5113 unsigned NumSubExprs : 16;
5126 NumDesignators(0), NumSubExprs(NumSubExprs), Designators(
nullptr) { }
5137 struct FieldDesignatorInfo {
5154 : NameOrField(
reinterpret_cast<uintptr_t>(II) | 0x1), DotLoc(DotLoc),
5155 FieldLoc(FieldLoc) {}
5159 struct ArrayOrRangeDesignatorInfo {
5174 ArrayOrRangeDesignatorInfo(
unsigned Index,
SourceLocation LBracketLoc,
5176 : Index(Index), LBracketLoc(LBracketLoc), RBracketLoc(RBracketLoc) {}
5178 ArrayOrRangeDesignatorInfo(
unsigned Index,
5182 : Index(Index), LBracketLoc(LBracketLoc), EllipsisLoc(EllipsisLoc),
5183 RBracketLoc(RBracketLoc) {}
5187 enum DesignatorKind {
5190 ArrayRangeDesignator
5193 DesignatorKind Kind;
5203 Designator(DesignatorKind Kind) : Kind(Kind) {}
5220 new (&D.
FieldInfo) FieldDesignatorInfo(FieldName, DotLoc, FieldLoc);
5275 "Only valid on an array or array-range designator");
5281 "Only valid on an array or array-range designator");
5287 "Only valid on an array-range designator");
5293 "Only valid on an array or array-range designator");
5319 unsigned NumIndexExprs);
5322 unsigned size()
const {
return NumDesignators; }
5326 return {Designators, NumDesignators};
5330 return {Designators, NumDesignators};
5339 unsigned NumDesigs);
5375 assert(Idx < NumSubExprs &&
"Subscript out of range");
5376 return cast<Expr>(getTrailingObjects<Stmt *>()[Idx]);
5380 assert(Idx < NumSubExprs &&
"Subscript out of range");
5381 getTrailingObjects<Stmt *>()[Idx] = E;
5395 return T->getStmtClass() == DesignatedInitExprClass;
5400 Stmt **begin = getTrailingObjects<Stmt *>();
5404 Stmt *
const *begin = getTrailingObjects<Stmt *>();
5428 :
Expr(NoInitExprClass, Empty) { }
5431 return T->getStmtClass() == NoInitExprClass;
5460 Stmt *BaseAndUpdaterExprs[2];
5467 :
Expr(DesignatedInitUpdateExprClass, Empty) { }
5473 return T->getStmtClass() == DesignatedInitUpdateExprClass;
5480 return cast<InitListExpr>(BaseAndUpdaterExprs[1]);
5487 return child_range(&BaseAndUpdaterExprs[0], &BaseAndUpdaterExprs[0] + 2);
5491 &BaseAndUpdaterExprs[0] + 2);
5515 :
Expr(ArrayInitLoopExprClass, Empty), SubExprs{} {}
5520 SubExprs{CommonInit, ElementInit} {
5527 return cast<OpaqueValueExpr>(SubExprs[0]);
5534 return cast<ConstantArrayType>(
getType()->castAsArrayTypeUnsafe())
5539 return S->getStmtClass() == ArrayInitLoopExprClass;
5566 :
Expr(ArrayInitIndexExprClass, Empty) {}
5575 return S->getStmtClass() == ArrayInitIndexExprClass;
5609 :
Expr(ImplicitValueInitExprClass, Empty) { }
5612 return T->getStmtClass() == ImplicitValueInitExprClass;
5629 private llvm::TrailingObjects<ParenListExpr, Stmt *> {
5631 friend TrailingObjects;
5665 return reinterpret_cast<Expr **
>(getTrailingObjects<Stmt *>());
5676 return T->getStmtClass() == ParenListExprClass;
5724 private llvm::TrailingObjects<GenericSelectionExpr, Stmt *,
5728 friend TrailingObjects;
5734 unsigned NumAssocs : 15;
5735 unsigned ResultIndex : 15;
5736 LLVM_PREFERRED_TYPE(
bool)
5737 unsigned IsExprPredicate : 1;
5739 ResultDependentIndex = 0x7FFF
5742 unsigned getIndexOfControllingExpression()
const {
5746 assert(
isExprPredicate() &&
"Asking for the controlling expression of a "
5747 "selection expr predicated by a type");
5751 unsigned getIndexOfControllingType()
const {
5755 "selection expr predicated by an expression");
5759 unsigned getIndexOfStartOfAssociatedExprs()
const {
5766 unsigned getIndexOfStartOfAssociatedTypes()
const {
5775 SourceLocation DefaultLoc, RParenLoc;
5786 unsigned numTrailingObjects(OverloadToken<Stmt *>)
const {
5792 unsigned numTrailingObjects(OverloadToken<TypeSourceInfo *>)
const {
5798 template <
bool Const>
class AssociationIteratorTy;
5802 template <
bool Const>
class AssociationTy {
5803 friend class GenericSelectionExpr;
5804 template <
bool OtherConst>
friend class AssociationIteratorTy;
5805 using ExprPtrTy = std::conditional_t<Const, const Expr *, Expr *>;
5807 std::conditional_t<Const, const TypeSourceInfo *, TypeSourceInfo *>;
5811 AssociationTy(ExprPtrTy E, TSIPtrTy TSI,
bool Selected)
5812 : E(E), TSI(TSI), Selected(Selected) {}
5815 ExprPtrTy getAssociationExpr()
const {
return E; }
5816 TSIPtrTy getTypeSourceInfo()
const {
return TSI; }
5817 QualType getType()
const {
return TSI ? TSI->getType() : QualType(); }
5818 bool isSelected()
const {
return Selected; }
5819 AssociationTy *operator->() {
return this; }
5820 const AssociationTy *operator->()
const {
return this; }
5827 template <
bool Const>
5828 class AssociationIteratorTy
5829 :
public llvm::iterator_facade_base<
5830 AssociationIteratorTy<Const>, std::input_iterator_tag,
5831 AssociationTy<Const>, std::ptrdiff_t, AssociationTy<Const>,
5832 AssociationTy<Const>> {
5833 friend class GenericSelectionExpr;
5847 using BaseTy =
typename AssociationIteratorTy::iterator_facade_base;
5848 using StmtPtrPtrTy =
5849 std::conditional_t<Const, const Stmt *const *, Stmt **>;
5850 using TSIPtrPtrTy = std::conditional_t<
Const,
const TypeSourceInfo *
const *,
5852 StmtPtrPtrTy E =
nullptr;
5854 unsigned Offset = 0, SelectedOffset = 0;
5855 AssociationIteratorTy(StmtPtrPtrTy E, TSIPtrPtrTy TSI,
unsigned Offset,
5856 unsigned SelectedOffset)
5857 : E(E), TSI(TSI), Offset(Offset), SelectedOffset(SelectedOffset) {}
5860 AssociationIteratorTy() : E(nullptr), TSI(nullptr) {}
5861 typename BaseTy::reference
operator*()
const {
5862 return AssociationTy<Const>(cast<Expr>(*E), *TSI,
5863 Offset == SelectedOffset);
5865 typename BaseTy::pointer operator->()
const {
return **
this; }
5866 using BaseTy::operator++;
5867 AssociationIteratorTy &operator++() {
5878 GenericSelectionExpr(
const ASTContext &Context, SourceLocation GenericLoc,
5879 Expr *ControllingExpr,
5880 ArrayRef<TypeSourceInfo *> AssocTypes,
5881 ArrayRef<Expr *> AssocExprs, SourceLocation DefaultLoc,
5882 SourceLocation RParenLoc,
5883 bool ContainsUnexpandedParameterPack,
5884 unsigned ResultIndex);
5888 GenericSelectionExpr(
const ASTContext &Context, SourceLocation GenericLoc,
5889 Expr *ControllingExpr,
5890 ArrayRef<TypeSourceInfo *> AssocTypes,
5891 ArrayRef<Expr *> AssocExprs, SourceLocation DefaultLoc,
5892 SourceLocation RParenLoc,
5893 bool ContainsUnexpandedParameterPack);
5897 GenericSelectionExpr(
const ASTContext &Context, SourceLocation GenericLoc,
5898 TypeSourceInfo *ControllingType,
5899 ArrayRef<TypeSourceInfo *> AssocTypes,
5900 ArrayRef<Expr *> AssocExprs, SourceLocation DefaultLoc,
5901 SourceLocation RParenLoc,
5902 bool ContainsUnexpandedParameterPack,
5903 unsigned ResultIndex);
5907 GenericSelectionExpr(
const ASTContext &Context, SourceLocation GenericLoc,
5908 TypeSourceInfo *ControllingType,
5909 ArrayRef<TypeSourceInfo *> AssocTypes,
5910 ArrayRef<Expr *> AssocExprs, SourceLocation DefaultLoc,
5911 SourceLocation RParenLoc,
5912 bool ContainsUnexpandedParameterPack);
5915 explicit GenericSelectionExpr(EmptyShell Empty,
unsigned NumAssocs);
5920 static GenericSelectionExpr *
5921 Create(
const ASTContext &Context, SourceLocation GenericLoc,
5922 Expr *ControllingExpr, ArrayRef<TypeSourceInfo *> AssocTypes,
5923 ArrayRef<Expr *> AssocExprs, SourceLocation DefaultLoc,
5924 SourceLocation RParenLoc,
bool ContainsUnexpandedParameterPack,
5925 unsigned ResultIndex);
5929 static GenericSelectionExpr *
5930 Create(
const ASTContext &Context, SourceLocation GenericLoc,
5931 Expr *ControllingExpr, ArrayRef<TypeSourceInfo *> AssocTypes,
5932 ArrayRef<Expr *> AssocExprs, SourceLocation DefaultLoc,
5933 SourceLocation RParenLoc,
bool ContainsUnexpandedParameterPack);
5937 static GenericSelectionExpr *
5938 Create(
const ASTContext &Context, SourceLocation GenericLoc,
5939 TypeSourceInfo *ControllingType, ArrayRef<TypeSourceInfo *> AssocTypes,
5940 ArrayRef<Expr *> AssocExprs, SourceLocation DefaultLoc,
5941 SourceLocation RParenLoc,
bool ContainsUnexpandedParameterPack,
5942 unsigned ResultIndex);
5946 static GenericSelectionExpr *
5947 Create(
const ASTContext &Context, SourceLocation GenericLoc,
5948 TypeSourceInfo *ControllingType, ArrayRef<TypeSourceInfo *> AssocTypes,
5949 ArrayRef<Expr *> AssocExprs, SourceLocation DefaultLoc,
5950 SourceLocation RParenLoc,
bool ContainsUnexpandedParameterPack);
5953 static GenericSelectionExpr *
CreateEmpty(
const ASTContext &Context,
5954 unsigned NumAssocs);
5962 llvm::iterator_range<ConstAssociationIterator>;
5972 "Generic selection is result-dependent but getResultIndex called!");
5990 getTrailingObjects<Stmt *>()[getIndexOfControllingExpression()]);
5994 getTrailingObjects<Stmt *>()[getIndexOfControllingExpression()]);
6001 return getTrailingObjects<TypeSourceInfo *>()[getIndexOfControllingType()];
6004 return getTrailingObjects<TypeSourceInfo *>()[getIndexOfControllingType()];
6011 getTrailingObjects<Stmt *>()[getIndexOfStartOfAssociatedExprs() +
6016 getTrailingObjects<Stmt *>()[getIndexOfStartOfAssociatedExprs() +
6021 return {
reinterpret_cast<Expr *
const *
>(getTrailingObjects<Stmt *>() +
6022 getIndexOfStartOfAssociatedExprs()),
6026 return {getTrailingObjects<TypeSourceInfo *>() +
6027 getIndexOfStartOfAssociatedTypes(),
6035 "Out-of-range index in GenericSelectionExpr::getAssociation!");
6038 getTrailingObjects<Stmt *>()[getIndexOfStartOfAssociatedExprs() +
6046 "Out-of-range index in GenericSelectionExpr::getAssociation!");
6049 getTrailingObjects<Stmt *>()[getIndexOfStartOfAssociatedExprs() +
6058 getIndexOfStartOfAssociatedExprs(),
6059 getTrailingObjects<TypeSourceInfo *>() +
6060 getIndexOfStartOfAssociatedTypes(),
6063 NumAssocs, ResultIndex);
6064 return llvm::make_range(
Begin, End);
6069 getIndexOfStartOfAssociatedExprs(),
6070 getTrailingObjects<TypeSourceInfo *>() +
6071 getIndexOfStartOfAssociatedTypes(),
6074 NumAssocs, ResultIndex);
6075 return llvm::make_range(
Begin, End);
6087 return T->getStmtClass() == GenericSelectionExprClass;
6092 getTrailingObjects<Stmt *>() +
6093 numTrailingObjects(OverloadToken<Stmt *>()));
6097 getTrailingObjects<Stmt *>() +
6098 numTrailingObjects(OverloadToken<Stmt *>()));
6120 :
Expr(ExtVectorElementExprClass, ty, VK,
6122 Base(base), Accessor(&accessor), AccessorLoc(loc) {
6128 :
Expr(ExtVectorElementExprClass, Empty) { }
6161 return T->getStmtClass() == ExtVectorElementExprClass;
6205 return T->getStmtClass() == BlockExprClass;
6247 :
Expr(AsTypeExprClass, DstType, VK, OK), SrcExpr(SrcExpr),
6248 BuiltinLoc(BuiltinLoc), RParenLoc(RParenLoc) {
6265 return T->getStmtClass() == AsTypeExprClass;
6305 private llvm::TrailingObjects<PseudoObjectExpr, Expr *> {
6317 Expr **getSubExprsBuffer() {
return getTrailingObjects<Expr *>(); }
6318 const Expr *
const *getSubExprsBuffer()
const {
6319 return getTrailingObjects<Expr *>();
6324 unsigned resultIndex);
6328 unsigned getNumSubExprs()
const {
6339 unsigned resultIndex);
6342 unsigned numSemanticExprs);
6372 return getSubExprsBuffer() + 1;
6375 return getSubExprsBuffer() + 1;
6378 return getSubExprsBuffer() + getNumSubExprs();
6381 return getSubExprsBuffer() + getNumSubExprs();
6392 assert(index + 1 < getNumSubExprs());
6393 return getSubExprsBuffer()[index + 1];
6417 Stmt *
const *cs =
const_cast<Stmt *
const *
>(
6418 reinterpret_cast<const Stmt *
const *
>(getSubExprsBuffer()));
6423 return T->getStmtClass() == PseudoObjectExprClass;
6440#define BUILTIN(ID, TYPE, ATTRS)
6441#define ATOMIC_BUILTIN(ID, TYPE, ATTRS) AO ## ID,
6442#include "clang/Basic/Builtins.inc"
6451 enum { PTR, ORDER, VAL1, ORDER_FAIL, VAL2, WEAK, END_EXPR };
6452 Stmt *SubExprs[END_EXPR + 1];
6453 unsigned NumSubExprs;
6454 SourceLocation BuiltinLoc, RParenLoc;
6470 return cast<Expr>(SubExprs[
PTR]);
6473 return cast<Expr>(SubExprs[ORDER]);
6477 return cast<Expr>(SubExprs[NumSubExprs - 1]);
6480 if (Op == AO__c11_atomic_init || Op == AO__opencl_atomic_init)
6481 return cast<Expr>(SubExprs[ORDER]);
6482 assert(NumSubExprs > VAL1);
6483 return cast<Expr>(SubExprs[VAL1]);
6486 assert(NumSubExprs > ORDER_FAIL);
6487 return cast<Expr>(SubExprs[ORDER_FAIL]);
6490 if (Op == AO__atomic_exchange || Op == AO__scoped_atomic_exchange)
6491 return cast<Expr>(SubExprs[ORDER_FAIL]);
6492 assert(NumSubExprs > VAL2);
6493 return cast<Expr>(SubExprs[VAL2]);
6496 assert(NumSubExprs > WEAK);
6497 return cast<Expr>(SubExprs[WEAK]);
6504#define BUILTIN(ID, TYPE, ATTRS)
6505#define ATOMIC_BUILTIN(ID, TYPE, ATTRS) \
6508#include "clang/Basic/Builtins.inc"
6510 llvm_unreachable(
"not an atomic operator?");
6516 return reinterpret_cast<Expr *
const *
>(SubExprs);
6524 return getOp() == AO__c11_atomic_compare_exchange_strong ||
6525 getOp() == AO__c11_atomic_compare_exchange_weak ||
6526 getOp() == AO__hip_atomic_compare_exchange_strong ||
6527 getOp() == AO__opencl_atomic_compare_exchange_strong ||
6528 getOp() == AO__opencl_atomic_compare_exchange_weak ||
6529 getOp() == AO__hip_atomic_compare_exchange_weak ||
6530 getOp() == AO__atomic_compare_exchange ||
6531 getOp() == AO__atomic_compare_exchange_n ||
6532 getOp() == AO__scoped_atomic_compare_exchange ||
6533 getOp() == AO__scoped_atomic_compare_exchange_n;
6537 return getOp() >= AO__opencl_atomic_compare_exchange_strong &&
6538 getOp() <= AO__opencl_atomic_store;
6548 return T->getStmtClass() == AtomicExprClass;
6553 return child_range(SubExprs, SubExprs+NumSubExprs);
6564 if (Op >= AO__opencl_atomic_compare_exchange_strong &&
6565 Op <= AO__opencl_atomic_store && Op != AO__opencl_atomic_init)
6567 if (Op >= AO__hip_atomic_compare_exchange_strong &&
6568 Op <= AO__hip_atomic_store)
6570 if (Op >= AO__scoped_atomic_add_fetch && Op <= AO__scoped_atomic_xor_fetch)
6594 ExprDependence::Error);
6608 return T->getStmtClass() == TypoExprClass;
6748 OPENACC_END_EXPR = STRIDE
6752 Stmt *SubExprs[END_EXPR] = {
nullptr};
6753 SourceLocation ColonLocFirst;
6754 SourceLocation ColonLocSecond;
6755 SourceLocation RBracketLoc;
6764 ColonLocFirst(ColonLocFirst), ColonLocSecond(ColonLocSecond),
6765 RBracketLoc(RBracketLoc) {
6767 setLowerBound(LowerBound);
6778 ColonLocFirst(ColonLoc), RBracketLoc(RBracketLoc) {
6780 setLowerBound(LowerBound);
6787 :
Expr(ArraySectionExprClass, Shell) {}
6793 return T->getStmtClass() == ArraySectionExprClass;
6806 return cast_or_null<Expr>(SubExprs[LOWER_BOUND]);
6816 "Stride not valid in OpenACC subarrays");
6817 return cast_or_null<Expr>(SubExprs[STRIDE]);
6822 "Stride not valid in OpenACC subarrays");
6823 return cast_or_null<Expr>(SubExprs[STRIDE]);
6834 "second colon for stride not valid in OpenACC subarrays");
6835 return ColonLocSecond;
6857 void setBase(
Expr *E) { SubExprs[BASE] = E; }
6860 void setLowerBound(
Expr *E) { SubExprs[LOWER_BOUND] = E; }
6863 void setLength(
Expr *E) { SubExprs[LENGTH] = E; }
6866 void setStride(
Expr *E) {
6868 "Stride not valid in OpenACC subarrays");
6869 SubExprs[STRIDE] = E;
6872 void setColonLocFirst(SourceLocation L) { ColonLocFirst = L; }
6874 void setColonLocSecond(SourceLocation L) {
6876 "second colon for stride not valid in OpenACC subarrays");
6879 void setRBracketLoc(SourceLocation L) { RBracketLoc = L; }
6909 private llvm::TrailingObjects<RecoveryExpr, Expr *> {
6917 auto *B = getTrailingObjects<Expr *>();
6926 Stmt **B =
reinterpret_cast<Stmt **
>(getTrailingObjects<Expr *>());
6934 return T->getStmtClass() == RecoveryExprClass;
6941 :
Expr(RecoveryExprClass, Empty), NumExprs(NumSubExprs) {}
6943 size_t numTrailingObjects(OverloadToken<Stmt *>)
const {
return NumExprs; }
6945 SourceLocation BeginLoc, EndLoc;
6947 friend TrailingObjects;
static bool CanThrow(Expr *E, ASTContext &Ctx)
clang::CharUnits operator*(clang::CharUnits::QuantityType Scale, const clang::CharUnits &CU)
Defines the clang::LangOptions interface.
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.
llvm::MachO::Target Target
Provides definitions for the atomic synchronization scopes.
Defines enumerations for the type traits support.
C Language Family Type Representation.
__device__ __2f16 float c
llvm::APFloat getValue(const llvm::fltSemantics &Semantics) const
void setValue(const ASTContext &C, const llvm::APFloat &Val)
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
@ None
There is no such object (it's outside its lifetime).
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Imports selected nodes from one AST context into another context, merging AST nodes where appropriate...
Reads an AST files chain containing the contents of a translation unit.
std::reverse_iterator< iterator > reverse_iterator
reverse_iterator rbegin()
pointer data()
data - Return a pointer to the vector's buffer, even if empty().
std::reverse_iterator< const_iterator > const_reverse_iterator
AbstractConditionalOperator - An abstract base class for ConditionalOperator and BinaryConditionalOpe...
AbstractConditionalOperator(StmtClass SC, EmptyShell Empty)
SourceLocation getColonLoc() const
Expr * getCond() const
getCond - Return the expression representing the condition for the ?: operator.
static bool classof(const Stmt *T)
AbstractConditionalOperator(StmtClass SC, QualType T, ExprValueKind VK, ExprObjectKind OK, SourceLocation qloc, SourceLocation cloc)
Expr * getTrueExpr() const
getTrueExpr - Return the subexpression representing the value of the expression if the condition eval...
SourceLocation getQuestionLoc() const
Expr * getFalseExpr() const
getFalseExpr - Return the subexpression representing the value of the expression if the condition eva...
AddrLabelExpr - The GNU address of label extension, representing &&label.
SourceLocation getAmpAmpLoc() const
static bool classof(const Stmt *T)
void setLabel(LabelDecl *L)
void setLabelLoc(SourceLocation L)
AddrLabelExpr(SourceLocation AALoc, SourceLocation LLoc, LabelDecl *L, QualType t)
void setAmpAmpLoc(SourceLocation L)
SourceLocation getEndLoc() const LLVM_READONLY
AddrLabelExpr(EmptyShell Empty)
Build an empty address of a label expression.
SourceLocation getLabelLoc() const
const_child_range children() const
SourceLocation getBeginLoc() const LLVM_READONLY
LabelDecl * getLabel() const
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
const_child_range children() const
ArrayInitIndexExpr(QualType T)
SourceLocation getBeginLoc() const LLVM_READONLY
static bool classof(const Stmt *S)
SourceLocation getEndLoc() const LLVM_READONLY
Represents a loop initializing the elements of an array.
ArrayInitLoopExpr(QualType T, Expr *CommonInit, Expr *ElementInit)
const_child_range children() const
llvm::APInt getArraySize() const
SourceLocation getEndLoc() const LLVM_READONLY
static bool classof(const Stmt *S)
SourceLocation getBeginLoc() const LLVM_READONLY
OpaqueValueExpr * getCommonExpr() const
Get the common subexpression shared by all initializations (the source array).
Expr * getSubExpr() const
Get the initializer to use for each array element.
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
const Expr * getStride() const
SourceLocation getRBracketLoc() const
const_child_range children() const
Expr * getBase()
Get base of the array section.
static bool classof(const Stmt *T)
SourceLocation getEndLoc() const LLVM_READONLY
Expr * getLength()
Get length of array section.
static QualType getBaseOriginalType(const Expr *Base)
Return original type of the base expression for array section.
SourceLocation getExprLoc() const LLVM_READONLY
const Expr * getLowerBound() const
bool isOMPArraySection() const
Expr * getStride()
Get stride of array section.
const Expr * getBase() const
ArraySectionExpr(Expr *Base, Expr *LowerBound, Expr *Length, QualType Type, ExprValueKind VK, ExprObjectKind OK, SourceLocation ColonLoc, SourceLocation RBracketLoc)
const Expr * getLength() const
ArraySectionExpr(EmptyShell Shell)
Create an empty array section expression.
ArraySectionExpr(Expr *Base, Expr *LowerBound, Expr *Length, Expr *Stride, QualType Type, ExprValueKind VK, ExprObjectKind OK, SourceLocation ColonLocFirst, SourceLocation ColonLocSecond, SourceLocation RBracketLoc)
SourceLocation getColonLocSecond() const
Expr * getLowerBound()
Get lower bound of array section.
SourceLocation getBeginLoc() const LLVM_READONLY
bool isOpenACCArraySection() const
SourceLocation getColonLocFirst() const
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
ArraySubscriptExpr(Expr *lhs, Expr *rhs, QualType t, ExprValueKind VK, ExprObjectKind OK, SourceLocation rbracketloc)
SourceLocation getExprLoc() const LLVM_READONLY
const Expr * getLHS() const
const_child_range children() const
const Expr * getBase() const
SourceLocation getRBracketLoc() const
const Expr * getRHS() const
Expr * getLHS()
An array access can be written A[4] or 4[A] (both are equivalent).
SourceLocation getBeginLoc() const LLVM_READONLY
const Expr * getIdx() const
SourceLocation getEndLoc() const
void setRBracketLoc(SourceLocation L)
static bool classof(const Stmt *T)
ArraySubscriptExpr(EmptyShell Shell)
Create an empty array subscript expression.
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
SourceLocation getEndLoc() const LLVM_READONLY
AsTypeExpr(Expr *SrcExpr, QualType DstType, ExprValueKind VK, ExprObjectKind OK, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
SourceLocation getBuiltinLoc() const
getBuiltinLoc - Return the location of the __builtin_astype token.
const_child_range children() const
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getRParenLoc() const
getRParenLoc - Return the location of final right parenthesis.
static bool classof(const Stmt *T)
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
static std::unique_ptr< AtomicScopeModel > getScopeModel(AtomicOp Op)
Get atomic scope model for the atomic op code.
SourceLocation getRParenLoc() const
SourceLocation getEndLoc() const LLVM_READONLY
QualType getValueType() const
AtomicExpr(EmptyShell Empty)
Build an empty AtomicExpr.
StringRef getOpAsString() const
const Expr *const * getSubExprs() const
std::unique_ptr< AtomicScopeModel > getScopeModel() const
Get atomic scope model.
const_child_range children() const
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getBuiltinLoc() const
Expr * getOrderFail() const
unsigned getNumSubExprs() const
static bool classof(const Stmt *T)
static std::unique_ptr< AtomicScopeModel > create(AtomicScopeModelKind K)
Create an atomic scope model by AtomicScopeModelKind.
Attr - This represents one attribute.
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
static bool classof(const Stmt *T)
BinaryConditionalOperator(Expr *common, OpaqueValueExpr *opaqueValue, Expr *cond, Expr *lhs, Expr *rhs, SourceLocation qloc, SourceLocation cloc, QualType t, ExprValueKind VK, ExprObjectKind OK)
const_child_range children() const
SourceLocation getBeginLoc() const LLVM_READONLY
Expr * getFalseExpr() const
getFalseExpr - Return the subexpression which will be evaluated if the condnition evaluates to false;...
BinaryConditionalOperator(EmptyShell Empty)
Build an empty conditional operator.
OpaqueValueExpr * getOpaqueValue() const
getOpaqueValue - Return the opaque value placeholder.
SourceLocation getEndLoc() const LLVM_READONLY
Expr * getCond() const
getCond - Return the condition expression; this is defined in terms of the opaque value.
Expr * getTrueExpr() const
getTrueExpr - Return the subexpression which will be evaluated if the condition evaluates to true; th...
Expr * getCommon() const
getCommon - Return the common expression, written to the left of the condition.
A builtin binary operation expression such as "x + y" or "x <= y".
static bool isLogicalOp(Opcode Opc)
BinaryOperator(EmptyShell Empty)
Construct an empty binary operator.
static bool isRelationalOp(Opcode Opc)
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given binary opcode.
const FPOptionsOverride * getTrailingFPFeatures() const
const_child_range children() const
static bool isComparisonOp(Opcode Opc)
void setHasStoredFPFeatures(bool B)
Set and fetch the bit that shows whether FPFeatures needs to be allocated in Trailing Storage.
void setOperatorLoc(SourceLocation L)
static bool isShiftOp(Opcode Opc)
bool isComparisonOp() const
StringRef getOpcodeStr() const
static bool isCommaOp(Opcode Opc)
static Opcode getOpForCompoundAssignment(Opcode Opc)
SourceLocation getBeginLoc() const LLVM_READONLY
FPOptionsOverride * getTrailingFPFeatures()
Return a pointer to the trailing FPOptions.
bool isRelationalOp() const
SourceLocation getOperatorLoc() const
bool isFEnvAccessOn(const LangOptions &LO) const
Get the FENV_ACCESS status of this operator.
bool hasStoredFPFeatures() const
bool isCompoundAssignmentOp() const
static Opcode negateComparisonOp(Opcode Opc)
bool isMultiplicativeOp() const
SourceLocation getExprLoc() const
static Opcode reverseComparisonOp(Opcode Opc)
static bool isShiftAssignOp(Opcode Opc)
bool isFPContractableWithinStatement(const LangOptions &LO) const
Get the FP contractability status of this operator.
static unsigned sizeOfTrailingObjects(bool HasFPFeatures)
Return the size in bytes needed for the trailing objects.
bool isEqualityOp() const
BinaryOperator(StmtClass SC, EmptyShell Empty)
Construct an empty BinaryOperator, SC is CompoundAssignOperator.
static BinaryOperator * CreateEmpty(const ASTContext &C, bool hasFPFeatures)
FPOptionsOverride getStoredFPFeatures() const
Get FPFeatures from trailing storage.
static bool classof(const Stmt *S)
bool isAdditiveOp() const
static bool isAdditiveOp(Opcode Opc)
static bool isPtrMemOp(Opcode Opc)
predicates to categorize the respective opcodes.
static bool isAssignmentOp(Opcode Opc)
static bool isCompoundAssignmentOp(Opcode Opc)
bool isShiftAssignOp() const
SourceLocation getEndLoc() const LLVM_READONLY
FPOptions getFPFeaturesInEffect(const LangOptions &LO) const
Get the FP features status of this operator.
static bool isNullPointerArithmeticExtension(ASTContext &Ctx, Opcode Opc, const Expr *LHS, const Expr *RHS)
Return true if a binary operator using the specified opcode and operands would match the 'p = (i8*)nu...
void setStoredFPFeatures(FPOptionsOverride F)
Set FPFeatures in trailing storage, used only by Serialization.
FPOptionsOverride getFPFeatures() const
bool isAssignmentOp() const
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO)
Retrieve the binary opcode that corresponds to the given overloaded operator.
size_t offsetOfTrailingStorage() const
static bool isEqualityOp(Opcode Opc)
void setOpcode(Opcode Opc)
static bool isBitwiseOp(Opcode Opc)
static bool isMultiplicativeOp(Opcode Opc)
BinaryOperatorKind Opcode
Represents a block literal declaration, which is like an unnamed FunctionDecl.
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
BlockExpr(EmptyShell Empty)
Build an empty block expression.
SourceLocation getCaretLocation() const
SourceLocation getBeginLoc() const LLVM_READONLY
BlockDecl * getBlockDecl()
const Stmt * getBody() const
const_child_range children() const
SourceLocation getEndLoc() const LLVM_READONLY
void setBlockDecl(BlockDecl *BD)
static bool classof(const Stmt *T)
const FunctionProtoType * getFunctionType() const
getFunctionType - Return the underlying function type for this block.
BlockExpr(BlockDecl *BD, QualType ty)
const BlockDecl * getBlockDecl() const
This class is used for builtin types like 'int'.
static bool isPlaceholderTypeKind(Kind K)
Determines whether the given kind corresponds to a placeholder type.
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
SourceLocation getRParenLoc() const
static CStyleCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize, bool HasFPFeatures)
SourceLocation getBeginLoc() const LLVM_READONLY
void setRParenLoc(SourceLocation L)
static bool classof(const Stmt *T)
SourceLocation getLParenLoc() const
SourceLocation getEndLoc() const LLVM_READONLY
void setLParenLoc(SourceLocation L)
Represents a base class of a C++ class.
Represents a C++ struct/union/class.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
bool hasStoredFPFeatures() const
const FPOptionsOverride * getTrailingFPFeatures() const
static unsigned sizeOfTrailingObjects(unsigned NumPreArgs, unsigned NumArgs, bool HasFPFeatures)
Return the size in bytes needed for the trailing objects.
static constexpr ADLCallKind NotADL
const Stmt * getPreArg(unsigned I) const
void setRParenLoc(SourceLocation L)
const_arg_iterator arg_begin() const
static bool classof(const Stmt *T)
llvm::iterator_range< const_arg_iterator > const_arg_range
const Expr *const * getArgs() const
void setArg(unsigned Arg, Expr *ArgExpr)
setArg - Set the specified argument.
ConstExprIterator const_arg_iterator
ExprIterator arg_iterator
void setADLCallKind(ADLCallKind V=UsesADL)
SourceLocation getBeginLoc() const LLVM_READONLY
llvm::iterator_range< arg_iterator > arg_range
const_arg_range arguments() const
unsigned getBuiltinCallee() const
getBuiltinCallee - If this is a call to a builtin, return the builtin ID of the callee.
FPOptionsOverride getStoredFPFeatures() const
Get FPOptionsOverride from trailing storage.
FunctionDecl * getDirectCallee()
If the callee is a FunctionDecl, return it. Otherwise return null.
static CallExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, bool HasFPFeatures, EmptyShell Empty)
Create an empty call expression, for deserialization.
bool isCallToStdMove() const
SourceLocation getEndLoc() const LLVM_READONLY
void setPreArg(unsigned I, Stmt *PreArg)
ADLCallKind getADLCallKind() const
FPOptionsOverride getFPFeatures() const
void markDependentForPostponedNameLookup()
Used by Sema to implement MSVC-compatible delayed name lookup.
const Expr * getCallee() const
ArrayRef< Stmt * > getRawSubExprs()
This method provides fast access to all the subexpressions of a CallExpr without going through the sl...
const Decl * getCalleeDecl() const
void computeDependence()
Compute and set dependence bits.
void setStoredFPFeatures(FPOptionsOverride F)
Set FPOptionsOverride in trailing storage. Used only by Serialization.
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
FPOptions getFPFeaturesInEffect(const LangOptions &LO) const
Get the FP features status of this operator.
Expr ** getArgs()
Retrieve the call arguments.
const_child_range children() const
SourceLocation getRParenLoc() const
static constexpr ADLCallKind UsesADL
static CallExpr * CreateTemporary(void *Mem, Expr *Fn, QualType Ty, ExprValueKind VK, SourceLocation RParenLoc, ADLCallKind UsesADL=NotADL)
Create a temporary call expression with no arguments in the memory pointed to by Mem.
bool isBuiltinAssumeFalse(const ASTContext &Ctx) const
Return true if this is a call to __assume() or __builtin_assume() with a non-value-dependent constant...
const_arg_iterator arg_end() const
const FunctionDecl * getDirectCallee() const
Stmt * getPreArg(unsigned I)
FPOptionsOverride * getTrailingFPFeatures()
Return a pointer to the trailing FPOptions.
QualType getCallReturnType(const ASTContext &Ctx) const
getCallReturnType - Get the return type of the call expr.
const Attr * getUnusedResultAttr(const ASTContext &Ctx) const
Returns the WarnUnusedResultAttr that is either declared on the called function, or its return type d...
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...
void setNumArgsUnsafe(unsigned NewNumArgs)
Bluntly set a new number of arguments without doing any checks whatsoever.
unsigned getNumPreArgs() const
bool hasUnusedResultAttr(const ASTContext &Ctx) const
Returns true if this call expression should warn on unused results.
void shrinkNumArgs(unsigned NewNumArgs)
Reduce the number of arguments in this call expression.
const Expr * getArg(unsigned Arg) const
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
FPOptionsOverride * getTrailingFPFeatures()
Return a pointer to the trailing FPOptions.
path_iterator path_begin()
unsigned path_size() const
NamedDecl * getConversionFunction() const
If this cast applies a user-defined conversion, retrieve the conversion function that it invokes.
const Expr * getSubExprAsWritten() const
Expr * getSubExprAsWritten()
Retrieve the cast subexpression as it was written in the source code, looking through any implicit ca...
CastKind getCastKind() const
void setCastKind(CastKind K)
llvm::iterator_range< path_iterator > path()
Path through the class hierarchy taken by casts between base and derived classes (see implementation ...
const FieldDecl * getTargetUnionField() const
CastExpr(StmtClass SC, EmptyShell Empty, unsigned BasePathSize, bool HasFPFeatures)
Construct an empty cast.
static bool classof(const Stmt *T)
llvm::iterator_range< path_const_iterator > path() const
bool hasStoredFPFeatures() const
bool changesVolatileQualification() const
Return.
static const FieldDecl * getTargetFieldForToUnionCast(QualType unionType, QualType opType)
FPOptionsOverride getStoredFPFeatures() const
Get FPOptionsOverride from trailing storage.
CastExpr(StmtClass SC, QualType ty, ExprValueKind VK, const CastKind kind, Expr *op, unsigned BasePathSize, bool HasFPFeatures)
const Expr * getSubExpr() const
const_child_range children() const
const FPOptionsOverride * getTrailingFPFeatures() const
CXXBaseSpecifier ** path_iterator
path_const_iterator path_end() const
const char * getCastKindName() const
path_const_iterator path_begin() const
const CXXBaseSpecifier *const * path_const_iterator
FPOptionsOverride getFPFeatures() const
FPOptions getFPFeaturesInEffect(const LangOptions &LO) const
Get the FP features status of this operation.
void setValue(unsigned Val)
SourceLocation getLocation() const
SourceLocation getEndLoc() const LLVM_READONLY
void setLocation(SourceLocation Location)
static bool classof(const Stmt *T)
static void print(unsigned val, CharacterLiteralKind Kind, raw_ostream &OS)
unsigned getValue() const
void setKind(CharacterLiteralKind kind)
const_child_range children() const
CharacterLiteralKind getKind() const
CharacterLiteral(EmptyShell Empty)
Construct an empty character literal.
SourceLocation getBeginLoc() const LLVM_READONLY
CharacterLiteral(unsigned value, CharacterLiteralKind kind, QualType type, SourceLocation l)
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
void setRParenLoc(SourceLocation L)
void setIsConditionTrue(bool isTrue)
SourceLocation getBuiltinLoc() const
Expr * getChosenSubExpr() const
getChosenSubExpr - Return the subexpression chosen according to the condition.
bool isConditionDependent() const
void setBuiltinLoc(SourceLocation L)
bool isConditionTrue() const
isConditionTrue - Return whether the condition is true (i.e.
ChooseExpr(SourceLocation BLoc, Expr *cond, Expr *lhs, Expr *rhs, QualType t, ExprValueKind VK, ExprObjectKind OK, SourceLocation RP, bool condIsTrue)
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getRParenLoc() const
ChooseExpr(EmptyShell Empty)
Build an empty __builtin_choose_expr.
const_child_range children() const
SourceLocation getBeginLoc() const LLVM_READONLY
static bool classof(const Stmt *T)
CompoundAssignOperator - For compound assignments (e.g.
void setComputationResultType(QualType T)
static CompoundAssignOperator * CreateEmpty(const ASTContext &C, bool hasFPFeatures)
CompoundAssignOperator(const ASTContext &C, Expr *lhs, Expr *rhs, Opcode opc, QualType ResType, ExprValueKind VK, ExprObjectKind OK, SourceLocation OpLoc, FPOptionsOverride FPFeatures, QualType CompLHSType, QualType CompResultType)
QualType getComputationLHSType() const
void setComputationLHSType(QualType T)
static bool classof(const Stmt *S)
QualType getComputationResultType() const
CompoundLiteralExpr - [C99 6.5.2.5].
void setFileScope(bool FS)
const_child_range children() const
void setTypeSourceInfo(TypeSourceInfo *tinfo)
SourceLocation getLParenLoc() const
SourceLocation getBeginLoc() const LLVM_READONLY
CompoundLiteralExpr(EmptyShell Empty)
Construct an empty compound literal.
void setLParenLoc(SourceLocation L)
SourceLocation getEndLoc() const LLVM_READONLY
static bool classof(const Stmt *T)
const Expr * getInitializer() const
TypeSourceInfo * getTypeSourceInfo() const
void setInitializer(Expr *E)
CompoundLiteralExpr(SourceLocation lparenloc, TypeSourceInfo *tinfo, QualType T, ExprValueKind VK, Expr *init, bool fileScope)
CompoundStmt - This represents a group of statements like { stmt stmt }.
ConditionalOperator - The ?: ternary operator.
const_child_range children() const
Expr * getFalseExpr() const
getFalseExpr - Return the subexpression representing the value of the expression if the condition eva...
static bool classof(const Stmt *T)
ConditionalOperator(Expr *cond, SourceLocation QLoc, Expr *lhs, SourceLocation CLoc, Expr *rhs, QualType t, ExprValueKind VK, ExprObjectKind OK)
SourceLocation getBeginLoc() const LLVM_READONLY
Expr * getCond() const
getCond - Return the expression representing the condition for the ?: operator.
Expr * getTrueExpr() const
getTrueExpr - Return the subexpression representing the value of the expression if the condition eval...
SourceLocation getEndLoc() const LLVM_READONLY
ConditionalOperator(EmptyShell Empty)
Build an empty conditional operator.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
APValue getAPValueResult() const
static ConstantResultStorageKind getStorageKind(const APValue &Value)
void MoveIntoResult(APValue &Value, const ASTContext &Context)
llvm::APSInt getResultAsAPSInt() const
SourceLocation getBeginLoc() const LLVM_READONLY
ConstantResultStorageKind getResultStorageKind() const
void SetResult(APValue Value, const ASTContext &Context)
APValue::ValueKind getResultAPValueKind() const
static bool classof(const Stmt *T)
bool hasAPValueResult() const
const_child_range children() const
bool isImmediateInvocation() const
SourceLocation getEndLoc() const LLVM_READONLY
static ConstantExpr * CreateEmpty(const ASTContext &Context, ConstantResultStorageKind StorageKind)
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
SourceLocation getRParenLoc() const
getRParenLoc - Return the location of final right parenthesis.
const_child_range children() const
ConvertVectorExpr(Expr *SrcExpr, TypeSourceInfo *TI, QualType DstType, ExprValueKind VK, ExprObjectKind OK, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
static bool classof(const Stmt *T)
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getBuiltinLoc() const
getBuiltinLoc - Return the location of the __builtin_convertvector token.
TypeSourceInfo * getTypeSourceInfo() const
getTypeSourceInfo - Return the destination type.
void setTypeSourceInfo(TypeSourceInfo *ti)
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
A POD class for pairing a NamedDecl* with an access specifier.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
A reference to a declared variable, function, enum, etc.
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
NamedDecl * getFoundDecl()
Get the NamedDecl through which this reference occurred.
bool hasExplicitTemplateArgs() const
Determines whether this declaration reference was followed by an explicit template argument list.
void setIsImmediateEscalating(bool Set)
const_child_range children() const
bool refersToEnclosingVariableOrCapture() const
Does this DeclRefExpr refer to an enclosing local or a captured variable?
void setDecl(ValueDecl *NewD)
bool hasTemplateKWAndArgsInfo() const
const NamedDecl * getFoundDecl() const
Get the NamedDecl through which this reference occurred.
static DeclRefExpr * CreateEmpty(const ASTContext &Context, bool HasQualifier, bool HasFoundDecl, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Construct an empty declaration reference expression.
void setLocation(SourceLocation L)
void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const
Copies the template arguments (if present) into the given structure.
SourceLocation getBeginLoc() const LLVM_READONLY
DeclarationNameInfo getNameInfo() const
void setHadMultipleCandidates(bool V=true)
Sets the flag telling whether this expression refers to a function that was resolved from an overload...
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
bool isCapturedByCopyInLambdaWithExplicitObjectParameter() const
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
bool hasQualifier() const
Determine whether this declaration reference was preceded by a C++ nested-name-specifier,...
NestedNameSpecifierLoc getQualifierLoc() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name,...
const ValueDecl * getDecl() const
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
ArrayRef< TemplateArgumentLoc > template_arguments() const
static bool classof(const Stmt *T)
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why?
SourceLocation getEndLoc() const LLVM_READONLY
bool hadMultipleCandidates() const
Returns true if this expression refers to a function that was resolved from an overloaded set having ...
void setCapturedByCopyInLambdaWithExplicitObjectParameter(bool Set, const ASTContext &Context)
bool hasTemplateKeyword() const
Determines whether the name in this declaration reference was preceded by the template keyword.
SourceLocation getLocation() const
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
NestedNameSpecifier * getQualifier() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name.
bool isImmediateEscalating() const
Decl - This represents one declaration (or definition), e.g.
AccessSpecifier getAccess() const
DeclarationNameLoc - Additional source/type location info for a declaration name.
Represents a single C99 designator.
unsigned getArrayIndex() const
SourceRange getSourceRange() const LLVM_READONLY
bool isFieldDesignator() const
SourceLocation getBeginLoc() const LLVM_READONLY
static Designator CreateArrayRangeDesignator(unsigned Index, SourceLocation LBracketLoc, SourceLocation EllipsisLoc, SourceLocation RBracketLoc)
Creates a GNU array-range designator.
struct FieldDesignatorInfo FieldInfo
A field designator, e.g., ".x".
static Designator CreateFieldDesignator(const IdentifierInfo *FieldName, SourceLocation DotLoc, SourceLocation FieldLoc)
Creates a field designator.
struct ArrayOrRangeDesignatorInfo ArrayOrRangeInfo
An array or GNU array-range designator, e.g., "[9]" or "[10..15]".
bool isArrayRangeDesignator() const
void setFieldDecl(FieldDecl *FD)
static Designator CreateArrayDesignator(unsigned Index, SourceLocation LBracketLoc, SourceLocation RBracketLoc)
Creates an array designator.
FieldDecl * getFieldDecl() const
bool isArrayDesignator() const
SourceLocation getFieldLoc() const
SourceLocation getRBracketLoc() const
SourceLocation getEndLoc() const LLVM_READONLY
const IdentifierInfo * getFieldName() const
SourceLocation getEllipsisLoc() const
SourceLocation getDotLoc() const
SourceLocation getLBracketLoc() const
Represents a C99 designated initializer expression.
bool isDirectInit() const
Whether this designated initializer should result in direct-initialization of the designated subobjec...
static DesignatedInitExpr * CreateEmpty(const ASTContext &C, unsigned NumIndexExprs)
Expr * getArrayRangeEnd(const Designator &D) const
const_child_range children() const
const Designator * getDesignator(unsigned Idx) const
Expr * getSubExpr(unsigned Idx) const
SourceRange getDesignatorsSourceRange() const
llvm::MutableArrayRef< Designator > designators()
void setSubExpr(unsigned Idx, Expr *E)
bool usesGNUSyntax() const
Determines whether this designated initializer used the deprecated GNU syntax for designated initiali...
Expr * getArrayRangeStart(const Designator &D) const
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).
void setGNUSyntax(bool GNU)
void setEqualOrColonLoc(SourceLocation L)
Expr * getArrayIndex(const Designator &D) const
Designator * getDesignator(unsigned Idx)
Expr * getInit() const
Retrieve the initializer value.
unsigned size() const
Returns the number of designators in this initializer.
SourceLocation getBeginLoc() const LLVM_READONLY
void setDesignators(const ASTContext &C, const Designator *Desigs, unsigned NumDesigs)
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getEqualOrColonLoc() const
Retrieve the location of the '=' that precedes the initializer value itself, if present.
unsigned getNumSubExprs() const
Retrieve the total number of subexpressions in this designated initializer expression,...
static bool classof(const Stmt *T)
llvm::ArrayRef< Designator > designators() const
SourceLocation getBeginLoc() const LLVM_READONLY
DesignatedInitUpdateExpr(EmptyShell Empty)
static bool classof(const Stmt *T)
SourceLocation getEndLoc() const LLVM_READONLY
const_child_range children() const
void setUpdater(Expr *Updater)
InitListExpr * getUpdater() const
Designator - A designator in a C99 designated initializer.
An instance of this object exists for each enum constant that is defined.
ExplicitCastExpr - An explicit cast written in the source code.
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to.
ExplicitCastExpr(StmtClass SC, QualType exprTy, ExprValueKind VK, CastKind kind, Expr *op, unsigned PathSize, bool HasFPFeatures, TypeSourceInfo *writtenTy)
void setTypeInfoAsWritten(TypeSourceInfo *writtenTy)
static bool classof(const Stmt *T)
ExplicitCastExpr(StmtClass SC, EmptyShell Shell, unsigned PathSize, bool HasFPFeatures)
Construct an empty explicit cast.
QualType getTypeAsWritten() const
getTypeAsWritten - Returns the type that this expression is casting to, as written in the source code...
The return type of classify().
ModifiableType
The results of modification testing.
ModifiableType getModifiable() const
Kinds
The various classification results. Most of these mean prvalue.
@ CL_SubObjCPropertySetting
@ CL_DuplicateVectorComponents
static Classification makeSimpleLValue()
Create a simple, modifiably lvalue.
bool isModifiable() const
This represents one expression.
@ LV_DuplicateVectorComponents
@ LV_InvalidMessageExpression
@ LV_SubObjCPropertySetting
Classification ClassifyModifiable(ASTContext &Ctx, SourceLocation &Loc) const
ClassifyModifiable - Classify this expression according to the C++11 expression taxonomy,...
Expr(StmtClass SC, QualType T, ExprValueKind VK, ExprObjectKind OK)
Expr(StmtClass SC, EmptyShell)
Construct an empty expression.
bool EvaluateAsInt(EvalResult &Result, const ASTContext &Ctx, SideEffectsKind AllowSideEffects=SE_NoSideEffects, bool InConstantContext=false) const
EvaluateAsInt - Return true if this is a constant which we can fold and convert to an integer,...
EnumConstantDecl * getEnumConstantDecl()
If this expression refers to an enum constant, retrieve its declaration.
static bool isPotentialConstantExpr(const FunctionDecl *FD, SmallVectorImpl< PartialDiagnosticAt > &Diags)
isPotentialConstantExpr - Return true if this function's definition might be usable in a constant exp...
bool isReadIfDiscardedInCPlusPlus11() const
Determine whether an lvalue-to-rvalue conversion should implicitly be applied to this expression if i...
static bool isPotentialConstantExprUnevaluated(Expr *E, const FunctionDecl *FD, SmallVectorImpl< PartialDiagnosticAt > &Diags)
isPotentialConstantExprUnevaluated - Return true if this expression might be usable in a constant exp...
Expr * IgnoreParenNoopCasts(const ASTContext &Ctx) LLVM_READONLY
Skip past any parentheses and casts which do not change the value (including ptr->int casts of the sa...
isModifiableLvalueResult isModifiableLvalue(ASTContext &Ctx, SourceLocation *Loc=nullptr) const
isModifiableLvalue - C99 6.3.2.1: an lvalue that does not have array type, does not have an incomplet...
@ SE_AllowSideEffects
Allow any unmodeled side effect.
@ SE_NoSideEffects
Strictly evaluate the expression.
@ SE_AllowUndefinedBehavior
Allow UB that we can give a value, but not arbitrary unmodeled side effects.
static bool classof(const Stmt *T)
static QualType findBoundMemberType(const Expr *expr)
Given an expression of bound-member type, find the type of the member.
Expr & operator=(const Expr &)=delete
bool EvaluateCharRangeAsString(std::string &Result, const Expr *SizeExpression, const Expr *PtrExpression, ASTContext &Ctx, EvalResult &Status) const
bool isImplicitCXXThis() const
Whether this expression is an implicit reference to 'this' in C++.
const Expr * IgnoreParenNoopCasts(const ASTContext &Ctx) const
llvm::APSInt EvaluateKnownConstIntCheckOverflow(const ASTContext &Ctx, SmallVectorImpl< PartialDiagnosticAt > *Diag=nullptr) const
Expr * IgnoreParenCasts() LLVM_READONLY
Skip past any parentheses and casts which might surround this expression until reaching a fixed point...
bool isUnusedResultAWarning(const Expr *&WarnExpr, SourceLocation &Loc, SourceRange &R1, SourceRange &R2, ASTContext &Ctx) const
isUnusedResultAWarning - Return true if this immediate expression should be warned about if the resul...
LValueClassification ClassifyLValue(ASTContext &Ctx) const
Reasons why an expression might not be an l-value.
bool isValueDependent() const
Determines whether the value of this expression depends on.
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
bool refersToVectorElement() const
Returns whether this expression refers to a vector element.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
bool containsUnexpandedParameterPack() const
Whether this expression contains an unexpanded parameter pack (for C++11 variadic templates).
bool tryEvaluateStrLen(uint64_t &Result, ASTContext &Ctx) const
If the current Expr is a pointer, this will try to statically determine the strlen of the string poin...
llvm::APSInt EvaluateKnownConstInt(const ASTContext &Ctx, SmallVectorImpl< PartialDiagnosticAt > *Diag=nullptr) const
EvaluateKnownConstInt - Call EvaluateAsRValue and return the folded integer.
Expr * IgnoreParenLValueCasts() LLVM_READONLY
Skip past any parentheses and lvalue casts which might surround this expression until reaching a fixe...
FPOptions getFPFeaturesInEffect(const LangOptions &LO) const
Returns the set of floating point options that apply to this expression.
const CXXRecordDecl * getBestDynamicClassType() const
For an expression of class type or pointer to class type, return the most derived class decl the expr...
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
Expr * IgnoreImplicit() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
Expr * IgnoreConversionOperatorSingleStep() LLVM_READONLY
Skip conversion operators.
bool containsErrors() const
Whether this expression contains subexpressions which had errors, e.g.
bool EvaluateAsFloat(llvm::APFloat &Result, const ASTContext &Ctx, SideEffectsKind AllowSideEffects=SE_NoSideEffects, bool InConstantContext=false) const
EvaluateAsFloat - Return true if this is a constant which we can fold and convert to a floating point...
bool isObjCSelfExpr() const
Check if this expression is the ObjC 'self' implicit parameter.
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point.
bool hasPlaceholderType(BuiltinType::Kind K) const
Returns whether this expression has a specific placeholder type.
bool EvaluateAsLValue(EvalResult &Result, const ASTContext &Ctx, bool InConstantContext=false) const
EvaluateAsLValue - Evaluate an expression to see if we can fold it to an lvalue with link time known ...
bool EvaluateAsFixedPoint(EvalResult &Result, const ASTContext &Ctx, SideEffectsKind AllowSideEffects=SE_NoSideEffects, bool InConstantContext=false) const
EvaluateAsFixedPoint - Return true if this is a constant which we can fold and convert to a fixed poi...
bool isEvaluatable(const ASTContext &Ctx, SideEffectsKind AllowSideEffects=SE_NoSideEffects) const
isEvaluatable - Call EvaluateAsRValue to see if this expression can be constant folded without side-e...
Expr * IgnoreParenBaseCasts() LLVM_READONLY
Skip past any parentheses and derived-to-base casts until reaching a fixed point.
bool isLValue() const
isLValue - True if this expression is an "l-value" according to the rules of the current language.
static bool hasAnyTypeDependentArguments(ArrayRef< Expr * > Exprs)
hasAnyTypeDependentArguments - Determines if any of the expressions in Exprs is type-dependent.
FieldDecl * getSourceBitField()
If this expression refers to a bit-field, retrieve the declaration of that bit-field.
NullPointerConstantValueDependence
Enumeration used to describe how isNullPointerConstant() should cope with value-dependent expressions...
@ NPC_ValueDependentIsNull
Specifies that a value-dependent expression of integral or dependent type should be considered a null...
@ NPC_NeverValueDependent
Specifies that the expression should never be value-dependent.
@ NPC_ValueDependentIsNotNull
Specifies that a value-dependent expression should be considered to never be a null pointer constant.
Expr * IgnoreUnlessSpelledInSource()
Skip past any invisible AST nodes which might surround this statement, such as ExprWithCleanups or Im...
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
bool EvaluateAsRValue(EvalResult &Result, const ASTContext &Ctx, bool InConstantContext=false) const
EvaluateAsRValue - Return true if this is a constant which we can fold to an rvalue using any crazy t...
Expr * IgnoreCasts() LLVM_READONLY
Skip past any casts which might surround this expression until reaching a fixed point.
Decl * getReferencedDeclOfCallee()
Expr * IgnoreImplicitAsWritten() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
bool HasSideEffects(const ASTContext &Ctx, bool IncludePossibleEffects=true) const
HasSideEffects - This routine returns true for all those expressions which have any effect other than...
bool EvaluateAsConstantExpr(EvalResult &Result, const ASTContext &Ctx, ConstantExprKind Kind=ConstantExprKind::Normal) const
Evaluate an expression that is required to be a constant expression.
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on.
const Expr * getBestDynamicClassTypeExpr() const
Get the inner expression that determines the best dynamic class.
const Expr * IgnoreUnlessSpelledInSource() const
bool isIntegerConstantExpr(const ASTContext &Ctx, SourceLocation *Loc=nullptr) const
Expr * IgnoreImpCasts() LLVM_READONLY
Skip past any implicit casts which might surround this expression until reaching a fixed point.
NullPointerConstantKind
Enumeration used to describe the kind of Null pointer constant returned from isNullPointerConstant().
@ NPCK_ZeroExpression
Expression is a Null pointer constant built from a zero integer expression that is not a simple,...
@ NPCK_ZeroLiteral
Expression is a Null pointer constant built from a literal zero.
@ NPCK_CXX11_nullptr
Expression is a C++11 nullptr.
@ NPCK_GNUNull
Expression is a GNU-style __null constant.
@ NPCK_NotNull
Expression is not a Null pointer constant.
bool EvaluateAsBooleanCondition(bool &Result, const ASTContext &Ctx, bool InConstantContext=false) const
EvaluateAsBooleanCondition - Return true if this is a constant which we can fold and convert to a boo...
bool isTemporaryObject(ASTContext &Ctx, const CXXRecordDecl *TempTy) const
Determine whether the result of this expression is a temporary object of the given class type.
NullPointerConstantKind isNullPointerConstant(ASTContext &Ctx, NullPointerConstantValueDependence NPC) const
isNullPointerConstant - C99 6.3.2.3p3 - Test if this reduces down to a Null pointer constant.
QualType getEnumCoercedType(const ASTContext &Ctx) const
If this expression is an enumeration constant, return the enumeration type under which said constant ...
bool isBoundMemberFunction(ASTContext &Ctx) const
Returns true if this expression is a bound member function.
bool isConstantInitializer(ASTContext &Ctx, bool ForRef, const Expr **Culprit=nullptr) const
isConstantInitializer - Returns true if this expression can be emitted to IR as a constant,...
@ ClassTemplateArgument
A class template argument. Such a value is used for code generation.
@ Normal
An integer constant expression (an array bound, enumerator, case value, bit-field width,...
@ ImmediateInvocation
An immediate invocation.
@ NonClassTemplateArgument
A non-class template argument.
void setValueKind(ExprValueKind Cat)
setValueKind - Set the value kind produced by this expression.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
const FieldDecl * getSourceBitField() const
static bool isSameComparisonOperand(const Expr *E1, const Expr *E2)
Checks that the two Expr's will refer to the same value as a comparison operand.
void setObjectKind(ExprObjectKind Cat)
setObjectKind - Set the object kind produced by this expression.
std::optional< llvm::APSInt > getIntegerConstantExpr(const ASTContext &Ctx, SourceLocation *Loc=nullptr) const
isIntegerConstantExpr - Return the value if this expression is a valid integer constant expression.
bool refersToMatrixElement() const
Returns whether this expression refers to a matrix element.
bool refersToBitField() const
Returns true if this expression is a gl-value that potentially refers to a bit-field.
bool isDefaultArgument() const
Determine whether this expression is a default function argument.
bool isFlexibleArrayMemberLike(ASTContext &Context, LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel, bool IgnoreTemplateOrMacroSubstitution=false) const
Check whether this array fits the idiom of a flexible array member, depending on the value of -fstric...
@ MLV_DuplicateVectorComponents
@ MLV_InvalidMessageExpression
@ MLV_ConstQualifiedField
@ MLV_SubObjCPropertySetting
Classification Classify(ASTContext &Ctx) const
Classify - Classify this expression according to the C++11 expression taxonomy.
const Decl * getReferencedDeclOfCallee() const
bool hasNonTrivialCall(const ASTContext &Ctx) const
Determine whether this expression involves a call to any function that is not trivial.
bool isOrdinaryOrBitFieldObject() const
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
bool refersToGlobalRegisterVar() const
Returns whether this expression refers to a global register variable.
bool tryEvaluateObjectSize(uint64_t &Result, ASTContext &Ctx, unsigned Type) const
If the current Expr is a pointer, this will try to statically determine the number of bytes available...
bool isCXX98IntegralConstantExpr(const ASTContext &Ctx) const
isCXX98IntegralConstantExpr - Return true if this expression is an integral constant expression in C+...
const ValueDecl * getAsBuiltinConstantDeclRef(const ASTContext &Context) const
If this expression is an unambiguous reference to a single declaration, in the style of __builtin_fun...
bool isOBJCGCCandidate(ASTContext &Ctx) const
isOBJCGCCandidate - Return true if this expression may be used in a read/ write barrier.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
bool EvaluateWithSubstitution(APValue &Value, ASTContext &Ctx, const FunctionDecl *Callee, ArrayRef< const Expr * > Args, const Expr *This=nullptr) const
EvaluateWithSubstitution - Evaluate an expression as if from the context of a call to the given funct...
bool EvaluateAsInitializer(APValue &Result, const ASTContext &Ctx, const VarDecl *VD, SmallVectorImpl< PartialDiagnosticAt > &Notes, bool IsConstantInitializer) const
EvaluateAsInitializer - Evaluate an expression as if it were the initializer of the given declaration...
const Expr * skipRValueSubobjectAdjustments() const
bool isKnownToHaveBooleanValue(bool Semantic=true) const
isKnownToHaveBooleanValue - Return true if this is an integer expression that is known to return 0 or...
void setDependence(ExprDependence Deps)
Each concrete expr subclass is expected to compute its dependence and call this in the constructor.
Expr(const Expr &)=delete
void EvaluateForOverflow(const ASTContext &Ctx) const
ExprDependence getDependence() const
bool isCXX11ConstantExpr(const ASTContext &Ctx, APValue *Result=nullptr, SourceLocation *Loc=nullptr) const
isCXX11ConstantExpr - Return true if this expression is a constant expression in C++11.
Expr & operator=(Expr &&)=delete
const EnumConstantDecl * getEnumConstantDecl() const
const ObjCPropertyRefExpr * getObjCProperty() const
If this expression is an l-value for an Objective C property, find the underlying property reference ...
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
ExtVectorElementExpr(EmptyShell Empty)
Build an empty vector element expression.
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getEndLoc() const LLVM_READONLY
bool containsDuplicateElements() const
containsDuplicateElements - Return true if any element access is repeated.
void setAccessor(IdentifierInfo *II)
bool isArrow() const
isArrow - Return true if the base expression is a pointer to vector, return false if the base express...
SourceLocation getAccessorLoc() const
void getEncodedElementAccess(SmallVectorImpl< uint32_t > &Elts) const
getEncodedElementAccess - Encode the elements accessed into an llvm aggregate Constant of ConstantInt...
const Expr * getBase() const
static bool classof(const Stmt *T)
void setAccessorLoc(SourceLocation L)
unsigned getNumElements() const
getNumElements - Get the number of components being selected.
ExtVectorElementExpr(QualType ty, ExprValueKind VK, Expr *base, IdentifierInfo &accessor, SourceLocation loc)
IdentifierInfo & getAccessor() const
const_child_range children() const
Represents difference between two FPOptions values.
FPOptions applyOverrides(FPOptions Base)
bool requiresTrailingStorage() const
static FPOptions defaultWithoutTrailingStorage(const LangOptions &LO)
Return the default value of FPOptions that's used when trailing storage isn't required.
bool allowFPContractWithinStatement() const
Represents a member of a struct/union/class.
SourceLocation getLocation() const
Retrieve the location of the literal.
std::string getValueAsString(unsigned Radix) const
unsigned getScale() const
SourceLocation getBeginLoc() const LLVM_READONLY
const_child_range children() const
void setLocation(SourceLocation Location)
static bool classof(const Stmt *T)
void setScale(unsigned S)
static FixedPointLiteral * CreateFromRawInt(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l, unsigned Scale)
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getLocation() const
llvm::APFloatBase::Semantics getRawSemantics() const
Get a raw enumeration value representing the floating-point semantics of this literal (32-bit IEEE,...
const llvm::fltSemantics & getSemantics() const
Return the APFloat semantics this literal uses.
void setValue(const ASTContext &C, const llvm::APFloat &Val)
const_child_range children() const
SourceLocation getBeginLoc() const LLVM_READONLY
void setRawSemantics(llvm::APFloatBase::Semantics Sem)
Set the raw enumeration value representing the floating-point semantics of this literal (32-bit IEEE,...
double getValueAsApproximateDouble() const
getValueAsApproximateDouble - This returns the value as an inaccurate double.
llvm::APFloat getValue() const
static bool classof(const Stmt *T)
void setLocation(SourceLocation L)
SourceLocation getEndLoc() const LLVM_READONLY
void setSemantics(const llvm::fltSemantics &Sem)
Set the APFloat semantics this literal uses.
FullExpr - Represents a "full-expression" node.
FullExpr(StmtClass SC, EmptyShell Empty)
void setSubExpr(Expr *E)
As with any mutator of the AST, be very careful when modifying an existing AST to preserve its invari...
static bool classof(const Stmt *T)
FullExpr(StmtClass SC, Expr *subexpr)
const Expr * getSubExpr() const
Represents a function declaration or definition.
Represents a prototype with parameter type info, e.g.
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
SourceLocation getTokenLocation() const
getTokenLocation - The location of the __null token.
static bool classof(const Stmt *T)
SourceLocation getBeginLoc() const LLVM_READONLY
const_child_range children() const
GNUNullExpr(QualType Ty, SourceLocation Loc)
SourceLocation getEndLoc() const LLVM_READONLY
GNUNullExpr(EmptyShell Empty)
Build an empty GNU __null expression.
void setTokenLocation(SourceLocation L)
Represents a C11 generic selection.
llvm::iterator_range< ConstAssociationIterator > const_association_range
SourceLocation getBeginLoc() const
AssociationTy< false > Association
TypeSourceInfo * getControllingType()
Return the controlling type of this generic selection expression.
static bool classof(const Stmt *T)
const Expr * getControllingExpr() const
unsigned getNumAssocs() const
The number of association expressions.
const_association_range associations() const
AssociationIteratorTy< true > ConstAssociationIterator
SourceLocation getEndLoc() const
ArrayRef< Expr * > getAssocExprs() const
bool isExprPredicate() const
Whether this generic selection uses an expression as its controlling argument.
ConstAssociation getAssociation(unsigned I) const
association_range associations()
AssociationTy< true > ConstAssociation
SourceLocation getGenericLoc() const
SourceLocation getRParenLoc() const
unsigned getResultIndex() const
The zero-based index of the result expression's generic association in the generic selection's associ...
Expr * getResultExpr()
Return the result expression of this controlling expression.
AssociationIteratorTy< false > AssociationIterator
SourceLocation getDefaultLoc() const
llvm::iterator_range< AssociationIterator > association_range
const Expr * getResultExpr() const
bool isResultDependent() const
Whether this generic selection is result-dependent.
const_child_range children() const
Association getAssociation(unsigned I)
Return the Ith association expression with its TypeSourceInfo, bundled together in GenericSelectionEx...
bool isTypePredicate() const
Whether this generic selection uses a type as its controlling argument.
const TypeSourceInfo * getControllingType() const
static GenericSelectionExpr * CreateEmpty(const ASTContext &Context, unsigned NumAssocs)
Create an empty generic selection expression for deserialization.
Expr * getControllingExpr()
Return the controlling expression of this generic selection expression.
ArrayRef< TypeSourceInfo * > getAssocTypeSourceInfos() const
One of these records is kept for each identifier that is lexed.
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
SourceLocation getEndLoc() const LLVM_READONLY
ImaginaryLiteral(Expr *val, QualType Ty)
const Expr * getSubExpr() const
SourceLocation getBeginLoc() const LLVM_READONLY
ImaginaryLiteral(EmptyShell Empty)
Build an empty imaginary literal.
static bool classof(const Stmt *T)
const_child_range children() const
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
static ImplicitCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize, bool HasFPFeatures)
ImplicitCastExpr(OnStack_t _, QualType ty, CastKind kind, Expr *op, ExprValueKind VK, FPOptionsOverride FPO)
bool isPartOfExplicitCast() const
static bool classof(const Stmt *T)
void setIsPartOfExplicitCast(bool PartOfExplicitCast)
Represents an implicitly-generated value initialization of an object of a given type.
SourceLocation getEndLoc() const LLVM_READONLY
static bool classof(const Stmt *T)
ImplicitValueInitExpr(EmptyShell Empty)
Construct an empty implicit value initialization.
const_child_range children() const
ImplicitValueInitExpr(QualType ty)
SourceLocation getBeginLoc() const LLVM_READONLY
Describes an C or C++ initializer list.
const_reverse_iterator rend() const
bool hasArrayFiller() const
Return true if this is an array initializer and its array "filler" has been set.
void setSyntacticForm(InitListExpr *Init)
InitExprsTy::reverse_iterator reverse_iterator
InitExprsTy::const_reverse_iterator const_reverse_iterator
void markError()
Mark the semantic form of the InitListExpr as error when the semantic analysis fails.
bool hasDesignatedInit() const
Determine whether this initializer list contains a designated initializer.
bool isTransparent() const
Is this a transparent initializer list (that is, an InitListExpr that is purely syntactic,...
void resizeInits(const ASTContext &Context, unsigned NumInits)
Specify the number of initializers.
bool isStringLiteralInit() const
Is this an initializer for an array of characters, initialized by a string literal or an @encode?
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
unsigned getNumInits() const
SourceLocation getBeginLoc() const LLVM_READONLY
bool isSemanticForm() const
void setInit(unsigned Init, Expr *expr)
const_iterator begin() const
reverse_iterator rbegin()
const_reverse_iterator rbegin() const
InitExprsTy::const_iterator const_iterator
Expr *const * getInits() const
Retrieve the set of initializers.
SourceLocation getLBraceLoc() const
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...
void setArrayFiller(Expr *filler)
InitListExpr * getSyntacticForm() const
static bool classof(const Stmt *T)
bool hadArrayRangeDesignator() const
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
SourceLocation getRBraceLoc() const
InitListExpr * getSemanticForm() const
const FieldDecl * getInitializedFieldInUnion() const
const Expr * getInit(unsigned Init) const
InitListExpr(EmptyShell Empty)
Build an empty initializer list.
void setLBraceLoc(SourceLocation Loc)
const Expr * getArrayFiller() const
const_child_range children() const
bool isIdiomaticZeroInitializer(const LangOptions &LangOpts) const
Is this the zero initializer {0} in a language which considers it idiomatic?
const_iterator end() const
SourceLocation getEndLoc() const LLVM_READONLY
void setInitializedFieldInUnion(FieldDecl *FD)
bool isSyntacticForm() const
ArrayRef< Expr * > inits()
void setRBraceLoc(SourceLocation Loc)
ArrayRef< Expr * > inits() const
InitExprsTy::iterator iterator
void sawArrayRangeDesignator(bool ARD=true)
Expr ** getInits()
Retrieve the set of initializers.
Expr * getInit(unsigned Init)
void reserveInits(const ASTContext &C, unsigned NumInits)
Reserve space for some number of initializers.
void setLocation(SourceLocation Location)
SourceLocation getEndLoc() const LLVM_READONLY
static bool classof(const Stmt *T)
SourceLocation getLocation() const
Retrieve the location of the literal.
const_child_range children() const
SourceLocation getBeginLoc() const LLVM_READONLY
Represents the declaration of a label.
StrictFlexArraysLevelKind
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
void setColumnIdx(Expr *E)
SourceLocation getEndLoc() const
const Expr * getBase() const
const_child_range children() const
SourceLocation getRBracketLoc() const
SourceLocation getExprLoc() const LLVM_READONLY
MatrixSubscriptExpr(Expr *Base, Expr *RowIdx, Expr *ColumnIdx, QualType T, SourceLocation RBracketLoc)
const Expr * getRowIdx() const
bool isIncomplete() const
MatrixSubscriptExpr(EmptyShell Shell)
Create an empty matrix subscript expression.
static bool classof(const Stmt *T)
const Expr * getColumnIdx() const
void setRBracketLoc(SourceLocation L)
SourceLocation getBeginLoc() const LLVM_READONLY
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
static MemberExpr * CreateEmpty(const ASTContext &Context, bool HasQualifier, bool HasFoundDecl, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
ArrayRef< TemplateArgumentLoc > template_arguments() const
void setMemberDecl(ValueDecl *D)
SourceLocation getMemberLoc() const
getMemberLoc - Return the location of the "member", in X->F, it is the location of 'F'.
void setMemberLoc(SourceLocation L)
void setHadMultipleCandidates(bool V=true)
Sets the flag telling whether this expression refers to a method that was resolved from an overloaded...
SourceLocation getOperatorLoc() const
static bool classof(const Stmt *T)
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding the member name, if any.
NestedNameSpecifierLoc getQualifierLoc() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name,...
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
const_child_range children() const
bool hasExplicitTemplateArgs() const
Determines whether the member name was followed by an explicit template argument list.
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why? This is only meaningful if the named memb...
bool hasQualifier() const
Determines whether this member expression actually had a C++ nested-name-specifier prior to the name ...
void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const
Copies the template arguments (if present) into the given structure.
bool isImplicitAccess() const
Determine whether the base of this explicit is implicit.
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
bool performsVirtualDispatch(const LangOptions &LO) const
Returns true if virtual dispatch is performed.
unsigned getNumTemplateArgs() const
Retrieve the number of 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...
SourceLocation getEndLoc() const LLVM_READONLY
static MemberExpr * CreateImplicit(const ASTContext &C, Expr *Base, bool IsArrow, ValueDecl *MemberDecl, QualType T, ExprValueKind VK, ExprObjectKind OK)
Create an implicit MemberExpr, with no location, qualifier, template arguments, and so on.
NestedNameSpecifier * getQualifier() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name.
bool hadMultipleCandidates() const
Returns true if this member expression refers to a method that was resolved from an overloaded set ha...
bool hasTemplateKeyword() const
Determines whether the member name was preceded by the template keyword.
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
DeclarationNameInfo getMemberNameInfo() const
Retrieve the member declaration name info.
SourceLocation getExprLoc() const LLVM_READONLY
DeclAccessPair getFoundDecl() const
Retrieves the declaration found by lookup.
A pointer to member type per C++ 8.3.3 - Pointers to members.
This represents a decl that may have a name.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
A C++ nested-name-specifier augmented with source location information.
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
Represents a place-holder for an object not to be initialized by anything.
static bool classof(const Stmt *T)
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
NoInitExpr(EmptyShell Empty)
const_child_range children() const
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type,...
const Expr * getIndexExpr(unsigned Idx) const
SourceLocation getBeginLoc() const LLVM_READONLY
void setOperatorLoc(SourceLocation L)
static OffsetOfExpr * CreateEmpty(const ASTContext &C, unsigned NumComps, unsigned NumExprs)
Expr * getIndexExpr(unsigned Idx)
SourceLocation getEndLoc() const LLVM_READONLY
static bool classof(const Stmt *T)
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
const OffsetOfNode & getComponent(unsigned Idx) const
void setIndexExpr(unsigned Idx, Expr *E)
TypeSourceInfo * getTypeSourceInfo() const
void setTypeSourceInfo(TypeSourceInfo *tsi)
const_child_range children() const
void setComponent(unsigned Idx, OffsetOfNode ON)
unsigned getNumExpressions() const
SourceLocation getRParenLoc() const
Return the location of the right parentheses.
void setRParenLoc(SourceLocation R)
unsigned getNumComponents() const
Helper class for OffsetOfExpr.
OffsetOfNode(SourceLocation DotLoc, IdentifierInfo *Name, SourceLocation NameLoc)
Create an offsetof node that refers to an identifier.
unsigned getArrayExprIndex() const
For an array element node, returns the index into the array of expressions.
FieldDecl * getField() const
For a field offsetof node, returns the field.
OffsetOfNode(const CXXBaseSpecifier *Base)
Create an offsetof node that refers into a C++ base class.
OffsetOfNode(SourceLocation LBracketLoc, unsigned Index, SourceLocation RBracketLoc)
Create an offsetof node that refers to an array element.
IdentifierInfo * getFieldName() const
For a field or identifier offsetof node, returns the name of the field.
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range that covers this offsetof node.
Kind
The kind of offsetof node we have.
@ Array
An index into an array.
@ Identifier
A field in a dependent type, known only by its name.
SourceLocation getBeginLoc() const LLVM_READONLY
Kind getKind() const
Determine what kind of offsetof node this is.
OffsetOfNode(SourceLocation DotLoc, FieldDecl *Field, SourceLocation NameLoc)
Create an offsetof node that refers to a field.
SourceLocation getEndLoc() const LLVM_READONLY
CXXBaseSpecifier * getBase() const
For a base class node, returns the base specifier.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
static const OpaqueValueExpr * findInCopyConstruct(const Expr *expr)
Given an expression which invokes a copy constructor — i.e.
OpaqueValueExpr(EmptyShell Empty)
OpaqueValueExpr(SourceLocation Loc, QualType T, ExprValueKind VK, ExprObjectKind OK=OK_Ordinary, Expr *SourceExpr=nullptr)
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getEndLoc() const LLVM_READONLY
static bool classof(const Stmt *T)
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
SourceLocation getLocation() const
Retrieve the location of this expression.
const_child_range children() const
SourceLocation getExprLoc() const LLVM_READONLY
ParenExpr - This represents a parethesized expression, e.g.
ParenExpr(SourceLocation l, SourceLocation r, Expr *val)
SourceLocation getLParen() const
Get the location of the left parentheses '('.
static bool classof(const Stmt *T)
ParenExpr(EmptyShell Empty)
Construct an empty parenthesized expression.
void setLParen(SourceLocation Loc)
const_child_range children() const
void setRParen(SourceLocation Loc)
SourceLocation getBeginLoc() const LLVM_READONLY
const Expr * getSubExpr() const
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
SourceLocation getEndLoc() const LLVM_READONLY
static ParenListExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumExprs)
Create an empty paren list.
ArrayRef< Expr * > exprs()
SourceLocation getBeginLoc() const
Expr * getExpr(unsigned Init)
const Expr * getExpr(unsigned Init) const
const_child_range children() const
SourceLocation getEndLoc() const
unsigned getNumExprs() const
Return the number of expressions in this paren list.
SourceLocation getLParenLoc() const
SourceLocation getRParenLoc() const
static bool classof(const Stmt *T)
[C99 6.4.2.2] - A predefined identifier such as func.
SourceLocation getBeginLoc() const
void setLocation(SourceLocation L)
static bool classof(const Stmt *T)
SourceLocation getEndLoc() const
const StringLiteral * getFunctionName() const
StringRef getIdentKindName() const
static PredefinedExpr * CreateEmpty(const ASTContext &Ctx, bool HasFunctionName)
Create an empty PredefinedExpr.
bool isTransparent() const
static std::string ComputeName(PredefinedIdentKind IK, const Decl *CurrentDecl, bool ForceElaboratedPrinting=false)
const_child_range children() const
PredefinedIdentKind getIdentKind() const
SourceLocation getLocation() const
StringLiteral * getFunctionName()
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
const Expr * getResultExpr() const
const_semantics_iterator semantics_begin() const
semantics_iterator semantics_end()
SourceLocation getExprLoc() const LLVM_READONLY
unsigned getResultExprIndex() const
Return the index of the result-bearing expression into the semantics expressions, or PseudoObjectExpr...
semantics_iterator semantics_begin()
const Expr *const * const_semantics_iterator
SourceLocation getBeginLoc() const LLVM_READONLY
Expr *const * semantics_iterator
const_semantics_iterator semantics_end() const
const Expr * getSyntacticForm() const
static bool classof(const Stmt *T)
const Expr * getSemanticExpr(unsigned index) const
Expr * getResultExpr()
Return the result-bearing expression, or null if there is none.
ArrayRef< Expr * > semantics()
ArrayRef< const Expr * > semantics() const
unsigned getNumSemanticExprs() const
Expr * getSemanticExpr(unsigned index)
Expr * getSyntacticForm()
Return the syntactic form of this expression, i.e.
SourceLocation getEndLoc() const LLVM_READONLY
const_child_range children() const
A (possibly-)qualified type.
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Represents a struct/union/class.
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
ArrayRef< const Expr * > subExpressions() const
ArrayRef< Expr * > subExpressions()
SourceLocation getEndLoc() const
static bool classof(const Stmt *T)
SourceLocation getBeginLoc() const
static RecoveryExpr * CreateEmpty(ASTContext &Ctx, unsigned NumSubExprs)
Base for LValueReferenceType and RValueReferenceType.
static bool classof(const Stmt *T)
const_child_range children() const
SourceLocation getLocation() const
const TypeSourceInfo * getTypeSourceInfo() const
SourceLocation getLParenLocation() const
TypeSourceInfo * getTypeSourceInfo()
std::string ComputeName(ASTContext &Context) const
SourceLocation getBeginLoc() const
SourceLocation getRParenLocation() const
SourceLocation getEndLoc() const
static SYCLUniqueStableNameExpr * CreateEmpty(const ASTContext &Ctx)
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
ShuffleVectorExpr(EmptyShell Empty)
Build an empty vector-shuffle expression.
void setExprs(const ASTContext &C, ArrayRef< Expr * > Exprs)
llvm::APSInt getShuffleMaskIdx(const ASTContext &Ctx, unsigned N) const
Expr ** getSubExprs()
Retrieve the array of expressions.
const_child_range children() const
SourceLocation getBuiltinLoc() const
SourceLocation getEndLoc() const LLVM_READONLY
void setRParenLoc(SourceLocation L)
const Expr * getExpr(unsigned Index) const
unsigned getNumSubExprs() const
getNumSubExprs - Return the size of the SubExprs array.
static bool classof(const Stmt *T)
SourceLocation getRParenLoc() const
SourceLocation getBeginLoc() const LLVM_READONLY
Expr * getExpr(unsigned Index)
getExpr - Return the Expr at the specified index.
void setBuiltinLoc(SourceLocation L)
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
SourceLocExpr(EmptyShell Empty)
Build an empty call expression.
SourceLocation getBeginLoc() const
APValue EvaluateInContext(const ASTContext &Ctx, const Expr *DefaultExpr) const
Return the result of evaluating this SourceLocExpr in the specified (and possibly null) default argum...
static bool classof(const Stmt *T)
SourceLocation getLocation() const
const DeclContext * getParentContext() const
If the SourceLocExpr has been resolved return the subexpression representing the resolved value.
SourceLocation getEndLoc() const
DeclContext * getParentContext()
StringRef getBuiltinStr() const
Return a string representing the name of the specific builtin function.
const_child_range children() const
static bool MayBeDependent(SourceLocIdentKind Kind)
SourceLocIdentKind getIdentKind() const
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
This class handles loading and caching of source files into memory.
A trivial tuple used to represent a source range.
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
const CompoundStmt * getSubStmt() const
void setRParenLoc(SourceLocation L)
const_child_range children() const
CompoundStmt * getSubStmt()
static bool classof(const Stmt *T)
StmtExpr(CompoundStmt *SubStmt, QualType T, SourceLocation LParenLoc, SourceLocation RParenLoc, unsigned TemplateDepth)
StmtExpr(EmptyShell Empty)
Build an empty statement expression.
void setLParenLoc(SourceLocation L)
SourceLocation getEndLoc() const LLVM_READONLY
unsigned getTemplateDepth() const
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getRParenLoc() const
void setSubStmt(CompoundStmt *S)
SourceLocation getLParenLoc() const
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
UnaryExprOrTypeTraitExprBitfields UnaryExprOrTypeTraitExprBits
GenericSelectionExprBitfields GenericSelectionExprBits
InitListExprBitfields InitListExprBits
ParenListExprBitfields ParenListExprBits
ArrayOrMatrixSubscriptExprBitfields ArrayOrMatrixSubscriptExprBits
StmtIterator child_iterator
Child Iterators: All subclasses must implement 'children' to permit easy iteration over the substatem...
CallExprBitfields CallExprBits
FloatingLiteralBitfields FloatingLiteralBits
child_iterator child_begin()
CharacterLiteralBitfields CharacterLiteralBits
UnaryOperatorBitfields UnaryOperatorBits
SourceLocExprBitfields SourceLocExprBits
ConstantExprBitfields ConstantExprBits
llvm::iterator_range< child_iterator > child_range
StmtExprBitfields StmtExprBits
StringLiteralBitfields StringLiteralBits
OpaqueValueExprBitfields OpaqueValueExprBits
CastExprBitfields CastExprBits
MemberExprBitfields MemberExprBits
DeclRefExprBitfields DeclRefExprBits
ConstStmtIterator const_child_iterator
PredefinedExprBitfields PredefinedExprBits
SourceLocation getBeginLoc() const LLVM_READONLY
BinaryOperatorBitfields BinaryOperatorBits
PseudoObjectExprBitfields PseudoObjectExprBits
llvm::iterator_range< const_child_iterator > const_child_range
StringLiteral - This represents a string literal expression, e.g.
const_child_range children() const
SourceLocation getStrTokenLoc(unsigned TokNum) const
Get one of the string literal token.
SourceLocation getBeginLoc() const LLVM_READONLY
bool containsNonAscii() const
bool containsNonAsciiOrNull() const
unsigned getLength() const
static bool classof(const Stmt *T)
tokloc_iterator tokloc_begin() const
tokloc_iterator tokloc_end() const
StringLiteralKind getKind() const
SourceLocation getLocationOfByte(unsigned ByteNo, const SourceManager &SM, const LangOptions &Features, const TargetInfo &Target, unsigned *StartToken=nullptr, unsigned *StartTokenByteOffset=nullptr) const
getLocationOfByte - Return a source location that points to the specified byte of this string literal...
StringRef getBytes() const
Allow access to clients that need the byte representation, such as ASTWriterStmt::VisitStringLiteral(...
uint32_t getCodeUnit(size_t i) const
bool isUnevaluated() const
void outputString(raw_ostream &OS) const
int64_t getCodeUnitS(size_t I, uint64_t BitWidth) const
unsigned getByteLength() const
StringRef getString() const
static StringLiteral * CreateEmpty(const ASTContext &Ctx, unsigned NumConcatenated, unsigned Length, unsigned CharByteWidth)
Construct an empty string literal.
SourceLocation getEndLoc() const LLVM_READONLY
static StringLiteral * Create(const ASTContext &Ctx, StringRef Str, StringLiteralKind Kind, bool Pascal, QualType Ty, SourceLocation Loc)
Simple constructor for string literals made from one token.
const SourceLocation * tokloc_iterator
unsigned getNumConcatenated() const
getNumConcatenated - Get the number of string literal tokens that were concatenated in translation ph...
unsigned getCharByteWidth() const
Exposes information about the current target.
A convenient class for passing around template argument information.
Location wrapper for a TemplateArgument.
A container of type source information.
QualType getType() const
Return the type wrapped by this type source info.
The base class of the type hierarchy.
bool isPlaceholderType() const
Test for a type which does not represent an actual type-system type but is instead used as a placehol...
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
bool isReferenceType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
const T * getAs() const
Member-template getAs<specific type>'.
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
SourceLocation getEndLoc() const LLVM_READONLY
const_child_range children() const
static bool classof(const Stmt *T)
SourceLocation getBeginLoc() const LLVM_READONLY
TypoExpr(QualType T, SourceLocation TypoLoc)
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
SourceLocation getRParenLoc() const
SourceLocation getEndLoc() const LLVM_READONLY
void setKind(UnaryExprOrTypeTrait K)
QualType getArgumentType() const
void setOperatorLoc(SourceLocation L)
SourceLocation getOperatorLoc() const
const Expr * getArgumentExpr() const
SourceLocation getBeginLoc() const LLVM_READONLY
void setRParenLoc(SourceLocation L)
static bool classof(const Stmt *T)
QualType getTypeOfArgument() const
Gets the argument type, or the type of the argument expression, whichever is appropriate.
bool isArgumentType() const
void setArgument(Expr *E)
UnaryExprOrTypeTraitExpr(UnaryExprOrTypeTrait ExprKind, TypeSourceInfo *TInfo, QualType resultType, SourceLocation op, SourceLocation rp)
TypeSourceInfo * getArgumentTypeInfo() const
UnaryExprOrTypeTraitExpr(EmptyShell Empty)
Construct an empty sizeof/alignof expression.
UnaryExprOrTypeTrait getKind() const
void setArgument(TypeSourceInfo *TInfo)
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
static bool classof(const Stmt *T)
static bool isPostfix(Opcode Op)
isPostfix - Return true if this is a postfix operation, like x++.
bool isDecrementOp() const
SourceLocation getExprLoc() const
bool isFEnvAccessOn(const LangOptions &LO) const
Get the FENV_ACCESS status of this operator.
void setOperatorLoc(SourceLocation L)
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Expr * getSubExpr() const
SourceLocation getEndLoc() const LLVM_READONLY
bool isArithmeticOp() const
void setCanOverflow(bool C)
UnaryOperator(bool HasFPFeatures, EmptyShell Empty)
Build an empty unary operator.
bool hasStoredFPFeatures() const
Is FPFeatures in Trailing Storage?
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given unary opcode.
void setOpcode(Opcode Opc)
static bool isIncrementOp(Opcode Op)
static bool isIncrementDecrementOp(Opcode Op)
SourceLocation getBeginLoc() const LLVM_READONLY
static bool isDecrementOp(Opcode Op)
FPOptionsOverride getStoredFPFeatures() const
Get FPFeatures from trailing storage.
bool isFPContractableWithinStatement(const LangOptions &LO) const
Get the FP contractability status of this operator.
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO, bool Postfix)
Retrieve the unary opcode that corresponds to the given overloaded operator.
FPOptions getFPFeaturesInEffect(const LangOptions &LO) const
Get the FP features status of this operator.
void setStoredFPFeatures(FPOptionsOverride F)
Set FPFeatures in trailing storage, used by Serialization & ASTImporter.
FPOptionsOverride getFPOptionsOverride() const
static UnaryOperator * CreateEmpty(const ASTContext &C, bool hasFPFeatures)
static bool isPrefix(Opcode Op)
isPrefix - Return true if this is a prefix operation, like –x.
static StringRef getOpcodeStr(Opcode Op)
getOpcodeStr - Turn an Opcode enum value into the punctuation char it corresponds to,...
static bool isArithmeticOp(Opcode Op)
bool isIncrementDecrementOp() const
bool isIncrementOp() const
const_child_range children() const
bool canOverflow() const
Returns true if the unary operator can cause an overflow.
Represents a call to the builtin function __builtin_va_arg.
VAArgExpr(SourceLocation BLoc, Expr *e, TypeSourceInfo *TInfo, SourceLocation RPLoc, QualType t, bool IsMS)
void setRParenLoc(SourceLocation L)
TypeSourceInfo * getWrittenTypeInfo() const
SourceLocation getBuiltinLoc() const
SourceLocation getRParenLoc() const
VAArgExpr(EmptyShell Empty)
Create an empty __builtin_va_arg expression.
bool isMicrosoftABI() const
Returns whether this is really a Win64 ABI va_arg expression.
void setIsMicrosoftABI(bool IsMS)
static bool classof(const Stmt *T)
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getEndLoc() const LLVM_READONLY
void setBuiltinLoc(SourceLocation L)
void setWrittenTypeInfo(TypeSourceInfo *TI)
const_child_range children() const
const Expr * getSubExpr() const
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a statement that could possibly have a value and type.
Represents a variable declaration or definition.
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
bool Const(InterpState &S, CodePtr OpPC, const T &Arg)
The JSON file list parser is used to communicate input to InstallAPI.
LLVM_READNONE bool isASCII(char c)
Returns true if a byte is an ASCII character.
@ Create
'copyin' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
ConstantResultStorageKind
Describes the kind of result that can be tail-allocated.
StmtIterator cast_away_const(const ConstStmtIterator &RHS)
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
@ OK_VectorComponent
A vector component is an element or range of elements on a vector.
@ OK_Ordinary
An ordinary object is located at an address in memory.
@ OK_BitField
A bitfield object is a bitfield on a C or C++ record.
@ OK_MatrixComponent
A matrix component is a single element of a matrix.
ExprDependence computeDependence(FullExpr *E)
bool operator==(const CallGraphNode::CallRecord &LHS, const CallGraphNode::CallRecord &RHS)
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
@ Result
The result type of a method or function.
CastKind
CastKind - The kind of operation required for a conversion.
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_XValue
An x-value expression is a reference to an object with independent storage but which can be "moved",...
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
const FunctionProtoType * T
SmallVector< CXXBaseSpecifier *, 4 > CXXCastPath
A simple array of base specifiers.
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs.
@ None
The alignment was not explicit in code.
@ Other
Other implicit parameter.
@ PrettyFunctionNoVirtual
The same as PrettyFunction, except that the 'virtual' keyword is omitted for virtual member functions...
NonOdrUseReason
The reason why a DeclRefExpr does not constitute an odr-use.
@ NOUR_None
This is an odr-use.
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
Copy initialization expr of a __block variable and a boolean flag that indicates whether the expressi...
BlockVarCopyInit(Expr *CopyExpr, bool CanThrow)
Expr * getCopyExpr() const
BlockVarCopyInit()=default
llvm::PointerIntPair< Expr *, 1, bool > ExprAndFlag
void setExprAndFlag(Expr *CopyExpr, bool CanThrow)
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
EvalResult is a struct with detailed info about an evaluated expression.
APValue Val
Val - This is the value the expression can be folded to.
bool isGlobalLValue() const
EvalStatus is a struct with detailed info about an evaluation in progress.
bool hasSideEffects() const
SmallVectorImpl< PartialDiagnosticAt > * Diag
Diag - If this is non-null, it will be filled in with a stack of notes indicating why evaluation fail...
bool HasUndefinedBehavior
Whether the evaluation hit undefined behavior.
bool HasSideEffects
Whether the evaluated expression has side effects.
Iterator for iterating over Stmt * arrays that contain only T *.
A placeholder type used to construct an empty shell of a type, that will be filled in later (e....
const CastExpr * BasePath
const CXXRecordDecl * DerivedClass
const MemberPointerType * MPT
An adjustment to be made to the temporary created when emitting a reference binding,...
SubobjectAdjustment(const MemberPointerType *MPT, Expr *RHS)
SubobjectAdjustment(const FieldDecl *Field)
SubobjectAdjustment(const CastExpr *BasePath, const CXXRecordDecl *DerivedClass)
@ DerivedToBaseAdjustment
@ MemberPointerAdjustment
enum clang::SubobjectAdjustment::@50 Kind