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");
170 return static_cast<bool>(
getDependence() & ExprDependence::Value);
187 return static_cast<bool>(
getDependence() & ExprDependence::Type);
216 return static_cast<bool>(
getDependence() & ExprDependence::Instantiation);
234 return static_cast<bool>(
getDependence() & ExprDependence::UnexpandedPack);
240 return static_cast<bool>(
getDependence() & ExprDependence::Error);
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;
638 bool InConstantContext =
false)
const;
645 bool InConstantContext =
false)
const;
658 bool InConstantContext =
false)
const;
665 bool InConstantContext =
false)
const;
671 bool InConstantContext =
false)
const;
686 bool IncludePossibleEffects =
true)
const;
708 bool InConstantContext =
false)
const;
717 bool IsConstantInitializer)
const;
726 const Expr *This =
nullptr)
const;
757 unsigned Type)
const;
1004 llvm::detail::ConstantLog2<
alignof(Expr)>::value,
1005 "PointerLikeTypeTraits<Expr*> assumes too much alignment.");
1025 :
Expr(SC, Empty) {}
1044 private llvm::TrailingObjects<ConstantExpr, APValue, uint64_t> {
1045 static_assert(std::is_same<uint64_t, llvm::APInt::WordType>::value,
1046 "ConstantExpr assumes that llvm::APInt::WordType is uint64_t "
1047 "for tail-allocated storage");
1048 friend TrailingObjects;
1057 size_t numTrailingObjects(OverloadToken<APValue>)
const {
1060 size_t numTrailingObjects(OverloadToken<uint64_t>)
const {
1066 "invalid accessor");
1067 return *getTrailingObjects<uint64_t>();
1069 const uint64_t &Int64Result()
const {
1070 return const_cast<ConstantExpr *
>(
this)->Int64Result();
1072 APValue &APValueResult() {
1074 "invalid accessor");
1075 return *getTrailingObjects<APValue>();
1077 APValue &APValueResult()
const {
1078 return const_cast<ConstantExpr *
>(
this)->APValueResult();
1082 bool IsImmediateInvocation);
1086 static ConstantExpr *
Create(
const ASTContext &Context, Expr *E,
1088 static ConstantExpr *
Create(
const ASTContext &Context, Expr *E,
1090 bool IsImmediateInvocation =
false);
1091 static ConstantExpr *
CreateEmpty(
const ASTContext &Context,
1096 const ASTContext &Context);
1152 :
Expr(OpaqueValueExprClass, T, VK, OK), SourceExpr(SourceExpr) {
1164 :
Expr(OpaqueValueExprClass, Empty) {}
1198 assert((!
V || SourceExpr) &&
1199 "unique OVEs are expected to have source expressions");
1235 private llvm::TrailingObjects<DeclRefExpr, NestedNameSpecifierLoc,
1236 NamedDecl *, ASTTemplateKWAndArgsInfo,
1237 TemplateArgumentLoc> {
1240 friend TrailingObjects;
1249 size_t numTrailingObjects(OverloadToken<NestedNameSpecifierLoc>)
const {
1253 size_t numTrailingObjects(OverloadToken<NamedDecl *>)
const {
1254 return hasFoundDecl();
1257 size_t numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>)
const {
1265 DeclRefExpr(
const ASTContext &Ctx, NestedNameSpecifierLoc QualifierLoc,
1266 SourceLocation TemplateKWLoc, ValueDecl *D,
1267 bool RefersToEnlosingVariableOrCapture,
1268 const DeclarationNameInfo &NameInfo, NamedDecl *FoundD,
1269 const TemplateArgumentListInfo *TemplateArgs, QualType T,
1273 explicit DeclRefExpr(EmptyShell Empty) :
Expr(DeclRefExprClass, Empty) {}
1276 DeclRefExpr(
const ASTContext &Ctx, ValueDecl *D,
1277 bool RefersToEnclosingVariableOrCapture, QualType T,
1279 const DeclarationNameLoc &LocInfo = DeclarationNameLoc(),
1282 static DeclRefExpr *
1283 Create(
const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc,
1284 SourceLocation TemplateKWLoc, ValueDecl *D,
1285 bool RefersToEnclosingVariableOrCapture, SourceLocation NameLoc,
1287 const TemplateArgumentListInfo *TemplateArgs =
nullptr,
1290 static DeclRefExpr *
1291 Create(
const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc,
1292 SourceLocation TemplateKWLoc, ValueDecl *D,
1293 bool RefersToEnclosingVariableOrCapture,
1294 const DeclarationNameInfo &NameInfo, QualType T,
ExprValueKind VK,
1295 NamedDecl *FoundD =
nullptr,
1296 const TemplateArgumentListInfo *TemplateArgs =
nullptr,
1300 static DeclRefExpr *
CreateEmpty(
const ASTContext &Context,
bool HasQualifier,
1302 bool HasTemplateKWAndArgsInfo,
1303 unsigned NumTemplateArgs);
1327 return *getTrailingObjects<NestedNameSpecifierLoc>();
1343 return hasFoundDecl() ? *getTrailingObjects<NamedDecl *>() : D;
1349 return hasFoundDecl() ? *getTrailingObjects<NamedDecl *>() : D;
1361 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->TemplateKWLoc;
1369 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->LAngleLoc;
1377 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->RAngleLoc;
1392 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->copyInto(
1393 getTrailingObjects<TemplateArgumentLoc>(), List);
1401 return getTrailingObjects<TemplateArgumentLoc>();
1409 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->NumTemplateArgs;
1476 bool hasAllocation()
const {
return llvm::APInt::getNumWords(BitWidth) > 1; }
1485 unsigned NumWords = llvm::APInt::getNumWords(BitWidth);
1487 return llvm::APInt(BitWidth, NumWords,
pVal);
1489 return llvm::APInt(BitWidth,
VAL);
1504 llvm::APFloat
getValue(
const llvm::fltSemantics &Semantics)
const {
1517 :
Expr(IntegerLiteralClass, Empty) { }
1561 :
Expr(FixedPointLiteralClass, Empty) {}
1569 const llvm::APInt &
V,
1620 Value(value), Loc(l) {
1675 assert(&
getSemantics() == &Val.getSemantics() &&
"Inconsistent semantics");
1682 return static_cast<llvm::APFloatBase::Semantics
>(
1694 return llvm::APFloatBase::EnumToSemantics(
1695 static_cast<llvm::APFloatBase::Semantics
>(
1746 :
Expr(ImaginaryLiteralClass, Empty) { }
1787 private llvm::TrailingObjects<StringLiteral, unsigned, SourceLocation,
1790 friend TrailingObjects;
1810 unsigned numTrailingObjects(OverloadToken<unsigned>)
const {
return 1; }
1811 unsigned numTrailingObjects(OverloadToken<SourceLocation>)
const {
1815 unsigned numTrailingObjects(OverloadToken<char>)
const {
1819 char *getStrDataAsChar() {
return getTrailingObjects<char>(); }
1820 const char *getStrDataAsChar()
const {
return getTrailingObjects<char>(); }
1822 const uint16_t *getStrDataAsUInt16()
const {
1823 return reinterpret_cast<const uint16_t *
>(getTrailingObjects<char>());
1826 const uint32_t *getStrDataAsUInt32()
const {
1827 return reinterpret_cast<const uint32_t *
>(getTrailingObjects<char>());
1831 StringLiteral(
const ASTContext &Ctx, StringRef Str,
StringKind Kind,
1832 bool Pascal, QualType Ty,
const SourceLocation *Loc,
1833 unsigned NumConcatenated);
1836 StringLiteral(EmptyShell Empty,
unsigned NumConcatenated,
unsigned Length,
1837 unsigned CharByteWidth);
1843 void setStrTokenLoc(
unsigned TokNum, SourceLocation L) {
1845 getTrailingObjects<SourceLocation>()[TokNum] = L;
1851 static StringLiteral *
Create(
const ASTContext &Ctx, StringRef Str,
1853 const SourceLocation *Loc,
1854 unsigned NumConcatenated);
1860 return Create(Ctx, Str, Kind, Pascal, Ty, &Loc, 1);
1865 unsigned NumConcatenated,
unsigned Length,
1866 unsigned CharByteWidth);
1870 "This function is used in places that assume strings use char");
1884 assert(i <
getLength() &&
"out of bounds access");
1887 return static_cast<unsigned char>(getStrDataAsChar()[i]);
1889 return getStrDataAsUInt16()[i];
1891 return getStrDataAsUInt32()[i];
1893 llvm_unreachable(
"Unsupported character width!");
1897 unsigned getLength()
const {
return *getTrailingObjects<unsigned>(); }
1934 return getTrailingObjects<SourceLocation>()[TokNum];
1947 unsigned *StartToken =
nullptr,
1948 unsigned *StartTokenByteOffset =
nullptr)
const;
1953 return getTrailingObjects<SourceLocation>();
1979 private llvm::TrailingObjects<PredefinedExpr, Stmt *> {
1981 friend TrailingObjects;
2010 void setFunctionName(StringLiteral *SL) {
2011 assert(hasFunctionName() &&
2012 "This PredefinedExpr has no storage for a function name!");
2013 *getTrailingObjects<Stmt *>() = SL;
2021 static PredefinedExpr *
Create(
const ASTContext &Ctx, SourceLocation L,
2022 QualType FNTy,
IdentKind IK,
bool IsTransparent,
2026 static PredefinedExpr *
CreateEmpty(
const ASTContext &Ctx,
2027 bool HasFunctionName);
2039 return hasFunctionName()
2040 ?
static_cast<StringLiteral *
>(*getTrailingObjects<Stmt *>())
2045 return hasFunctionName()
2046 ?
static_cast<StringLiteral *
>(*getTrailingObjects<Stmt *>())
2067 getTrailingObjects<Stmt *>() + hasFunctionName());
2072 getTrailingObjects<Stmt *>() + hasFunctionName());
2093 void setLParenLocation(SourceLocation L) { LParen = L; }
2094 void setRParenLocation(SourceLocation L) { RParen = L; }
2114 return T->
getStmtClass() == SYCLUniqueStableNameExprClass;
2143 L(l), R(r), Val(val) {
2149 :
Expr(ParenExprClass, Empty) { }
2189 private llvm::TrailingObjects<UnaryOperator, FPOptionsOverride> {
2192 size_t numTrailingObjects(OverloadToken<FPOptionsOverride>)
const {
2198 return *getTrailingObjects<FPOptionsOverride>();
2203 return *getTrailingObjects<FPOptionsOverride>();
2216 :
Expr(UnaryOperatorClass, Empty) {
2264 return Op == UO_PostInc || Op == UO_PostDec;
2269 return Op == UO_PreInc || Op == UO_PreDec;
2276 return Op == UO_PreInc || Op == UO_PostInc;
2283 return Op == UO_PreDec || Op == UO_PostDec;
2295 return Op >= UO_Plus && Op <= UO_LNot;
2334 return getTrailingFPFeatures();
2380 enum { MaskBits = 2, Mask = 0x03 };
2400 : Range(LBracketLoc, RBracketLoc),
Data((Index << 2) |
Array) {}
2404 : Range(DotLoc.isValid() ? DotLoc : NameLoc, NameLoc),
2410 : Range(DotLoc.isValid() ? DotLoc : NameLoc, NameLoc),
2470 private llvm::TrailingObjects<OffsetOfExpr, OffsetOfNode, Expr *> {
2479 size_t numTrailingObjects(OverloadToken<OffsetOfNode>)
const {
2488 explicit OffsetOfExpr(
unsigned numComps,
unsigned numExprs)
2490 TSInfo(
nullptr), NumComps(numComps), NumExprs(numExprs) {}
2500 unsigned NumComps,
unsigned NumExprs);
2518 assert(Idx < NumComps &&
"Subscript out of range");
2519 return getTrailingObjects<OffsetOfNode>()[Idx];
2523 assert(Idx < NumComps &&
"Subscript out of range");
2524 getTrailingObjects<OffsetOfNode>()[Idx] = ON;
2532 assert(Idx < NumExprs &&
"Subscript out of range");
2533 return getTrailingObjects<Expr *>()[Idx];
2537 assert(Idx < NumExprs &&
"Subscript out of range");
2538 return getTrailingObjects<Expr *>()[Idx];
2542 assert(Idx < NumComps &&
"Subscript out of range");
2543 getTrailingObjects<Expr *>()[Idx] = E;
2559 Stmt **begin =
reinterpret_cast<Stmt **
>(getTrailingObjects<Expr *>());
2563 Stmt *
const *begin =
2564 reinterpret_cast<Stmt *
const *
>(getTrailingObjects<Expr *>());
2586 OpLoc(op), RParenLoc(rp) {
2587 assert(ExprKind <=
UETT_Last &&
"invalid enum value!");
2589 assert(
static_cast<unsigned>(ExprKind) ==
2591 "UnaryExprOrTypeTraitExprBits.Kind overflow!");
2593 Argument.Ty = TInfo;
2603 :
Expr(UnaryExprOrTypeTraitExprClass, Empty) { }
2609 assert(K <=
UETT_Last &&
"invalid enum value!");
2612 "UnaryExprOrTypeTraitExprBits.Kind overflow!");
2620 assert(
isArgumentType() &&
"calling getArgumentType() when arg is expr");
2624 assert(!
isArgumentType() &&
"calling getArgumentExpr() when arg is type");
2625 return static_cast<Expr*
>(Argument.Ex);
2636 Argument.Ty = TInfo;
2656 return T->
getStmtClass() == UnaryExprOrTypeTraitExprClass;
2670 enum { LHS, RHS, END_EXPR };
2671 Stmt *SubExprs[END_EXPR];
2678 :
Expr(ArraySubscriptExprClass, t, VK, OK) {
2679 SubExprs[LHS] = lhs;
2680 SubExprs[RHS] = rhs;
2687 :
Expr(ArraySubscriptExprClass, Shell) { }
2734 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
2748 enum { BASE, ROW_IDX, COLUMN_IDX, END_EXPR };
2749 Stmt *SubExprs[END_EXPR];
2756 SubExprs[BASE] =
Base;
2757 SubExprs[ROW_IDX] = RowIdx;
2758 SubExprs[COLUMN_IDX] = ColumnIdx;
2765 :
Expr(MatrixSubscriptExprClass, Shell) {}
2769 assert((SubExprs[COLUMN_IDX] || IsIncomplete) &&
2770 "expressions without column index must be marked as incomplete");
2771 return IsIncomplete;
2784 "cannot get the column index of an incomplete expression");
2785 return cast<Expr>(SubExprs[COLUMN_IDX]);
2812 return child_range(&SubExprs[0], &SubExprs[0] + END_EXPR);
2826 enum { FN = 0, PREARGS_START = 1 };
2859 Stmt **getTrailingStmts() {
2860 return reinterpret_cast<Stmt **
>(
reinterpret_cast<char *
>(
this) +
2863 Stmt *
const *getTrailingStmts()
const {
2864 return const_cast<CallExpr *
>(
this)->getTrailingStmts();
2869 static unsigned offsetToTrailingObjects(
StmtClass SC);
2871 unsigned getSizeOfTrailingStmts()
const {
2875 size_t getOffsetOfTrailingFPFeatures()
const {
2877 return CallExprBits.OffsetToTrailingObjects + getSizeOfTrailingStmts();
2900 bool HasFPFeatures) {
2901 return (1 + NumPreArgs + NumArgs) *
sizeof(
Stmt *) +
2906 assert(I <
getNumPreArgs() &&
"Prearg access out of range!");
2907 return getTrailingStmts()[PREARGS_START + I];
2910 assert(I <
getNumPreArgs() &&
"Prearg access out of range!");
2911 return getTrailingStmts()[PREARGS_START + I];
2914 assert(I <
getNumPreArgs() &&
"Prearg access out of range!");
2915 getTrailingStmts()[PREARGS_START + I] = PreArg;
2924 reinterpret_cast<char *
>(
this) +
CallExprBits.OffsetToTrailingObjects +
2925 getSizeOfTrailingStmts());
2930 reinterpret_cast<const char *
>(
this) +
2931 CallExprBits.OffsetToTrailingObjects + getSizeOfTrailingStmts());
2973 bool HasFPFeatures, EmptyShell Empty);
3007 return reinterpret_cast<Expr **
>(getTrailingStmts() + PREARGS_START +
3011 return reinterpret_cast<const Expr *
const *
>(
3017 assert(Arg <
getNumArgs() &&
"Arg access out of range!");
3021 assert(Arg <
getNumArgs() &&
"Arg access out of range!");
3030 assert(Arg <
getNumArgs() &&
"Arg access out of range!");
3038 reinterpret_cast<Expr **
>(getTrailingStmts() + PREARGS_START),
3050 "shrinkNumArgs cannot increase the number of arguments!");
3051 NumArgs = NewNumArgs;
3070 return getTrailingStmts() + PREARGS_START +
getNumPreArgs();
3075 return getTrailingStmts() + PREARGS_START +
getNumPreArgs();
3160 return child_range(getTrailingStmts(), getTrailingStmts() + PREARGS_START +
3166 getTrailingStmts() + PREARGS_START +
3186 private llvm::TrailingObjects<MemberExpr, MemberExprNameQualifier,
3187 ASTTemplateKWAndArgsInfo,
3188 TemplateArgumentLoc> {
3192 friend TrailingObjects;
3209 size_t numTrailingObjects(OverloadToken<MemberExprNameQualifier>)
const {
3210 return hasQualifierOrFoundDecl();
3213 size_t numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>)
const {
3214 return hasTemplateKWAndArgsInfo();
3217 bool hasQualifierOrFoundDecl()
const {
3221 bool hasTemplateKWAndArgsInfo()
const {
3225 MemberExpr(
Expr *
Base,
bool IsArrow, SourceLocation OperatorLoc,
3226 ValueDecl *MemberDecl,
const DeclarationNameInfo &NameInfo,
3229 MemberExpr(EmptyShell Empty)
3230 :
Expr(MemberExprClass, Empty),
Base(), MemberDecl() {}
3233 static MemberExpr *
Create(
const ASTContext &
C,
Expr *
Base,
bool IsArrow,
3234 SourceLocation OperatorLoc,
3235 NestedNameSpecifierLoc QualifierLoc,
3236 SourceLocation TemplateKWLoc, ValueDecl *MemberDecl,
3237 DeclAccessPair FoundDecl,
3238 DeclarationNameInfo MemberNameInfo,
3239 const TemplateArgumentListInfo *TemplateArgs,
3257 bool HasTemplateKWAndArgsInfo,
3258 unsigned NumTemplateArgs);
3272 if (!hasQualifierOrFoundDecl())
3275 return getTrailingObjects<MemberExprNameQualifier>()->FoundDecl;
3287 if (!hasQualifierOrFoundDecl())
3289 return getTrailingObjects<MemberExprNameQualifier>()->QualifierLoc;
3302 if (!hasTemplateKWAndArgsInfo())
3304 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->TemplateKWLoc;
3310 if (!hasTemplateKWAndArgsInfo())
3312 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->LAngleLoc;
3318 if (!hasTemplateKWAndArgsInfo())
3320 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->RAngleLoc;
3334 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->copyInto(
3335 getTrailingObjects<TemplateArgumentLoc>(), List);
3344 return getTrailingObjects<TemplateArgumentLoc>();
3353 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->NumTemplateArgs;
3363 MemberLoc, MemberDNLoc);
3434 llvm::PointerIntPair<TypeSourceInfo *, 1, bool> TInfoAndScope;
3440 LParenLoc(lparenloc), TInfoAndScope(tinfo, fileScope), Init(init) {
3446 :
Expr(CompoundLiteralExprClass, Empty) { }
3459 return TInfoAndScope.getPointer();
3462 TInfoAndScope.setPointer(tinfo);
3470 return Init->getBeginLoc();
3477 return Init->getEndLoc();
3498 bool CastConsistency()
const;
3501 return const_cast<CastExpr*
>(
this)->path_buffer();
3509 Expr *op,
unsigned BasePathSize,
bool HasFPFeatures)
3515 "BasePathSize overflow!");
3516 assert(CastConsistency());
3528 "BasePathSize overflow!");
3570 llvm::iterator_range<path_iterator>
path() {
3573 llvm::iterator_range<path_const_iterator>
path()
const {
3641 private llvm::TrailingObjects<ImplicitCastExpr, CXXBaseSpecifier *,
3642 FPOptionsOverride> {
3647 :
CastExpr(ImplicitCastExprClass, ty, VK, kind, op, BasePathLength,
3657 :
CastExpr(ImplicitCastExprClass, Shell, PathSize, HasFPFeatures) {}
3659 unsigned numTrailingObjects(OverloadToken<CXXBaseSpecifier *>)
const {
3667 :
CastExpr(ImplicitCastExprClass, ty, VK, kind, op, 0,
3668 FPO.requiresTrailingStorage()) {
3684 unsigned PathSize,
bool HasFPFeatures);
3726 :
CastExpr(SC, exprTy, VK, kind, op, PathSize, HasFPFeatures),
3734 :
CastExpr(SC, Shell, PathSize, HasFPFeatures) {}
3747 return T->
getStmtClass() >= firstExplicitCastExprConstant &&
3757 private llvm::TrailingObjects<CStyleCastExpr, CXXBaseSpecifier *,
3758 FPOptionsOverride> {
3767 LPLoc(l), RPLoc(r) {
3777 unsigned numTrailingObjects(OverloadToken<CXXBaseSpecifier *>)
const {
3788 unsigned PathSize,
bool HasFPFeatures);
3828 enum { LHS, RHS, END_EXPR };
3829 Stmt *SubExprs[END_EXPR];
3904 return Opc == BO_PtrMemD || Opc == BO_PtrMemI;
3909 return Opc >= BO_Mul && Opc <= BO_Rem;
3935 llvm_unreachable(
"Not a comparison operator.");
3936 case BO_LT:
return BO_GE;
3937 case BO_GT:
return BO_LE;
3938 case BO_LE:
return BO_GT;
3939 case BO_GE:
return BO_LT;
3940 case BO_EQ:
return BO_NE;
3941 case BO_NE:
return BO_EQ;
3948 llvm_unreachable(
"Not a comparison operator.");
3949 case BO_LT:
return BO_GT;
3950 case BO_GT:
return BO_LT;
3951 case BO_LE:
return BO_GE;
3952 case BO_GE:
return BO_LE;
3963 return Opc >= BO_Assign && Opc <= BO_OrAssign;
3968 return Opc > BO_Assign && Opc <= BO_OrAssign;
3975 if (Opc >= BO_AndAssign)
3976 return Opcode(
unsigned(Opc) - BO_AndAssign + BO_And);
3978 return Opcode(
unsigned(Opc) - BO_MulAssign + BO_Mul);
3982 return Opc == BO_ShlAssign || Opc == BO_ShrAssign;
3996 return S->getStmtClass() >= firstBinaryOperatorConstant &&
3997 S->getStmtClass() <= lastBinaryOperatorConstant;
4002 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
4089 :
BinaryOperator(
C, lhs, rhs, opc, ResType, VK, OK, OpLoc, FPFeatures,
4091 ComputationLHSType(CompLHSType), ComputationResultType(CompResultType) {
4093 "Only should be used for compound assignments");
4098 bool hasFPFeatures);
4116 return S->getStmtClass() == CompoundAssignOperatorClass;
4136 :
Expr(SC, T, VK, OK), QuestionLoc(qloc), ColonLoc(cloc) {}
4139 :
Expr(SC, Empty) { }
4159 return T->
getStmtClass() == ConditionalOperatorClass ||
4167 enum { COND, LHS, RHS, END_EXPR };
4168 Stmt* SubExprs[END_EXPR];
4177 SubExprs[COND] = cond;
4178 SubExprs[LHS] = lhs;
4179 SubExprs[RHS] = rhs;
4216 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
4229 enum { COMMON, COND, LHS, RHS, NUM_SUBEXPRS };
4236 Stmt *SubExprs[NUM_SUBEXPRS];
4247 OpaqueValue(opaqueValue) {
4248 SubExprs[COMMON] = common;
4249 SubExprs[COND] = cond;
4250 SubExprs[LHS] = lhs;
4251 SubExprs[RHS] = rhs;
4252 assert(OpaqueValue->
getSourceExpr() == common &&
"Wrong opaque value");
4276 return cast<Expr>(SubExprs[LHS]);
4283 return cast<Expr>(SubExprs[RHS]);
4294 return T->
getStmtClass() == BinaryConditionalOperatorClass;
4299 return child_range(SubExprs, SubExprs + NUM_SUBEXPRS);
4308 return co->getCond();
4309 return cast<BinaryConditionalOperator>(
this)->getCond();