13 #ifndef LLVM_CLANG_AST_EXPR_H
14 #define LLVM_CLANG_AST_EXPR_H
30 #include "llvm/ADT/APFloat.h"
31 #include "llvm/ADT/APSInt.h"
32 #include "llvm/ADT/SmallVector.h"
33 #include "llvm/ADT/StringRef.h"
34 #include "llvm/ADT/iterator.h"
35 #include "llvm/ADT/iterator_range.h"
36 #include "llvm/Support/AtomicOrdering.h"
37 #include "llvm/Support/Compiler.h"
38 #include "llvm/Support/TrailingObjects.h"
45 class CXXBaseSpecifier;
46 class CXXMemberCallExpr;
47 class CXXOperatorCallExpr;
51 class MaterializeTemporaryExpr;
53 class ObjCPropertyRefExpr;
54 class OpaqueValueExpr;
126 assert(
ExprBits.ObjectKind == OK &&
"truncated kind");
136 ExprBits.Dependent =
static_cast<unsigned>(Deps);
151 "Expressions can't have reference type");
216 return static_cast<bool>(
getDependence() & ExprDependence::Instantiation);
234 return static_cast<bool>(
getDependence() & ExprDependence::UnexpandedPack);
360 unsigned short Modifiable;
363 :
Kind(k), Modifiable(m)
371 assert(Modifiable !=
CM_Untested &&
"Did not test for modifiability.");
400 return ClassifyImpl(Ctx,
nullptr);
412 return ClassifyImpl(Ctx, &Loc);
423 return (isa<LValueReferenceType>(RT)
425 : (RT->getPointeeType()->isFunctionType()
511 return BT->getKind() == K;
534 bool IgnoreTemplateOrMacroSubstitution =
false)
const;
543 std::optional<llvm::APSInt>
545 bool isEvaluated =
true)
const;
584 const Expr **Culprit =
nullptr)
const;
639 bool InConstantContext =
false)
const;
646 bool InConstantContext =
false)
const;
659 bool InConstantContext =
false)
const;
666 bool InConstantContext =
false)
const;
672 bool InConstantContext =
false)
const;
687 bool IncludePossibleEffects =
true)
const;
709 bool InConstantContext =
false)
const;
718 bool IsConstantInitializer)
const;
758 unsigned Type)
const;
1005 llvm::detail::ConstantLog2<
alignof(Expr)>::value,
1006 "PointerLikeTypeTraits<Expr*> assumes too much alignment.");
1026 :
Expr(SC, Empty) {}
1045 private llvm::TrailingObjects<ConstantExpr, APValue, uint64_t> {
1046 static_assert(std::is_same<uint64_t, llvm::APInt::WordType>::value,
1047 "ConstantExpr assumes that llvm::APInt::WordType is uint64_t "
1048 "for tail-allocated storage");
1049 friend TrailingObjects;
1058 size_t numTrailingObjects(OverloadToken<APValue>)
const {
1061 size_t numTrailingObjects(OverloadToken<uint64_t>)
const {
1067 "invalid accessor");
1068 return *getTrailingObjects<uint64_t>();
1070 const uint64_t &Int64Result()
const {
1071 return const_cast<ConstantExpr *
>(
this)->Int64Result();
1073 APValue &APValueResult() {
1075 "invalid accessor");
1076 return *getTrailingObjects<APValue>();
1078 APValue &APValueResult()
const {
1079 return const_cast<ConstantExpr *
>(
this)->APValueResult();
1083 bool IsImmediateInvocation);
1087 static ConstantExpr *
Create(
const ASTContext &Context,
Expr *E,
1088 const APValue &Result);
1089 static ConstantExpr *
Create(
const ASTContext &Context,
Expr *E,
1091 bool IsImmediateInvocation =
false);
1092 static ConstantExpr *
CreateEmpty(
const ASTContext &Context,
1097 const ASTContext &Context);
1153 :
Expr(OpaqueValueExprClass, T, VK, OK), SourceExpr(SourceExpr) {
1165 :
Expr(OpaqueValueExprClass, Empty) {}
1199 assert((!
V || SourceExpr) &&
1200 "unique OVEs are expected to have source expressions");
1236 private llvm::TrailingObjects<DeclRefExpr, NestedNameSpecifierLoc,
1237 NamedDecl *, ASTTemplateKWAndArgsInfo,
1238 TemplateArgumentLoc> {
1241 friend TrailingObjects;
1250 size_t numTrailingObjects(OverloadToken<NestedNameSpecifierLoc>)
const {
1254 size_t numTrailingObjects(OverloadToken<NamedDecl *>)
const {
1255 return hasFoundDecl();
1258 size_t numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>)
const {
1266 DeclRefExpr(
const ASTContext &Ctx, NestedNameSpecifierLoc QualifierLoc,
1267 SourceLocation TemplateKWLoc, ValueDecl *D,
1268 bool RefersToEnlosingVariableOrCapture,
1269 const DeclarationNameInfo &NameInfo, NamedDecl *FoundD,
1270 const TemplateArgumentListInfo *TemplateArgs, QualType T,
1274 explicit DeclRefExpr(EmptyShell Empty) :
Expr(DeclRefExprClass, Empty) {}
1277 DeclRefExpr(
const ASTContext &Ctx, ValueDecl *D,
1278 bool RefersToEnclosingVariableOrCapture, QualType T,
1280 const DeclarationNameLoc &LocInfo = DeclarationNameLoc(),
1283 static DeclRefExpr *
1284 Create(
const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc,
1285 SourceLocation TemplateKWLoc, ValueDecl *D,
1286 bool RefersToEnclosingVariableOrCapture, SourceLocation NameLoc,
1288 const TemplateArgumentListInfo *TemplateArgs =
nullptr,
1291 static DeclRefExpr *
1292 Create(
const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc,
1293 SourceLocation TemplateKWLoc, ValueDecl *D,
1294 bool RefersToEnclosingVariableOrCapture,
1295 const DeclarationNameInfo &NameInfo, QualType T,
ExprValueKind VK,
1296 NamedDecl *FoundD =
nullptr,
1297 const TemplateArgumentListInfo *TemplateArgs =
nullptr,
1301 static DeclRefExpr *
CreateEmpty(
const ASTContext &Context,
bool HasQualifier,
1303 bool HasTemplateKWAndArgsInfo,
1304 unsigned NumTemplateArgs);
1328 return *getTrailingObjects<NestedNameSpecifierLoc>();
1344 return hasFoundDecl() ? *getTrailingObjects<NamedDecl *>() : D;
1350 return hasFoundDecl() ? *getTrailingObjects<NamedDecl *>() : D;
1362 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->TemplateKWLoc;
1370 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->LAngleLoc;
1378 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->RAngleLoc;
1393 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->copyInto(
1394 getTrailingObjects<TemplateArgumentLoc>(), List);
1402 return getTrailingObjects<TemplateArgumentLoc>();
1410 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->NumTemplateArgs;
1469 bool hasAllocation()
const {
return llvm::APInt::getNumWords(BitWidth) > 1; }
1478 unsigned NumWords = llvm::APInt::getNumWords(BitWidth);
1510 :
Expr(IntegerLiteralClass, Empty) { }
1554 :
Expr(FixedPointLiteralClass, Empty) {}
1613 Value(value), Loc(l) {
1668 assert(&
getSemantics() == &Val.getSemantics() &&
"Inconsistent semantics");
1675 return static_cast<llvm::APFloatBase::Semantics
>(
1687 return llvm::APFloatBase::EnumToSemantics(
1688 static_cast<llvm::APFloatBase::Semantics
>(
1739 :
Expr(ImaginaryLiteralClass, Empty) { }
1780 private llvm::TrailingObjects<StringLiteral, unsigned, SourceLocation,
1783 friend TrailingObjects;
1803 unsigned numTrailingObjects(OverloadToken<unsigned>)
const {
return 1; }
1804 unsigned numTrailingObjects(OverloadToken<SourceLocation>)
const {
1808 unsigned numTrailingObjects(OverloadToken<char>)
const {
1812 char *getStrDataAsChar() {
return getTrailingObjects<char>(); }
1813 const char *getStrDataAsChar()
const {
return getTrailingObjects<char>(); }
1815 const uint16_t *getStrDataAsUInt16()
const {
1816 return reinterpret_cast<const uint16_t *
>(getTrailingObjects<char>());
1819 const uint32_t *getStrDataAsUInt32()
const {
1820 return reinterpret_cast<const uint32_t *
>(getTrailingObjects<char>());
1824 StringLiteral(
const ASTContext &Ctx, StringRef Str,
StringKind Kind,
1825 bool Pascal, QualType Ty,
const SourceLocation *Loc,
1826 unsigned NumConcatenated);
1829 StringLiteral(EmptyShell Empty,
unsigned NumConcatenated,
unsigned Length,
1830 unsigned CharByteWidth);
1833 static unsigned mapCharByteWidth(TargetInfo
const &Target,
StringKind SK);
1836 void setStrTokenLoc(
unsigned TokNum, SourceLocation L) {
1838 getTrailingObjects<SourceLocation>()[TokNum] = L;
1844 static StringLiteral *
Create(
const ASTContext &Ctx, StringRef Str,
1846 const SourceLocation *Loc,
1847 unsigned NumConcatenated);
1853 return Create(Ctx, Str,
Kind, Pascal, Ty, &Loc, 1);
1858 unsigned NumConcatenated,
unsigned Length,
1859 unsigned CharByteWidth);
1863 "This function is used in places that assume strings use char");
1877 assert(i <
getLength() &&
"out of bounds access");
1880 return static_cast<unsigned char>(getStrDataAsChar()[i]);
1882 return getStrDataAsUInt16()[i];
1884 return getStrDataAsUInt32()[i];
1886 llvm_unreachable(
"Unsupported character width!");
1890 unsigned getLength()
const {
return *getTrailingObjects<unsigned>(); }
1927 return getTrailingObjects<SourceLocation>()[TokNum];
1940 unsigned *StartToken =
nullptr,
1941 unsigned *StartTokenByteOffset =
nullptr)
const;
1946 return getTrailingObjects<SourceLocation>();
1972 private llvm::TrailingObjects<PredefinedExpr, Stmt *> {
1974 friend TrailingObjects;
2003 void setFunctionName(StringLiteral *SL) {
2004 assert(hasFunctionName() &&
2005 "This PredefinedExpr has no storage for a function name!");
2006 *getTrailingObjects<Stmt *>() = SL;
2011 static PredefinedExpr *
Create(
const ASTContext &Ctx, SourceLocation L,
2012 QualType FNTy,
IdentKind IK, StringLiteral *SL);
2015 static PredefinedExpr *
CreateEmpty(
const ASTContext &Ctx,
2016 bool HasFunctionName);
2026 return hasFunctionName()
2027 ?
static_cast<StringLiteral *
>(*getTrailingObjects<Stmt *>())
2032 return hasFunctionName()
2033 ?
static_cast<StringLiteral *
>(*getTrailingObjects<Stmt *>())
2054 getTrailingObjects<Stmt *>() + hasFunctionName());
2059 getTrailingObjects<Stmt *>() + hasFunctionName());
2080 void setLParenLocation(SourceLocation L) { LParen = L; }
2081 void setRParenLocation(SourceLocation L) { RParen = L; }
2101 return T->
getStmtClass() == SYCLUniqueStableNameExprClass;
2130 L(l), R(r), Val(val) {
2136 :
Expr(ParenExprClass, Empty) { }
2176 private llvm::TrailingObjects<UnaryOperator, FPOptionsOverride> {
2179 size_t numTrailingObjects(OverloadToken<FPOptionsOverride>)
const {
2185 return *getTrailingObjects<FPOptionsOverride>();
2190 return *getTrailingObjects<FPOptionsOverride>();
2203 :
Expr(UnaryOperatorClass, Empty) {
2251 return Op == UO_PostInc || Op == UO_PostDec;
2256 return Op == UO_PreInc || Op == UO_PreDec;
2263 return Op == UO_PreInc || Op == UO_PostInc;
2270 return Op == UO_PreDec || Op == UO_PostDec;
2282 return Op >= UO_Plus && Op <= UO_LNot;
2321 return getTrailingFPFeatures();
2367 enum { MaskBits = 2, Mask = 0x03 };
2387 : Range(LBracketLoc, RBracketLoc), Data((Index << 2) |
Array) {}
2391 : Range(DotLoc.isValid() ? DotLoc : NameLoc, NameLoc),
2397 : Range(DotLoc.isValid() ? DotLoc : NameLoc, NameLoc),
2457 private llvm::TrailingObjects<OffsetOfExpr, OffsetOfNode, Expr *> {
2466 size_t numTrailingObjects(OverloadToken<OffsetOfNode>)
const {
2475 explicit OffsetOfExpr(
unsigned numComps,
unsigned numExprs)
2477 TSInfo(
nullptr), NumComps(numComps), NumExprs(numExprs) {}
2487 unsigned NumComps,
unsigned NumExprs);
2505 assert(Idx < NumComps &&
"Subscript out of range");
2506 return getTrailingObjects<OffsetOfNode>()[Idx];
2510 assert(Idx < NumComps &&
"Subscript out of range");
2511 getTrailingObjects<OffsetOfNode>()[Idx] = ON;
2519 assert(Idx < NumExprs &&
"Subscript out of range");
2520 return getTrailingObjects<Expr *>()[Idx];
2524 assert(Idx < NumExprs &&
"Subscript out of range");
2525 return getTrailingObjects<Expr *>()[Idx];
2529 assert(Idx < NumComps &&
"Subscript out of range");
2530 getTrailingObjects<Expr *>()[Idx] = E;
2546 Stmt **begin =
reinterpret_cast<Stmt **
>(getTrailingObjects<Expr *>());
2550 Stmt *
const *begin =
2551 reinterpret_cast<Stmt *
const *
>(getTrailingObjects<Expr *>());
2573 OpLoc(op), RParenLoc(rp) {
2574 assert(ExprKind <=
UETT_Last &&
"invalid enum value!");
2576 assert(
static_cast<unsigned>(ExprKind) ==
2578 "UnaryExprOrTypeTraitExprBits.Kind overflow!");
2580 Argument.Ty = TInfo;
2590 :
Expr(UnaryExprOrTypeTraitExprClass, Empty) { }
2596 assert(K <=
UETT_Last &&
"invalid enum value!");
2599 "UnaryExprOrTypeTraitExprBits.Kind overflow!");
2607 assert(
isArgumentType() &&
"calling getArgumentType() when arg is expr");
2611 assert(!
isArgumentType() &&
"calling getArgumentExpr() when arg is type");
2612 return static_cast<Expr*
>(Argument.Ex);
2623 Argument.Ty = TInfo;
2643 return T->
getStmtClass() == UnaryExprOrTypeTraitExprClass;
2657 enum { LHS, RHS, END_EXPR };
2658 Stmt *SubExprs[END_EXPR];
2665 :
Expr(ArraySubscriptExprClass, t, VK, OK) {
2666 SubExprs[LHS] = lhs;
2667 SubExprs[RHS] = rhs;
2674 :
Expr(ArraySubscriptExprClass, Shell) { }
2721 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
2735 enum { BASE, ROW_IDX, COLUMN_IDX, END_EXPR };
2736 Stmt *SubExprs[END_EXPR];
2743 SubExprs[BASE] =
Base;
2744 SubExprs[ROW_IDX] = RowIdx;
2745 SubExprs[COLUMN_IDX] = ColumnIdx;
2752 :
Expr(MatrixSubscriptExprClass, Shell) {}
2756 assert((SubExprs[COLUMN_IDX] || IsIncomplete) &&
2757 "expressions without column index must be marked as incomplete");
2758 return IsIncomplete;
2771 "cannot get the column index of an incomplete expression");
2772 return cast<Expr>(SubExprs[COLUMN_IDX]);
2799 return child_range(&SubExprs[0], &SubExprs[0] + END_EXPR);
2813 enum { FN = 0, PREARGS_START = 1 };
2846 Stmt **getTrailingStmts() {
2847 return reinterpret_cast<Stmt **
>(
reinterpret_cast<char *
>(
this) +
2850 Stmt *
const *getTrailingStmts()
const {
2851 return const_cast<CallExpr *
>(
this)->getTrailingStmts();
2856 static unsigned offsetToTrailingObjects(
StmtClass SC);
2858 unsigned getSizeOfTrailingStmts()
const {
2862 size_t getOffsetOfTrailingFPFeatures()
const {
2864 return CallExprBits.OffsetToTrailingObjects + getSizeOfTrailingStmts();
2887 bool HasFPFeatures) {
2888 return (1 + NumPreArgs + NumArgs) *
sizeof(
Stmt *) +
2893 assert(I <
getNumPreArgs() &&
"Prearg access out of range!");
2894 return getTrailingStmts()[PREARGS_START + I];
2897 assert(I <
getNumPreArgs() &&
"Prearg access out of range!");
2898 return getTrailingStmts()[PREARGS_START + I];
2901 assert(I <
getNumPreArgs() &&
"Prearg access out of range!");
2902 getTrailingStmts()[PREARGS_START + I] = PreArg;
2911 reinterpret_cast<char *
>(
this) +
CallExprBits.OffsetToTrailingObjects +
2912 getSizeOfTrailingStmts());
2917 reinterpret_cast<const char *
>(
this) +
2918 CallExprBits.OffsetToTrailingObjects + getSizeOfTrailingStmts());
2960 bool HasFPFeatures, EmptyShell Empty);
2994 return reinterpret_cast<Expr **
>(getTrailingStmts() + PREARGS_START +
2998 return reinterpret_cast<const Expr *
const *
>(
3004 assert(Arg <
getNumArgs() &&
"Arg access out of range!");
3008 assert(Arg <
getNumArgs() &&
"Arg access out of range!");
3017 assert(Arg <
getNumArgs() &&
"Arg access out of range!");
3025 reinterpret_cast<Expr **
>(getTrailingStmts() + PREARGS_START),
3037 "shrinkNumArgs cannot increase the number of arguments!");
3038 NumArgs = NewNumArgs;
3057 return getTrailingStmts() + PREARGS_START +
getNumPreArgs();
3062 return getTrailingStmts() + PREARGS_START +
getNumPreArgs();
3147 return child_range(getTrailingStmts(), getTrailingStmts() + PREARGS_START +
3153 getTrailingStmts() + PREARGS_START +
3173 private llvm::TrailingObjects<MemberExpr, MemberExprNameQualifier,
3174 ASTTemplateKWAndArgsInfo,
3175 TemplateArgumentLoc> {
3179 friend TrailingObjects;
3196 size_t numTrailingObjects(OverloadToken<MemberExprNameQualifier>)
const {
3197 return hasQualifierOrFoundDecl();
3200 size_t numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>)
const {
3201 return hasTemplateKWAndArgsInfo();
3204 bool hasQualifierOrFoundDecl()
const {
3208 bool hasTemplateKWAndArgsInfo()
const {
3212 MemberExpr(
Expr *
Base,
bool IsArrow, SourceLocation OperatorLoc,
3213 ValueDecl *MemberDecl,
const DeclarationNameInfo &NameInfo,
3216 MemberExpr(EmptyShell Empty)
3217 :
Expr(MemberExprClass, Empty),
Base(), MemberDecl() {}
3220 static MemberExpr *
Create(
const ASTContext &
C,
Expr *
Base,
bool IsArrow,
3221 SourceLocation OperatorLoc,
3222 NestedNameSpecifierLoc QualifierLoc,
3223 SourceLocation TemplateKWLoc, ValueDecl *MemberDecl,
3224 DeclAccessPair FoundDecl,
3225 DeclarationNameInfo MemberNameInfo,
3226 const TemplateArgumentListInfo *TemplateArgs,
3244 bool HasTemplateKWAndArgsInfo,
3245 unsigned NumTemplateArgs);
3259 if (!hasQualifierOrFoundDecl())
3262 return getTrailingObjects<MemberExprNameQualifier>()->FoundDecl;
3274 if (!hasQualifierOrFoundDecl())
3276 return getTrailingObjects<MemberExprNameQualifier>()->QualifierLoc;
3289 if (!hasTemplateKWAndArgsInfo())
3291 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->TemplateKWLoc;
3297 if (!hasTemplateKWAndArgsInfo())
3299 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->LAngleLoc;
3305 if (!hasTemplateKWAndArgsInfo())
3307 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->RAngleLoc;
3321 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->copyInto(
3322 getTrailingObjects<TemplateArgumentLoc>(), List);
3331 return getTrailingObjects<TemplateArgumentLoc>();
3340 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->NumTemplateArgs;
3350 MemberLoc, MemberDNLoc);
3421 llvm::PointerIntPair<TypeSourceInfo *, 1, bool> TInfoAndScope;
3427 LParenLoc(lparenloc), TInfoAndScope(tinfo, fileScope), Init(init) {
3433 :
Expr(CompoundLiteralExprClass, Empty) { }
3446 return TInfoAndScope.getPointer();
3449 TInfoAndScope.setPointer(tinfo);
3457 return Init->getBeginLoc();
3464 return Init->getEndLoc();
3485 bool CastConsistency()
const;
3488 return const_cast<CastExpr*
>(
this)->path_buffer();
3496 Expr *op,
unsigned BasePathSize,
bool HasFPFeatures)
3502 "BasePathSize overflow!");
3503 assert(CastConsistency());
3515 "BasePathSize overflow!");
3557 llvm::iterator_range<path_iterator>
path() {
3560 llvm::iterator_range<path_const_iterator>
path()
const {
3628 private llvm::TrailingObjects<ImplicitCastExpr, CXXBaseSpecifier *,
3629 FPOptionsOverride> {
3634 :
CastExpr(ImplicitCastExprClass, ty, VK,
kind, op, BasePathLength,
3644 :
CastExpr(ImplicitCastExprClass, Shell, PathSize, HasFPFeatures) {}
3646 unsigned numTrailingObjects(OverloadToken<CXXBaseSpecifier *>)
const {
3655 FPO.requiresTrailingStorage()) {
3671 unsigned PathSize,
bool HasFPFeatures);
3713 :
CastExpr(SC, exprTy, VK,
kind, op, PathSize, HasFPFeatures),
3721 :
CastExpr(SC, Shell, PathSize, HasFPFeatures) {}
3734 return T->
getStmtClass() >= firstExplicitCastExprConstant &&
3744 private llvm::TrailingObjects<CStyleCastExpr, CXXBaseSpecifier *,
3745 FPOptionsOverride> {
3754 LPLoc(l), RPLoc(r) {
3764 unsigned numTrailingObjects(OverloadToken<CXXBaseSpecifier *>)
const {
3775 unsigned PathSize,
bool HasFPFeatures);
3815 enum { LHS, RHS, END_EXPR };
3816 Stmt *SubExprs[END_EXPR];
3891 return Opc == BO_PtrMemD || Opc == BO_PtrMemI;
3896 return Opc >= BO_Mul && Opc <= BO_Rem;
3922 llvm_unreachable(
"Not a comparison operator.");
3923 case BO_LT:
return BO_GE;
3924 case BO_GT:
return BO_LE;
3925 case BO_LE:
return BO_GT;
3926 case BO_GE:
return BO_LT;
3927 case BO_EQ:
return BO_NE;
3928 case BO_NE:
return BO_EQ;
3935 llvm_unreachable(
"Not a comparison operator.");
3936 case BO_LT:
return BO_GT;
3937 case BO_GT:
return BO_LT;
3938 case BO_LE:
return BO_GE;
3939 case BO_GE:
return BO_LE;
3950 return Opc >= BO_Assign && Opc <= BO_OrAssign;
3955 return Opc > BO_Assign && Opc <= BO_OrAssign;
3962 if (Opc >= BO_AndAssign)
3963 return Opcode(
unsigned(Opc) - BO_AndAssign + BO_And);
3965 return Opcode(
unsigned(Opc) - BO_MulAssign + BO_Mul);
3969 return Opc == BO_ShlAssign || Opc == BO_ShrAssign;
3982 return S->getStmtClass() >= firstBinaryOperatorConstant &&
3983 S->getStmtClass() <= lastBinaryOperatorConstant;
3988 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
4075 :
BinaryOperator(C, lhs, rhs, opc, ResType, VK, OK, OpLoc, FPFeatures,
4077 ComputationLHSType(CompLHSType), ComputationResultType(CompResultType) {
4079 "Only should be used for compound assignments");
4084 bool hasFPFeatures);
4102 return S->getStmtClass() == CompoundAssignOperatorClass;
4122 :
Expr(SC, T, VK, OK), QuestionLoc(qloc), ColonLoc(cloc) {}
4125 :
Expr(SC, Empty) { }
4145 return T->
getStmtClass() == ConditionalOperatorClass ||
4153 enum { COND, LHS, RHS, END_EXPR };
4154 Stmt* SubExprs[END_EXPR];
4163 SubExprs[COND] = cond;
4164 SubExprs[LHS] = lhs;
4165 SubExprs[RHS] = rhs;
4202 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
4215 enum { COMMON, COND, LHS, RHS, NUM_SUBEXPRS };
4222 Stmt *SubExprs[NUM_SUBEXPRS];
4233 OpaqueValue(opaqueValue) {
4234 SubExprs[COMMON] = common;
4235 SubExprs[COND] = cond;
4236 SubExprs[LHS] = lhs;
4237 SubExprs[RHS] = rhs;
4238 assert(OpaqueValue->
getSourceExpr() == common &&
"Wrong opaque value");
4262 return cast<Expr>(SubExprs[LHS]);
4269 return cast<Expr>(SubExprs[RHS]);
4280 return T->
getStmtClass() == BinaryConditionalOperatorClass;
4285 return child_range(SubExprs, SubExprs + NUM_SUBEXPRS);
4294 return co->getCond();
4295 return cast<BinaryConditionalOperator>(
this)->getCond();
4300 return co->getTrueExpr();
4301 return cast<BinaryConditionalOperator>(
this)->getTrueExpr();
4306 return co->getFalseExpr();
4307 return cast<BinaryConditionalOperator>(
this)->getFalseExpr();
4318 LabelLoc(LLoc),
Label(L) {
4324 :
Expr(AddrLabelExprClass, Empty) { }
4363 LParenLoc(LParenLoc), RParenLoc(RParenLoc) {
4420 :
Expr(ShuffleVectorExprClass, Empty), SubExprs(nullptr) { }
4445 assert((Index < NumExprs) &&
"Arg access out of range!");
4446 return cast<Expr>(SubExprs[Index]);
4449 assert((Index < NumExprs) &&
"Arg access out of range!");
4450 return cast<Expr>(SubExprs[Index]);
4456 assert((N < NumExprs - 2) &&
"Shuffle idx out of range!");
4462 return child_range(&SubExprs[0], &SubExprs[0]+NumExprs);
4486 :
Expr(ConvertVectorExprClass, DstType, VK, OK), SrcExpr(SrcExpr),
4487 TInfo(TI), BuiltinLoc(BuiltinLoc), RParenLoc(RParenLoc) {
4532 enum { COND, LHS, RHS, END_EXPR };
4533 Stmt* SubExprs[END_EXPR];
4540 :
Expr(ChooseExprClass, t, VK, OK), BuiltinLoc(BLoc), RParenLoc(RP),
4541 CondIsTrue(condIsTrue) {
4542 SubExprs[COND] = cond;
4543 SubExprs[LHS] = lhs;
4544 SubExprs[RHS] = rhs;
4556 "Dependent condition isn't true or false");