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;
62typedef SmallVector<CXXBaseSpecifier*, 4>
CXXCastPath;
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;
1027 return T->getStmtClass() >= firstExprConstant &&
1028 T->getStmtClass() <= lastExprConstant;
1034 llvm::detail::ConstantLog2<
alignof(Expr)>::value,
1035 "PointerLikeTypeTraits<Expr*> assumes too much alignment.");
1065 return T->getStmtClass() >= firstFullExprConstant &&
1066 T->getStmtClass() <= lastFullExprConstant;
1077 private llvm::TrailingObjects<ConstantExpr, APValue, uint64_t> {
1078 static_assert(std::is_same<uint64_t, llvm::APInt::WordType>::value,
1079 "ConstantExpr assumes that llvm::APInt::WordType is uint64_t "
1080 "for tail-allocated storage");
1081 friend TrailingObjects;
1085 size_t numTrailingObjects(OverloadToken<APValue>)
const {
1088 size_t numTrailingObjects(OverloadToken<uint64_t>)
const {
1092 uint64_t &Int64Result() {
1094 "invalid accessor");
1095 return *getTrailingObjects<uint64_t>();
1097 const uint64_t &Int64Result()
const {
1098 return const_cast<ConstantExpr *
>(
this)->Int64Result();
1102 "invalid accessor");
1103 return *getTrailingObjects<APValue>();
1105 APValue &APValueResult()
const {
1106 return const_cast<ConstantExpr *
>(
this)->APValueResult();
1110 bool IsImmediateInvocation);
1114 static ConstantExpr *
Create(
const ASTContext &Context, Expr *
E,
1116 static ConstantExpr *
1117 Create(
const ASTContext &Context, Expr *
E,
1119 bool IsImmediateInvocation =
false);
1120 static ConstantExpr *
CreateEmpty(
const ASTContext &Context,
1125 const ASTContext &Context);
1135 return T->getStmtClass() == ConstantExprClass;
1180 :
Expr(OpaqueValueExprClass,
T, VK, OK), SourceExpr(SourceExpr) {
1226 assert((!
V || SourceExpr) &&
1227 "unique OVEs are expected to have source expressions");
1234 return T->getStmtClass() == OpaqueValueExprClass;
1263 private llvm::TrailingObjects<DeclRefExpr, NestedNameSpecifierLoc,
1264 NamedDecl *, ASTTemplateKWAndArgsInfo,
1265 TemplateArgumentLoc> {
1268 friend TrailingObjects;
1277 size_t numTrailingObjects(OverloadToken<NestedNameSpecifierLoc>)
const {
1281 size_t numTrailingObjects(OverloadToken<NamedDecl *>)
const {
1282 return hasFoundDecl();
1285 size_t numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>)
const {
1293 DeclRefExpr(
const ASTContext &Ctx, NestedNameSpecifierLoc QualifierLoc,
1294 SourceLocation TemplateKWLoc, ValueDecl *
D,
1295 bool RefersToEnclosingVariableOrCapture,
1296 const DeclarationNameInfo &NameInfo, NamedDecl *FoundD,
1297 const TemplateArgumentListInfo *TemplateArgs, QualType
T,
1301 explicit DeclRefExpr(EmptyShell
Empty) :
Expr(DeclRefExprClass,
Empty) {}
1304 DeclRefExpr(
const ASTContext &Ctx, ValueDecl *
D,
1305 bool RefersToEnclosingVariableOrCapture, QualType
T,
1307 const DeclarationNameLoc &LocInfo = DeclarationNameLoc(),
1310 static DeclRefExpr *
1311 Create(
const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc,
1312 SourceLocation TemplateKWLoc, ValueDecl *
D,
1313 bool RefersToEnclosingVariableOrCapture, SourceLocation NameLoc,
1315 const TemplateArgumentListInfo *TemplateArgs =
nullptr,
1318 static DeclRefExpr *
1319 Create(
const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc,
1320 SourceLocation TemplateKWLoc, ValueDecl *
D,
1321 bool RefersToEnclosingVariableOrCapture,
1322 const DeclarationNameInfo &NameInfo, QualType
T,
ExprValueKind VK,
1323 NamedDecl *FoundD =
nullptr,
1324 const TemplateArgumentListInfo *TemplateArgs =
nullptr,
1328 static DeclRefExpr *
CreateEmpty(
const ASTContext &Context,
bool HasQualifier,
1330 bool HasTemplateKWAndArgsInfo,
1331 unsigned NumTemplateArgs);
1355 return *getTrailingObjects<NestedNameSpecifierLoc>();
1371 return hasFoundDecl() ? *getTrailingObjects<NamedDecl *>() :
D;
1377 return hasFoundDecl() ? *getTrailingObjects<NamedDecl *>() :
D;
1389 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->TemplateKWLoc;
1397 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->LAngleLoc;
1405 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->RAngleLoc;
1420 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->copyInto(
1421 getTrailingObjects<TemplateArgumentLoc>(), List);
1429 return getTrailingObjects<TemplateArgumentLoc>();
1437 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->NumTemplateArgs;
1476 return DeclRefExprBits.CapturedByCopyInLambdaWithExplicitObjectParameter;
1486 return T->getStmtClass() == DeclRefExprClass;
1530 return T->getStmtClass() == IntegerLiteralClass;
1548 :
Expr(FixedPointLiteralClass,
Empty) {}
1556 const llvm::APInt &
V,
1575 return T->getStmtClass() == FixedPointLiteralClass;
1624 return T->getStmtClass() == CharacterLiteralClass;
1656 assert(&
getSemantics() == &Val.getSemantics() &&
"Inconsistent semantics");
1663 return static_cast<llvm::APFloatBase::Semantics
>(
1675 return llvm::APFloatBase::EnumToSemantics(
1676 static_cast<llvm::APFloatBase::Semantics
>(
1700 return T->getStmtClass() == FloatingLiteralClass;
1727 :
Expr(ImaginaryLiteralClass,
Empty) { }
1739 return T->getStmtClass() == ImaginaryLiteralClass;
1777 private llvm::TrailingObjects<StringLiteral, unsigned, SourceLocation,
1780 friend TrailingObjects;
1796 unsigned numTrailingObjects(OverloadToken<unsigned>)
const {
return 1; }
1797 unsigned numTrailingObjects(OverloadToken<SourceLocation>)
const {
1801 unsigned numTrailingObjects(OverloadToken<char>)
const {
1805 char *getStrDataAsChar() {
return getTrailingObjects<char>(); }
1806 const char *getStrDataAsChar()
const {
return getTrailingObjects<char>(); }
1808 const uint16_t *getStrDataAsUInt16()
const {
1809 return reinterpret_cast<const uint16_t *
>(getTrailingObjects<char>());
1812 const uint32_t *getStrDataAsUInt32()
const {
1813 return reinterpret_cast<const uint32_t *
>(getTrailingObjects<char>());
1818 bool Pascal, QualType Ty,
const SourceLocation *
Loc,
1819 unsigned NumConcatenated);
1822 StringLiteral(EmptyShell
Empty,
unsigned NumConcatenated,
unsigned Length,
1823 unsigned CharByteWidth);
1826 static unsigned mapCharByteWidth(TargetInfo
const &
Target,
1830 void setStrTokenLoc(
unsigned TokNum, SourceLocation L) {
1832 getTrailingObjects<SourceLocation>()[TokNum] = L;
1838 static StringLiteral *
Create(
const ASTContext &Ctx, StringRef Str,
1840 const SourceLocation *
Loc,
1841 unsigned NumConcatenated);
1852 unsigned NumConcatenated,
unsigned Length,
1853 unsigned CharByteWidth);
1857 "This function is used in places that assume strings use char");
1871 assert(i <
getLength() &&
"out of bounds access");
1874 return static_cast<unsigned char>(getStrDataAsChar()[i]);
1876 return getStrDataAsUInt16()[i];
1878 return getStrDataAsUInt32()[i];
1880 llvm_unreachable(
"Unsupported character width!");
1888 llvm::APInt AInt(Width, (uint64_t)
V);
1889 V = AInt.getSExtValue();
1895 unsigned getLength()
const {
return *getTrailingObjects<unsigned>(); }
1933 return getTrailingObjects<SourceLocation>()[TokNum];
1946 unsigned *StartToken =
nullptr,
1947 unsigned *StartTokenByteOffset =
nullptr)
const;
1952 return getTrailingObjects<SourceLocation>();
1963 return T->getStmtClass() == StringLiteralClass;
1991 private llvm::TrailingObjects<PredefinedExpr, Stmt *> {
1993 friend TrailingObjects;
2008 assert(hasFunctionName() &&
2009 "This PredefinedExpr has no storage for a function name!");
2010 *getTrailingObjects<Stmt *>() = SL;
2018 static PredefinedExpr *
Create(
const ASTContext &Ctx, SourceLocation L,
2020 bool IsTransparent, StringLiteral *SL);
2023 static PredefinedExpr *
CreateEmpty(
const ASTContext &Ctx,
2024 bool HasFunctionName);
2036 return hasFunctionName()
2037 ?
static_cast<StringLiteral *
>(*getTrailingObjects<Stmt *>())
2042 return hasFunctionName()
2043 ?
static_cast<StringLiteral *
>(*getTrailingObjects<Stmt *>())
2053 const Decl *CurrentDecl,
2054 bool ForceElaboratedPrinting =
false);
2060 return T->getStmtClass() == PredefinedExprClass;
2066 getTrailingObjects<Stmt *>() + hasFunctionName());
2071 getTrailingObjects<Stmt *>() + hasFunctionName());
2092 void setLParenLocation(SourceLocation L) { LParen = L; }
2093 void setRParenLocation(SourceLocation L) { RParen = L; }
2113 return T->getStmtClass() == SYCLUniqueStableNameExprClass;
2142 L(l), R(r), Val(val) {
2166 return T->getStmtClass() == ParenExprClass;
2188 private llvm::TrailingObjects<UnaryOperator, FPOptionsOverride> {
2191 size_t numTrailingObjects(OverloadToken<FPOptionsOverride>)
const {
2197 return *getTrailingObjects<FPOptionsOverride>();
2202 return *getTrailingObjects<FPOptionsOverride>();
2263 return Op == UO_PostInc || Op == UO_PostDec;
2268 return Op == UO_PreInc || Op == UO_PreDec;
2275 return Op == UO_PreInc || Op == UO_PostInc;
2282 return Op == UO_PreDec || Op == UO_PostDec;
2294 return Op >= UO_Plus && Op <= UO_LNot;
2319 return T->getStmtClass() == UnaryOperatorClass;
2333 return getTrailingFPFeatures();
2385 enum { MaskBits = 2, Mask = 0x03 };
2409 :
Range(DotLoc.isValid() ? DotLoc : NameLoc, NameLoc),
2415 :
Range(DotLoc.isValid() ? DotLoc : NameLoc, NameLoc),
2475 private llvm::TrailingObjects<OffsetOfExpr, OffsetOfNode, Expr *> {
2484 size_t numTrailingObjects(OverloadToken<OffsetOfNode>)
const {
2493 explicit OffsetOfExpr(
unsigned numComps,
unsigned numExprs)
2495 TSInfo(
nullptr), NumComps(numComps), NumExprs(numExprs) {}
2505 unsigned NumComps,
unsigned NumExprs);
2523 assert(Idx < NumComps &&
"Subscript out of range");
2524 return getTrailingObjects<OffsetOfNode>()[Idx];
2528 assert(Idx < NumComps &&
"Subscript out of range");
2529 getTrailingObjects<OffsetOfNode>()[Idx] = ON;
2537 assert(Idx < NumExprs &&
"Subscript out of range");
2538 return getTrailingObjects<Expr *>()[Idx];
2542 assert(Idx < NumExprs &&
"Subscript out of range");
2543 return getTrailingObjects<Expr *>()[Idx];
2547 assert(Idx < NumComps &&
"Subscript out of range");
2548 getTrailingObjects<Expr *>()[Idx] =
E;
2559 return T->getStmtClass() == OffsetOfExprClass;
2564 Stmt **begin =
reinterpret_cast<Stmt **
>(getTrailingObjects<Expr *>());
2568 Stmt *
const *begin =
2569 reinterpret_cast<Stmt *
const *
>(getTrailingObjects<Expr *>());
2591 OpLoc(op), RParenLoc(rp) {
2592 assert(ExprKind <=
UETT_Last &&
"invalid enum value!");
2594 assert(
static_cast<unsigned>(ExprKind) ==
2596 "UnaryExprOrTypeTraitExprBits.Kind overflow!");
2598 Argument.Ty = TInfo;
2608 :
Expr(UnaryExprOrTypeTraitExprClass,
Empty) { }
2614 assert(K <=
UETT_Last &&
"invalid enum value!");
2617 "UnaryExprOrTypeTraitExprBits.Kind overflow!");
2625 assert(
isArgumentType() &&
"calling getArgumentType() when arg is expr");
2629 assert(!
isArgumentType() &&
"calling getArgumentExpr() when arg is type");
2630 return static_cast<Expr*
>(Argument.Ex);
2641 Argument.Ty = TInfo;
2661 return T->getStmtClass() == UnaryExprOrTypeTraitExprClass;
2675 enum { LHS, RHS, END_EXPR };
2676 Stmt *SubExprs[END_EXPR];
2683 :
Expr(ArraySubscriptExprClass, t, VK, OK) {
2684 SubExprs[LHS] = lhs;
2685 SubExprs[RHS] = rhs;
2692 :
Expr(ArraySubscriptExprClass, Shell) { }
2734 return T->getStmtClass() == ArraySubscriptExprClass;
2739 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
2753 enum { BASE, ROW_IDX, COLUMN_IDX, END_EXPR };
2754 Stmt *SubExprs[END_EXPR];
2761 SubExprs[BASE] =
Base;
2762 SubExprs[ROW_IDX] = RowIdx;
2763 SubExprs[COLUMN_IDX] = ColumnIdx;
2770 :
Expr(MatrixSubscriptExprClass, Shell) {}
2774 assert((SubExprs[COLUMN_IDX] || IsIncomplete) &&
2775 "expressions without column index must be marked as incomplete");
2776 return IsIncomplete;
2789 "cannot get the column index of an incomplete expression");
2790 return cast<Expr>(SubExprs[COLUMN_IDX]);
2812 return T->getStmtClass() == MatrixSubscriptExprClass;
2817 return child_range(&SubExprs[0], &SubExprs[0] + END_EXPR);
2831 enum { FN = 0, PREARGS_START = 1 };
2864 Stmt **getTrailingStmts() {
2865 return reinterpret_cast<Stmt **
>(
reinterpret_cast<char *
>(
this) +
2868 Stmt *
const *getTrailingStmts()
const {
2869 return const_cast<CallExpr *
>(
this)->getTrailingStmts();
2874 static unsigned offsetToTrailingObjects(
StmtClass SC);
2876 unsigned getSizeOfTrailingStmts()
const {
2880 size_t getOffsetOfTrailingFPFeatures()
const {
2882 return CallExprBits.OffsetToTrailingObjects + getSizeOfTrailingStmts();
2905 bool HasFPFeatures) {
2906 return (1 + NumPreArgs + NumArgs) *
sizeof(
Stmt *) +
2911 assert(I <
getNumPreArgs() &&
"Prearg access out of range!");
2912 return getTrailingStmts()[PREARGS_START + I];
2915 assert(I <
getNumPreArgs() &&
"Prearg access out of range!");
2916 return getTrailingStmts()[PREARGS_START + I];
2919 assert(I <
getNumPreArgs() &&
"Prearg access out of range!");
2920 getTrailingStmts()[PREARGS_START + I] = PreArg;
2929 reinterpret_cast<char *
>(
this) +
CallExprBits.OffsetToTrailingObjects +
2930 getSizeOfTrailingStmts());
2935 reinterpret_cast<const char *
>(
this) +
2936 CallExprBits.OffsetToTrailingObjects + getSizeOfTrailingStmts());
2978 bool HasFPFeatures, EmptyShell
Empty);
3012 return reinterpret_cast<Expr **
>(getTrailingStmts() + PREARGS_START +
3016 return reinterpret_cast<const Expr *
const *
>(
3022 assert(Arg <
getNumArgs() &&
"Arg access out of range!");
3026 assert(Arg <
getNumArgs() &&
"Arg access out of range!");
3035 assert(Arg <
getNumArgs() &&
"Arg access out of range!");
3043 reinterpret_cast<Expr **
>(getTrailingStmts() + PREARGS_START),
3055 "shrinkNumArgs cannot increase the number of arguments!");
3056 NumArgs = NewNumArgs;
3075 return getTrailingStmts() + PREARGS_START +
getNumPreArgs();
3080 return getTrailingStmts() + PREARGS_START +
getNumPreArgs();
3164 return T->getStmtClass() >= firstCallExprConstant &&
3165 T->getStmtClass() <= lastCallExprConstant;
3170 return child_range(getTrailingStmts(), getTrailingStmts() + PREARGS_START +
3176 getTrailingStmts() + PREARGS_START +
3185 private llvm::TrailingObjects<MemberExpr, NestedNameSpecifierLoc,
3186 DeclAccessPair, ASTTemplateKWAndArgsInfo,
3187 TemplateArgumentLoc> {
3191 friend TrailingObjects;
3208 size_t numTrailingObjects(OverloadToken<NestedNameSpecifierLoc>)
const {
3212 size_t numTrailingObjects(OverloadToken<DeclAccessPair>)
const {
3213 return hasFoundDecl();
3216 size_t numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>)
const {
3217 return hasTemplateKWAndArgsInfo();
3220 bool hasFoundDecl()
const {
return MemberExprBits.HasFoundDecl; }
3222 bool hasTemplateKWAndArgsInfo()
const {
3226 MemberExpr(
Expr *
Base,
bool IsArrow, SourceLocation OperatorLoc,
3227 NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc,
3228 ValueDecl *MemberDecl, DeclAccessPair FoundDecl,
3229 const DeclarationNameInfo &NameInfo,
3230 const TemplateArgumentListInfo *TemplateArgs, QualType
T,
3232 MemberExpr(EmptyShell
Empty)
3236 static MemberExpr *
Create(
const ASTContext &
C,
Expr *
Base,
bool IsArrow,
3237 SourceLocation OperatorLoc,
3238 NestedNameSpecifierLoc QualifierLoc,
3239 SourceLocation TemplateKWLoc, ValueDecl *MemberDecl,
3240 DeclAccessPair FoundDecl,
3241 DeclarationNameInfo MemberNameInfo,
3242 const TemplateArgumentListInfo *TemplateArgs,
3260 bool HasTemplateKWAndArgsInfo,
3261 unsigned NumTemplateArgs);
3275 if (!hasFoundDecl())
3278 return *getTrailingObjects<DeclAccessPair>();
3292 return *getTrailingObjects<NestedNameSpecifierLoc>();
3305 if (!hasTemplateKWAndArgsInfo())
3307 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->TemplateKWLoc;
3313 if (!hasTemplateKWAndArgsInfo())
3315 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->LAngleLoc;
3321 if (!hasTemplateKWAndArgsInfo())
3323 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->RAngleLoc;
3337 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->copyInto(
3338 getTrailingObjects<TemplateArgumentLoc>(), List);
3347 return getTrailingObjects<TemplateArgumentLoc>();
3356 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->NumTemplateArgs;
3366 MemberLoc, MemberDNLoc);
3416 return T->getStmtClass() == MemberExprClass;
3437 llvm::PointerIntPair<TypeSourceInfo *, 1, bool> TInfoAndScope;
3443 LParenLoc(lparenloc), TInfoAndScope(tinfo, fileScope), Init(init) {
3449 :
Expr(CompoundLiteralExprClass,
Empty) { }
3462 return TInfoAndScope.getPointer();
3465 TInfoAndScope.setPointer(tinfo);
3473 return Init->getBeginLoc();
3480 return Init->getEndLoc();
3484 return T->getStmtClass() == CompoundLiteralExprClass;
3501 bool CastConsistency()
const;
3504 return const_cast<CastExpr*
>(
this)->path_buffer();
3512 Expr *op,
unsigned BasePathSize,
bool HasFPFeatures)
3518 "BasePathSize overflow!");
3519 assert(CastConsistency());
3531 "BasePathSize overflow!");
3585 llvm::iterator_range<path_iterator>
path() {
3588 llvm::iterator_range<path_const_iterator>
path()
const {
3643 return T->getStmtClass() >= firstCastExprConstant &&
3644 T->getStmtClass() <= lastCastExprConstant;
3674 private llvm::TrailingObjects<ImplicitCastExpr, CXXBaseSpecifier *,
3675 FPOptionsOverride> {
3680 :
CastExpr(ImplicitCastExprClass, ty, VK, kind, op, BasePathLength,
3690 :
CastExpr(ImplicitCastExprClass, Shell, PathSize, HasFPFeatures) {}
3692 unsigned numTrailingObjects(OverloadToken<CXXBaseSpecifier *>)
const {
3700 :
CastExpr(ImplicitCastExprClass, ty, VK, kind, op, 0,
3701 FPO.requiresTrailingStorage()) {
3717 unsigned PathSize,
bool HasFPFeatures);
3727 return T->getStmtClass() == ImplicitCastExprClass;
3759 :
CastExpr(SC, exprTy, VK, kind, op, PathSize, HasFPFeatures),
3767 :
CastExpr(SC, Shell, PathSize, HasFPFeatures) {}
3780 return T->getStmtClass() >= firstExplicitCastExprConstant &&
3781 T->getStmtClass() <= lastExplicitCastExprConstant;
3790 private llvm::TrailingObjects<CStyleCastExpr, CXXBaseSpecifier *,
3791 FPOptionsOverride> {
3800 LPLoc(l), RPLoc(r) {
3810 unsigned numTrailingObjects(OverloadToken<CXXBaseSpecifier *>)
const {
3821 unsigned PathSize,
bool HasFPFeatures);
3835 return T->getStmtClass() == CStyleCastExprClass;
3861 enum { LHS, RHS, END_EXPR };
3862 Stmt *SubExprs[END_EXPR];
3938 return Opc == BO_PtrMemD || Opc == BO_PtrMemI;
3943 return Opc >= BO_Mul && Opc <= BO_Rem;
3969 llvm_unreachable(
"Not a comparison operator.");
3970 case BO_LT:
return BO_GE;
3971 case BO_GT:
return BO_LE;
3972 case BO_LE:
return BO_GT;
3973 case BO_GE:
return BO_LT;
3974 case BO_EQ:
return BO_NE;
3975 case BO_NE:
return BO_EQ;
3982 llvm_unreachable(
"Not a comparison operator.");
3983 case BO_LT:
return BO_GT;
3984 case BO_GT:
return BO_LT;
3985 case BO_LE:
return BO_GE;
3986 case BO_GE:
return BO_LE;
3997 return Opc >= BO_Assign && Opc <= BO_OrAssign;
4002 return Opc > BO_Assign && Opc <= BO_OrAssign;
4009 if (Opc >= BO_AndAssign)
4010 return Opcode(
unsigned(Opc) - BO_AndAssign + BO_And);
4012 return Opcode(
unsigned(Opc) - BO_MulAssign + BO_Mul);
4016 return Opc == BO_ShlAssign || Opc == BO_ShrAssign;
4030 return S->getStmtClass() >= firstBinaryOperatorConstant &&
4031 S->getStmtClass() <= lastBinaryOperatorConstant;
4036 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
4136 :
BinaryOperator(
C, lhs, rhs, opc, ResType, VK, OK, OpLoc, FPFeatures,
4138 ComputationLHSType(CompLHSType), ComputationResultType(CompResultType) {
4140 "Only should be used for compound assignments");
4145 bool hasFPFeatures);
4163 return S->getStmtClass() == CompoundAssignOperatorClass;
4183 :
Expr(SC,
T, VK, OK), QuestionLoc(qloc), ColonLoc(cloc) {}
4206 return T->getStmtClass() == ConditionalOperatorClass ||
4207 T->getStmtClass() == BinaryConditionalOperatorClass;
4214 enum { COND, LHS, RHS, END_EXPR };
4215 Stmt* SubExprs[END_EXPR];
4224 SubExprs[COND] = cond;
4225 SubExprs[LHS] = lhs;
4226 SubExprs[RHS] = rhs;