13 #ifndef LLVM_CLANG_AST_EXPR_H 14 #define LLVM_CLANG_AST_EXPR_H 29 #include "llvm/ADT/APFloat.h" 30 #include "llvm/ADT/APSInt.h" 31 #include "llvm/ADT/iterator.h" 32 #include "llvm/ADT/iterator_range.h" 33 #include "llvm/ADT/SmallVector.h" 34 #include "llvm/ADT/StringRef.h" 35 #include "llvm/Support/AtomicOrdering.h" 36 #include "llvm/Support/Compiler.h" 37 #include "llvm/Support/TrailingObjects.h" 43 class CXXBaseSpecifier;
44 class CXXMemberCallExpr;
45 class CXXOperatorCallExpr;
49 class MaterializeTemporaryExpr;
51 class ObjCPropertyRefExpr;
52 class OpaqueValueExpr;
115 Expr &operator=(
const Expr&) =
delete;
120 bool TD,
bool VD,
bool ID,
bool ContainsUnexpandedParameterPack)
123 ExprBits.TypeDependent = TD;
124 ExprBits.ValueDependent = VD;
125 ExprBits.InstantiationDependent =
ID;
126 ExprBits.ValueKind = VK;
127 ExprBits.ObjectKind = OK;
128 assert(ExprBits.ObjectKind == OK &&
"truncated kind");
129 ExprBits.ContainsUnexpandedParameterPack = ContainsUnexpandedParameterPack;
146 "Expressions can't have reference type");
162 ExprBits.ValueDependent = VD;
180 ExprBits.TypeDependent = TD;
201 return ExprBits.InstantiationDependent;
206 ExprBits.InstantiationDependent =
ID;
224 return ExprBits.ContainsUnexpandedParameterPack;
230 ExprBits.ContainsUnexpandedParameterPack = PP;
347 unsigned short Modifiable;
350 : Kind(k), Modifiable(m)
358 assert(Modifiable != CM_Untested &&
"Did not test for modifiability.");
361 bool isLValue()
const {
return Kind == CL_LValue; }
362 bool isXValue()
const {
return Kind == CL_XValue; }
365 bool isRValue()
const {
return Kind >= CL_XValue; }
387 return ClassifyImpl(Ctx,
nullptr);
399 return ClassifyImpl(Ctx, &Loc);
406 return (isa<LValueReferenceType>(RT)
408 : (RT->getPointeeType()->isFunctionType()
458 return const_cast<Expr*
>(
this)->getSourceBitField();
461 Decl *getReferencedDeclOfCallee();
463 return const_cast<Expr*
>(
this)->getReferencedDeclOfCallee();
471 bool isObjCSelfExpr()
const;
474 bool refersToVectorElement()
const;
478 bool refersToGlobalRegisterVar()
const;
482 return getType()->isPlaceholderType();
488 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(getType()))
489 return BT->getKind() == K;
503 bool isKnownToHaveBooleanValue(
bool Semantic =
true)
const;
514 bool isEvaluated =
true)
const;
515 bool isIntegerConstantExpr(
const ASTContext &Ctx,
520 bool isCXX98IntegralConstantExpr(
const ASTContext &Ctx)
const;
534 static bool isPotentialConstantExpr(
const FunctionDecl *FD,
543 static bool isPotentialConstantExprUnevaluated(
Expr *E,
552 bool isConstantInitializer(
ASTContext &Ctx,
bool ForRef,
553 const Expr **Culprit =
nullptr)
const;
576 : HasSideEffects(
false), HasUndefinedBehavior(
false), Diag(nullptr) {}
581 return HasSideEffects;
592 bool isGlobalLValue()
const;
602 bool InConstantContext =
false)
const;
609 bool InConstantContext =
false)
const;
613 SE_AllowUndefinedBehavior,
622 bool InConstantContext =
false)
const;
627 bool EvaluateAsFloat(llvm::APFloat &Result,
const ASTContext &Ctx,
629 bool InConstantContext =
false)
const;
635 bool InConstantContext =
false)
const;
650 bool IncludePossibleEffects =
true)
const;
654 bool hasNonTrivialCall(
const ASTContext &Ctx)
const;
667 void EvaluateForOverflow(
const ASTContext &Ctx)
const;
672 bool InConstantContext =
false)
const;
705 bool tryEvaluateObjectSize(uint64_t &Result,
ASTContext &Ctx,
706 unsigned Type)
const;
735 NPC_NeverValueDependent = 0,
743 NPC_ValueDependentIsNotNull
755 bool isOBJCGCCandidate(
ASTContext &Ctx)
const;
758 bool isBoundMemberFunction(
ASTContext &Ctx)
const;
769 Expr *IgnoreUnlessSpelledInSource();
771 return const_cast<Expr *
>(
this)->IgnoreUnlessSpelledInSource();
778 Expr *IgnoreImpCasts() LLVM_READONLY;
780 return const_cast<Expr *
>(
this)->IgnoreImpCasts();
789 Expr *IgnoreCasts() LLVM_READONLY;
791 return const_cast<Expr *
>(
this)->IgnoreCasts();
799 Expr *IgnoreImplicit() LLVM_READONLY;
801 return const_cast<Expr *
>(
this)->IgnoreImplicit();
809 Expr *IgnoreImplicitAsWritten() LLVM_READONLY;
811 return const_cast<Expr *
>(
this)->IgnoreImplicitAsWritten();
821 Expr *IgnoreParens() LLVM_READONLY;
823 return const_cast<Expr *
>(
this)->IgnoreParens();
835 Expr *IgnoreParenImpCasts() LLVM_READONLY;
837 return const_cast<Expr *
>(
this)->IgnoreParenImpCasts();
844 Expr *IgnoreParenCasts() LLVM_READONLY;
846 return const_cast<Expr *
>(
this)->IgnoreParenCasts();
851 Expr *IgnoreConversionOperator() LLVM_READONLY;
853 return const_cast<Expr *
>(
this)->IgnoreConversionOperator();
864 Expr *IgnoreParenLValueCasts() LLVM_READONLY;
866 return const_cast<Expr *
>(
this)->IgnoreParenLValueCasts();
877 return const_cast<Expr *
>(
this)->IgnoreParenNoopCasts(Ctx);
885 Expr *ignoreParenBaseCasts() LLVM_READONLY;
887 return const_cast<Expr *
>(
this)->ignoreParenBaseCasts();
897 bool isDefaultArgument()
const;
904 bool isImplicitCXXThis()
const;
920 const Expr *getBestDynamicClassTypeExpr()
const;
925 const Expr *skipRValueSubobjectAdjustments(
931 return skipRValueSubobjectAdjustments(CommaLHSs, Adjustments);
937 static bool isSameComparisonOperand(
const Expr* E1,
const Expr* E2);
955 :
Expr(SC, subexpr->getType(),
956 subexpr->getValueKind(), subexpr->getObjectKind(),
957 subexpr->isTypeDependent(), subexpr->isValueDependent(),
958 subexpr->isInstantiationDependent(),
959 subexpr->containsUnexpandedParameterPack()), SubExpr(subexpr) {}
981 static_assert(std::is_same<uint64_t, llvm::APInt::WordType>::value,
982 "this class assumes llvm::APInt::WordType is uint64_t for " 983 "trail-allocated storage");
990 size_t numTrailingObjects(OverloadToken<APValue>)
const {
993 size_t numTrailingObjects(OverloadToken<uint64_t>)
const {
998 uint64_t &Int64Result() {
1000 "invalid accessor");
1001 return *getTrailingObjects<uint64_t>();
1003 const uint64_t &Int64Result()
const {
1004 return const_cast<ConstantExpr *
>(
this)->Int64Result();
1008 "invalid accessor");
1009 return *getTrailingObjects<APValue>();
1011 const APValue &APValueResult()
const {
1012 return const_cast<ConstantExpr *
>(
this)->APValueResult();
1035 return SubExpr->getBeginLoc();
1038 return SubExpr->getEndLoc();
1046 MoveIntoResult(Value, Context);
1056 APValue getAPValueResult()
const;
1082 Expr *SourceExpr =
nullptr)
1083 :
Expr(OpaqueValueExprClass, T, VK, OK,
1084 T->isDependentType() ||
1085 (SourceExpr && SourceExpr->isTypeDependent()),
1086 T->isDependentType() ||
1087 (SourceExpr && SourceExpr->isValueDependent()),
1088 T->isInstantiationDependentType() ||
1089 (SourceExpr && SourceExpr->isInstantiationDependent()),
1091 SourceExpr(SourceExpr) {
1093 OpaqueValueExprBits.Loc = Loc;
1102 :
Expr(OpaqueValueExprClass, Empty) {}
1108 return SourceExpr ? SourceExpr->
getBeginLoc() : getLocation();
1111 return SourceExpr ? SourceExpr->
getEndLoc() : getLocation();
1114 return SourceExpr ? SourceExpr->
getExprLoc() : getLocation();
1136 assert((!V || SourceExpr) &&
1137 "unique OVEs are expected to have source expressions");
1138 OpaqueValueExprBits.IsUnique =
V;
1141 bool isUnique()
const {
return OpaqueValueExprBits.IsUnique; }
1174 NamedDecl *, ASTTemplateKWAndArgsInfo,
1175 TemplateArgumentLoc> {
1187 size_t numTrailingObjects(OverloadToken<NestedNameSpecifierLoc>)
const {
1188 return hasQualifier();
1191 size_t numTrailingObjects(OverloadToken<NamedDecl *>)
const {
1192 return hasFoundDecl();
1195 size_t numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>)
const {
1196 return hasTemplateKWAndArgsInfo();
1201 bool hasFoundDecl()
const {
return DeclRefExprBits.HasFoundDecl; }
1205 bool RefersToEnlosingVariableOrCapture,
1215 void computeDependence(
const ASTContext &Ctx);
1219 bool RefersToEnclosingVariableOrCapture,
QualType T,
1235 bool RefersToEnclosingVariableOrCapture,
1244 bool HasTemplateKWAndArgsInfo,
1245 unsigned NumTemplateArgs);
1267 if (!hasQualifier())
1269 return *getTrailingObjects<NestedNameSpecifierLoc>();
1275 return getQualifierLoc().getNestedNameSpecifier();
1285 return hasFoundDecl() ? *getTrailingObjects<NamedDecl *>() : D;
1291 return hasFoundDecl() ? *getTrailingObjects<NamedDecl *>() : D;
1295 return DeclRefExprBits.HasTemplateKWAndArgsInfo;
1301 if (!hasTemplateKWAndArgsInfo())
1303 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->TemplateKWLoc;
1309 if (!hasTemplateKWAndArgsInfo())
1311 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->LAngleLoc;
1317 if (!hasTemplateKWAndArgsInfo())
1319 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->RAngleLoc;
1333 if (hasExplicitTemplateArgs())
1334 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->copyInto(
1335 getTrailingObjects<TemplateArgumentLoc>(), List);
1341 if (!hasExplicitTemplateArgs())
1343 return getTrailingObjects<TemplateArgumentLoc>();
1349 if (!hasExplicitTemplateArgs())
1351 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->NumTemplateArgs;
1355 return {getTemplateArgs(), getNumTemplateArgs()};
1361 return DeclRefExprBits.HadMultipleCandidates;
1367 DeclRefExprBits.HadMultipleCandidates =
V;
1378 return DeclRefExprBits.RefersToEnclosingVariableOrCapture;
1410 bool hasAllocation()
const {
return llvm::APInt::getNumWords(BitWidth) > 1; }
1419 unsigned NumWords = llvm::APInt::getNumWords(BitWidth);
1432 setIntValue(C, Val);
1438 llvm::APFloat
getValue(
const llvm::fltSemantics &Semantics)
const {
1439 return llvm::APFloat(Semantics, getIntValue());
1442 setIntValue(C, Val.bitcastToAPInt());
1451 :
Expr(IntegerLiteralClass, Empty) { }
1495 :
Expr(FixedPointLiteralClass, Empty) {}
1519 std::string getValueAsString(
unsigned Radix)
const;
1549 Value(value), Loc(l) {
1550 CharacterLiteralBits.Kind =
kind;
1558 return static_cast<CharacterKind>(CharacterLiteralBits.Kind);
1601 assert(&getSemantics() == &Val.getSemantics() &&
"Inconsistent semantics");
1608 return static_cast<llvm::APFloatBase::Semantics
>(
1609 FloatingLiteralBits.Semantics);
1615 FloatingLiteralBits.Semantics = Sem;
1620 return llvm::APFloatBase::EnumToSemantics(
1621 static_cast<llvm::APFloatBase::Semantics>(
1622 FloatingLiteralBits.Semantics));
1627 FloatingLiteralBits.Semantics = llvm::APFloatBase::SemanticsToEnum(Sem);
1630 bool isExact()
const {
return FloatingLiteralBits.IsExact; }
1631 void setExact(
bool E) { FloatingLiteralBits.IsExact = E; }
1636 double getValueAsApproximateDouble()
const;
1672 :
Expr(ImaginaryLiteralClass, Empty) { }
1736 unsigned numTrailingObjects(OverloadToken<unsigned>)
const {
return 1; }
1737 unsigned numTrailingObjects(OverloadToken<SourceLocation>)
const {
1738 return getNumConcatenated();
1741 unsigned numTrailingObjects(OverloadToken<char>)
const {
1742 return getByteLength();
1745 char *getStrDataAsChar() {
return getTrailingObjects<char>(); }
1746 const char *getStrDataAsChar()
const {
return getTrailingObjects<char>(); }
1748 const uint16_t *getStrDataAsUInt16()
const {
1749 return reinterpret_cast<const uint16_t *
>(getTrailingObjects<char>());
1752 const uint32_t *getStrDataAsUInt32()
const {
1753 return reinterpret_cast<const uint32_t *
>(getTrailingObjects<char>());
1759 unsigned NumConcatenated);
1763 unsigned CharByteWidth);
1770 assert(TokNum < getNumConcatenated() &&
"Invalid tok number");
1771 getTrailingObjects<SourceLocation>()[TokNum] = L;
1780 unsigned NumConcatenated);
1786 return Create(Ctx, Str, Kind, Pascal, Ty, &Loc, 1);
1791 unsigned NumConcatenated,
unsigned Length,
1792 unsigned CharByteWidth);
1795 assert(getCharByteWidth() == 1 &&
1796 "This function is used in places that assume strings use char");
1797 return StringRef(getStrDataAsChar(), getByteLength());
1804 return StringRef(getStrDataAsChar(), getByteLength());
1807 void outputString(raw_ostream &OS)
const;
1810 assert(i < getLength() &&
"out of bounds access");
1811 switch (getCharByteWidth()) {
1813 return static_cast<unsigned char>(getStrDataAsChar()[i]);
1815 return getStrDataAsUInt16()[i];
1817 return getStrDataAsUInt32()[i];
1819 llvm_unreachable(
"Unsupported character width!");
1823 unsigned getLength()
const {
return *getTrailingObjects<unsigned>(); }
1827 return static_cast<StringKind>(StringLiteralBits.Kind);
1835 bool isPascal()
const {
return StringLiteralBits.IsPascal; }
1838 for (
auto c : getString())
1845 for (
auto c : getString())
1854 return StringLiteralBits.NumConcatenated;
1859 assert(TokNum < getNumConcatenated() &&
"Invalid tok number");
1860 return getTrailingObjects<SourceLocation>()[TokNum];
1873 unsigned *StartToken =
nullptr,
1874 unsigned *StartTokenByteOffset =
nullptr)
const;
1879 return getTrailingObjects<SourceLocation>();
1883 return getTrailingObjects<SourceLocation>() + getNumConcatenated();
1924 PrettyFunctionNoVirtual
1934 bool hasFunctionName()
const {
return PredefinedExprBits.HasFunctionName; }
1937 assert(hasFunctionName() &&
1938 "This PredefinedExpr has no storage for a function name!");
1939 *getTrailingObjects<Stmt *>() = SL;
1949 bool HasFunctionName);
1952 return static_cast<IdentKind>(PredefinedExprBits.Kind);
1959 return hasFunctionName()
1960 ?
static_cast<StringLiteral *
>(*getTrailingObjects<Stmt *>())
1965 return hasFunctionName()
1966 ?
static_cast<StringLiteral *
>(*getTrailingObjects<Stmt *>())
1970 static StringRef getIdentKindName(
IdentKind IK);
1971 static std::string ComputeName(
IdentKind IK,
const Decl *CurrentDecl);
1983 getTrailingObjects<Stmt *>() + hasFunctionName());
1988 getTrailingObjects<Stmt *>() + hasFunctionName());
1999 :
Expr(ParenExprClass, val->getType(),
2000 val->getValueKind(), val->getObjectKind(),
2001 val->isTypeDependent(), val->isValueDependent(),
2002 val->isInstantiationDependent(),
2003 val->containsUnexpandedParameterPack()),
2004 L(l), R(r), Val(val) {}
2008 :
Expr(ParenExprClass, Empty) { }
2054 :
Expr(UnaryOperatorClass, type, VK, OK,
2055 input->isTypeDependent() || type->isDependentType(),
2056 input->isValueDependent(),
2057 (input->isInstantiationDependent() ||
2058 type->isInstantiationDependentType()),
2059 input->containsUnexpandedParameterPack()),
2061 UnaryOperatorBits.Opc = opc;
2062 UnaryOperatorBits.CanOverflow = CanOverflow;
2063 UnaryOperatorBits.Loc = l;
2068 UnaryOperatorBits.Opc = UO_AddrOf;
2072 return static_cast<Opcode
>(UnaryOperatorBits.Opc);
2094 return Op == UO_PostInc || Op == UO_PostDec;
2099 return Op == UO_PreInc || Op == UO_PreDec;
2106 return Op == UO_PreInc || Op == UO_PostInc;
2109 return isIncrementOp(getOpcode());
2113 return Op == UO_PreDec || Op == UO_PostDec;
2116 return isDecrementOp(getOpcode());
2121 return isIncrementDecrementOp(getOpcode());
2125 return Op >= UO_Plus && Op <= UO_LNot;
2131 static StringRef getOpcodeStr(Opcode Op);
2142 return isPostfix() ? Val->
getBeginLoc() : getOperatorLoc();
2145 return isPostfix() ? getOperatorLoc() : Val->
getEndLoc();
2179 enum { MaskBits = 2, Mask = 0x03 };
2199 : Range(LBracketLoc, RBracketLoc), Data((Index << 2) | Array) {}
2203 : Range(DotLoc.isValid() ? DotLoc : NameLoc, NameLoc),
2209 : Range(DotLoc.isValid() ? DotLoc : NameLoc, NameLoc),
2278 size_t numTrailingObjects(OverloadToken<OffsetOfNode>)
const {
2287 explicit OffsetOfExpr(
unsigned numComps,
unsigned numExprs)
2289 TSInfo(
nullptr), NumComps(numComps), NumExprs(numExprs) {}
2299 unsigned NumComps,
unsigned NumExprs);
2317 assert(Idx < NumComps &&
"Subscript out of range");
2318 return getTrailingObjects<OffsetOfNode>()[Idx];
2322 assert(Idx < NumComps &&
"Subscript out of range");
2323 getTrailingObjects<OffsetOfNode>()[Idx] = ON;
2331 assert(Idx < NumExprs &&
"Subscript out of range");
2332 return getTrailingObjects<Expr *>()[Idx];
2336 assert(Idx < NumExprs &&
"Subscript out of range");
2337 return getTrailingObjects<Expr *>()[Idx];
2341 assert(Idx < NumComps &&
"Subscript out of range");
2342 getTrailingObjects<Expr *>()[Idx] = E;
2358 Stmt **begin =
reinterpret_cast<Stmt **
>(getTrailingObjects<Expr *>());
2362 Stmt *
const *begin =
2363 reinterpret_cast<Stmt *
const *
>(getTrailingObjects<Expr *>());
2386 TInfo->getType()->isDependentType(),
2387 TInfo->getType()->isInstantiationDependentType(),
2388 TInfo->getType()->containsUnexpandedParameterPack()),
2389 OpLoc(op), RParenLoc(rp) {
2390 UnaryExprOrTypeTraitExprBits.Kind = ExprKind;
2391 UnaryExprOrTypeTraitExprBits.IsType =
true;
2392 Argument.Ty = TInfo;
2401 :
Expr(UnaryExprOrTypeTraitExprClass, Empty) { }
2410 return getArgumentTypeInfo()->getType();
2413 assert(isArgumentType() &&
"calling getArgumentType() when arg is expr");
2417 assert(!isArgumentType() &&
"calling getArgumentExpr() when arg is type");
2418 return static_cast<Expr*
>(Argument.Ex);
2426 UnaryExprOrTypeTraitExprBits.IsType =
false;
2429 Argument.Ty = TInfo;
2430 UnaryExprOrTypeTraitExprBits.IsType =
true;
2436 return isArgumentType() ? getArgumentType() : getArgumentExpr()->getType();
2449 return T->
getStmtClass() == UnaryExprOrTypeTraitExprClass;
2463 enum { LHS, RHS, END_EXPR };
2464 Stmt *SubExprs[END_EXPR];
2466 bool lhsIsBase()
const {
return getRHS()->getType()->isIntegerType(); }
2472 :
Expr(ArraySubscriptExprClass, t, VK, OK,
2473 lhs->isTypeDependent() || rhs->isTypeDependent(),
2474 lhs->isValueDependent() || rhs->isValueDependent(),
2475 (lhs->isInstantiationDependent() ||
2476 rhs->isInstantiationDependent()),
2477 (lhs->containsUnexpandedParameterPack() ||
2478 rhs->containsUnexpandedParameterPack())) {
2479 SubExprs[LHS] = lhs;
2480 SubExprs[RHS] = rhs;
2481 ArraySubscriptExprBits.RBracketLoc = rbracketloc;
2486 :
Expr(ArraySubscriptExprClass, Shell) { }
2506 const Expr *
getBase()
const {
return lhsIsBase() ? getLHS() : getRHS(); }
2509 const Expr *
getIdx()
const {
return lhsIsBase() ? getRHS() : getLHS(); }
2512 return getLHS()->getBeginLoc();
2517 return ArraySubscriptExprBits.RBracketLoc;
2520 ArraySubscriptExprBits.RBracketLoc = L;
2524 return getBase()->getExprLoc();
2533 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
2547 enum { FN = 0, PREARGS_START = 1 };
2556 void updateDependenciesFromArg(
Expr *Arg);
2580 Stmt **getTrailingStmts() {
2581 return reinterpret_cast<Stmt **
>(
reinterpret_cast<char *
>(
this) +
2582 CallExprBits.OffsetToTrailingObjects);
2584 Stmt *
const *getTrailingStmts()
const {
2585 return const_cast<CallExpr *
>(
this)->getTrailingStmts();
2590 static unsigned offsetToTrailingObjects(
StmtClass SC);
2611 return (1 + NumPreArgs + NumArgs) *
sizeof(
Stmt *);
2615 assert(I < getNumPreArgs() &&
"Prearg access out of range!");
2616 return getTrailingStmts()[PREARGS_START + I];
2619 assert(I < getNumPreArgs() &&
"Prearg access out of range!");
2620 return getTrailingStmts()[PREARGS_START + I];
2623 assert(I < getNumPreArgs() &&
"Prearg access out of range!");
2624 getTrailingStmts()[PREARGS_START + I] = PreArg;
2668 return static_cast<ADLCallKind>(CallExprBits.UsesADL);
2671 CallExprBits.UsesADL =
static_cast<bool>(
V);
2673 bool usesADL()
const {
return getADLCallKind() == UsesADL; }
2677 return getCallee()->getReferencedDeclOfCallee();
2682 return dyn_cast_or_null<FunctionDecl>(getCalleeDecl());
2685 return dyn_cast_or_null<FunctionDecl>(getCalleeDecl());
2693 return reinterpret_cast<Expr **
>(getTrailingStmts() + PREARGS_START +
2697 return reinterpret_cast<const Expr *
const *
>(
2698 getTrailingStmts() + PREARGS_START + getNumPreArgs());
2703 assert(Arg < getNumArgs() &&
"Arg access out of range!");
2704 return getArgs()[Arg];
2707 assert(Arg < getNumArgs() &&
"Arg access out of range!");
2708 return getArgs()[Arg];
2713 assert(Arg < getNumArgs() &&
"Arg access out of range!");
2714 getArgs()[Arg] = ArgExpr;
2724 assert((NewNumArgs <= getNumArgs()) &&
2725 "shrinkNumArgs cannot increase the number of arguments!");
2726 NumArgs = NewNumArgs;
2739 arg_range
arguments() {
return arg_range(arg_begin(), arg_end()); }
2741 return const_arg_range(arg_begin(), arg_end());
2745 return getTrailingStmts() + PREARGS_START + getNumPreArgs();
2747 arg_iterator
arg_end() {
return arg_begin() + getNumArgs(); }
2750 return getTrailingStmts() + PREARGS_START + getNumPreArgs();
2752 const_arg_iterator
arg_end()
const {
return arg_begin() + getNumArgs(); }
2759 return llvm::makeArrayRef(getTrailingStmts(),
2760 PREARGS_START + getNumPreArgs() + getNumArgs());
2765 unsigned getNumCommas()
const {
return getNumArgs() ? getNumArgs() - 1 : 0; }
2769 unsigned getBuiltinCallee()
const;
2773 bool isUnevaluatedBuiltinCall(
const ASTContext &Ctx)
const;
2786 return getUnusedResultAttr(Ctx) !=
nullptr;
2812 return child_range(getTrailingStmts(), getTrailingStmts() + PREARGS_START +
2813 getNumPreArgs() + getNumArgs());
2818 getTrailingStmts() + PREARGS_START +
2819 getNumPreArgs() + getNumArgs());
2839 ASTTemplateKWAndArgsInfo,
2840 TemplateArgumentLoc> {
2861 size_t numTrailingObjects(OverloadToken<MemberExprNameQualifier>)
const {
2862 return hasQualifierOrFoundDecl();
2865 size_t numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>)
const {
2866 return hasTemplateKWAndArgsInfo();
2869 bool hasQualifierOrFoundDecl()
const {
2870 return MemberExprBits.HasQualifierOrFoundDecl;
2873 bool hasTemplateKWAndArgsInfo()
const {
2874 return MemberExprBits.HasTemplateKWAndArgsInfo;
2882 :
Expr(MemberExprClass, Empty), Base(), MemberDecl() {}
2909 bool HasTemplateKWAndArgsInfo,
2910 unsigned NumTemplateArgs);
2924 if (!hasQualifierOrFoundDecl())
2926 getMemberDecl()->getAccess());
2927 return getTrailingObjects<MemberExprNameQualifier>()->FoundDecl;
2939 if (!hasQualifierOrFoundDecl())
2941 return getTrailingObjects<MemberExprNameQualifier>()->QualifierLoc;
2948 return getQualifierLoc().getNestedNameSpecifier();
2954 if (!hasTemplateKWAndArgsInfo())
2956 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->TemplateKWLoc;
2962 if (!hasTemplateKWAndArgsInfo())
2964 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->LAngleLoc;
2970 if (!hasTemplateKWAndArgsInfo())
2972 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->RAngleLoc;
2985 if (hasExplicitTemplateArgs())
2986 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->copyInto(
2987 getTrailingObjects<TemplateArgumentLoc>(), List);
2993 if (!hasExplicitTemplateArgs())
2996 return getTrailingObjects<TemplateArgumentLoc>();
3002 if (!hasExplicitTemplateArgs())
3005 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->NumTemplateArgs;
3009 return {getTemplateArgs(), getNumTemplateArgs()};
3015 MemberLoc, MemberDNLoc);
3020 bool isArrow()
const {
return MemberExprBits.IsArrow; }
3035 return getBase() && getBase()->isImplicitCXXThis();
3041 return MemberExprBits.HadMultipleCandidates;
3047 MemberExprBits.HadMultipleCandidates =
V;
3055 return LO.AppleKext || !hasQualifier();
3086 llvm::PointerIntPair<TypeSourceInfo *, 1, bool> TInfoAndScope;
3092 tinfo->getType()->isDependentType(),
3093 init->isValueDependent(),
3094 (init->isInstantiationDependent() ||
3095 tinfo->getType()->isInstantiationDependentType()),
3096 init->containsUnexpandedParameterPack()),
3097 LParenLoc(lparenloc), TInfoAndScope(tinfo, fileScope), Init(init) {}
3101 :
Expr(CompoundLiteralExprClass, Empty) { }
3114 return TInfoAndScope.getPointer();
3117 TInfoAndScope.setPointer(tinfo);
3153 bool CastConsistency()
const;
3156 return const_cast<CastExpr*
>(
this)->path_buffer();
3162 Expr *op,
unsigned BasePathSize)
3166 ty->isDependentType(),
3169 ty->isDependentType() || (op && op->isValueDependent()),
3170 (ty->isInstantiationDependentType() ||
3171 (op && op->isInstantiationDependent())),
3174 ((SC != ImplicitCastExprClass &&
3175 ty->containsUnexpandedParameterPack()) ||
3176 (op && op->containsUnexpandedParameterPack()))),
3178 CastExprBits.Kind =
kind;
3179 CastExprBits.PartOfExplicitCast =
false;
3180 CastExprBits.BasePathSize = BasePathSize;
3181 assert((CastExprBits.BasePathSize == BasePathSize) &&
3182 "BasePathSize overflow!");
3183 assert(CastConsistency());
3189 CastExprBits.PartOfExplicitCast =
false;
3190 CastExprBits.BasePathSize = BasePathSize;
3191 assert((CastExprBits.BasePathSize == BasePathSize) &&
3192 "BasePathSize overflow!");
3199 static const char *getCastKindName(
CastKind CK);
3209 Expr *getSubExprAsWritten();
3211 return const_cast<CastExpr *
>(
this)->getSubExprAsWritten();
3216 NamedDecl *getConversionFunction()
const;
3221 unsigned path_size()
const {
return CastExprBits.BasePathSize; }
3223 path_iterator
path_end() {
return path_buffer() + path_size(); }
3225 path_const_iterator
path_end()
const {
return path_buffer() + path_size(); }
3227 llvm::iterator_range<path_iterator>
path() {
3228 return llvm::make_range(path_begin(), path_end());
3230 llvm::iterator_range<path_const_iterator>
path()
const {
3231 return llvm::make_range(path_begin(), path_end());
3235 assert(getCastKind() == CK_ToUnion);
3236 return getTargetFieldForToUnionCast(getType(), getSubExpr()->getType());
3280 :
CastExpr(ImplicitCastExprClass, ty, VK, kind, op, BasePathLength) { }
3283 explicit ImplicitCastExpr(
EmptyShell Shell,
unsigned PathSize)
3284 :
CastExpr(ImplicitCastExprClass, Shell, PathSize) { }
3290 :
CastExpr(ImplicitCastExprClass, ty, VK, kind, op, 0) {
3295 CastExprBits.PartOfExplicitCast = PartOfExplicitCast;
3307 return getSubExpr()->getBeginLoc();
3310 return getSubExpr()->getEndLoc();
3346 :
CastExpr(SC, exprTy, VK, kind, op, PathSize), TInfo(writtenTy) {}
3350 :
CastExpr(SC, Shell, PathSize) { }
3363 return T->
getStmtClass() >= firstExplicitCastExprConstant &&
3381 writtenTy), LPLoc(l), RPLoc(r) {}
3405 return getSubExpr()->getEndLoc();
3435 enum { LHS, RHS, END_EXPR };
3436 Stmt *SubExprs[END_EXPR];
3444 :
Expr(BinaryOperatorClass, ResTy, VK, OK,
3445 lhs->isTypeDependent() || rhs->isTypeDependent(),
3446 lhs->isValueDependent() || rhs->isValueDependent(),
3447 (lhs->isInstantiationDependent() ||
3448 rhs->isInstantiationDependent()),
3449 (lhs->containsUnexpandedParameterPack() ||
3450 rhs->containsUnexpandedParameterPack())) {
3451 BinaryOperatorBits.Opc = opc;
3452 BinaryOperatorBits.FPFeatures = FPFeatures.
getInt();
3453 BinaryOperatorBits.OpLoc = opLoc;
3454 SubExprs[LHS] = lhs;
3455 SubExprs[RHS] = rhs;
3456 assert(!isCompoundAssignmentOp() &&
3457 "Use CompoundAssignOperator for compound assignments");
3462 BinaryOperatorBits.Opc = BO_Comma;
3470 return static_cast<Opcode
>(BinaryOperatorBits.Opc);
3472 void setOpcode(Opcode Opc) { BinaryOperatorBits.Opc = Opc; }
3480 return getLHS()->getBeginLoc();
3483 return getRHS()->getEndLoc();
3488 static StringRef getOpcodeStr(Opcode Op);
3502 return Opc == BO_PtrMemD || Opc == BO_PtrMemI;
3507 return Opc >= BO_Mul && Opc <= BO_Rem;
3510 static bool isAdditiveOp(Opcode Opc) {
return Opc == BO_Add || Opc==BO_Sub; }
3512 static bool isShiftOp(Opcode Opc) {
return Opc == BO_Shl || Opc == BO_Shr; }
3515 static bool isBitwiseOp(Opcode Opc) {
return Opc >= BO_And && Opc <= BO_Or; }
3521 static bool isEqualityOp(Opcode Opc) {
return Opc == BO_EQ || Opc == BO_NE; }
3527 static bool isCommaOp(Opcode Opc) {
return Opc == BO_Comma; }
3533 llvm_unreachable(
"Not a comparison operator.");
3534 case BO_LT:
return BO_GE;
3535 case BO_GT:
return BO_LE;
3536 case BO_LE:
return BO_GT;
3537 case BO_GE:
return BO_LT;
3538 case BO_EQ:
return BO_NE;
3539 case BO_NE:
return BO_EQ;
3546 llvm_unreachable(
"Not a comparison operator.");
3547 case BO_LT:
return BO_GT;
3548 case BO_GT:
return BO_LT;
3549 case BO_LE:
return BO_GE;
3550 case BO_GE:
return BO_LE;
3557 static bool isLogicalOp(Opcode Opc) {
return Opc == BO_LAnd || Opc==BO_LOr; }
3561 return Opc >= BO_Assign && Opc <= BO_OrAssign;
3566 return Opc > BO_Assign && Opc <= BO_OrAssign;
3569 return isCompoundAssignmentOp(getOpcode());
3572 assert(isCompoundAssignmentOp(Opc));
3573 if (Opc >= BO_AndAssign)
3574 return Opcode(
unsigned(Opc) - BO_AndAssign + BO_And);
3576 return Opcode(
unsigned(Opc) - BO_MulAssign + BO_Mul);
3580 return Opc == BO_ShlAssign || Opc == BO_ShrAssign;
3583 return isShiftAssignOp(getOpcode());
3589 static bool isNullPointerArithmeticExtension(
ASTContext &Ctx, Opcode Opc,
3593 return S->
getStmtClass() >= firstBinaryOperatorConstant &&
3599 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
3608 BinaryOperatorBits.FPFeatures = F.
getInt();
3612 return FPOptions(BinaryOperatorBits.FPFeatures);
3618 return getFPFeatures().allowFPContractWithinStatement();
3629 :
Expr(CompoundAssignOperatorClass, ResTy, VK, OK,
3630 lhs->isTypeDependent() || rhs->isTypeDependent(),
3631 lhs->isValueDependent() || rhs->isValueDependent(),
3632 (lhs->isInstantiationDependent() ||
3633 rhs->isInstantiationDependent()),
3634 (lhs->containsUnexpandedParameterPack() ||
3635 rhs->containsUnexpandedParameterPack())) {
3636 BinaryOperatorBits.Opc = opc;
3637 BinaryOperatorBits.FPFeatures = FPFeatures.
getInt();
3638 BinaryOperatorBits.OpLoc = opLoc;
3639 SubExprs[LHS] = lhs;
3640 SubExprs[RHS] = rhs;
3644 BinaryOperatorBits.Opc = BO_MulAssign;
3662 :
BinaryOperator(lhs, rhs, opc, ResType, VK, OK, OpLoc, FPFeatures,
3664 ComputationLHSType(CompLHSType),
3665 ComputationResultType(CompResultType) {
3666 assert(isCompoundAssignmentOp() &&
3667 "Only should be used for compound assignments");
3684 return S->
getStmtClass() == CompoundAssignOperatorClass;
3697 bool TD,
bool VD,
bool ID,
3698 bool ContainsUnexpandedParameterPack,
3701 :
Expr(SC, T, VK, OK, TD, VD, ID, ContainsUnexpandedParameterPack),
3702 QuestionLoc(qloc), ColonLoc(cloc) {}
3705 :
Expr(SC, Empty) { }
3710 Expr *getCond()
const;
3714 Expr *getTrueExpr()
const;
3719 Expr *getFalseExpr()
const;
3725 return T->
getStmtClass() == ConditionalOperatorClass ||
3733 enum { COND, LHS, RHS, END_EXPR };
3734 Stmt* SubExprs[END_EXPR];
3742 ConditionalOperatorClass, t, VK, OK,
3747 (cond->isTypeDependent() || lhs->isTypeDependent() ||
3748 rhs->isTypeDependent()),
3749 (cond->isValueDependent() || lhs->isValueDependent() ||
3750 rhs->isValueDependent()),
3751 (cond->isInstantiationDependent() ||
3752 lhs->isInstantiationDependent() ||
3753 rhs->isInstantiationDependent()),
3754 (cond->containsUnexpandedParameterPack() ||
3755 lhs->containsUnexpandedParameterPack() ||
3756 rhs->containsUnexpandedParameterPack()),
3758 SubExprs[COND] = cond;
3759 SubExprs[LHS] = lhs;
3760 SubExprs[RHS] = rhs;
3784 return getCond()->getBeginLoc();
3787 return getRHS()->getEndLoc();
3796 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
3809 enum { COMMON, COND, LHS, RHS, NUM_SUBEXPRS };
3816 Stmt *SubExprs[NUM_SUBEXPRS];
3826 (common->isTypeDependent() || rhs->isTypeDependent()),
3827 (common->isValueDependent() || rhs->isValueDependent()),
3828 (common->isInstantiationDependent() ||
3829 rhs->isInstantiationDependent()),
3830 (common->containsUnexpandedParameterPack() ||
3831 rhs->containsUnexpandedParameterPack()),
3833 OpaqueValue(opaqueValue) {
3834 SubExprs[COMMON] = common;
3835 SubExprs[COND] = cond;
3836 SubExprs[LHS] = lhs;
3837 SubExprs[RHS] = rhs;
3838 assert(OpaqueValue->
getSourceExpr() == common &&
"Wrong opaque value");
3861 return cast<Expr>(SubExprs[LHS]);
3868 return cast<Expr>(SubExprs[RHS]);
3872 return getCommon()->getBeginLoc();
3875 return getFalseExpr()->getEndLoc();
3879 return T->
getStmtClass() == BinaryConditionalOperatorClass;
3884 return child_range(SubExprs, SubExprs + NUM_SUBEXPRS);
3893 return co->getCond();
3894 return cast<BinaryConditionalOperator>(
this)->getCond();
3899 return co->getTrueExpr();
3900 return cast<BinaryConditionalOperator>(
this)->getTrueExpr();
3905 return co->getFalseExpr();
3906 return cast<BinaryConditionalOperator>(
this)->getFalseExpr();
3918 AmpAmpLoc(AALoc), LabelLoc(LLoc), Label(L) {}
3922 :
Expr(AddrLabelExprClass, Empty) { }
3965 SubStmt(substmt), LParenLoc(lp), RParenLoc(rp) { }
4015 :
Expr(ShuffleVectorExprClass, Empty), SubExprs(nullptr) { }
4040 assert((Index < NumExprs) &&
"Arg access out of range!");
4041 return cast<Expr>(SubExprs[Index]);
4044 assert((Index < NumExprs) &&
"Arg access out of range!");
4045 return cast<Expr>(SubExprs[Index]);
4051 assert((N < NumExprs - 2) &&
"Shuffle idx out of range!");
4052 return getExpr(N+2)->EvaluateKnownConstInt(Ctx);
4057 return child_range(&SubExprs[0], &SubExprs[0]+NumExprs);
4081 :
Expr(ConvertVectorExprClass, DstType, VK, OK,
4082 DstType->isDependentType(),
4083 DstType->isDependentType() || SrcExpr->isValueDependent(),
4084 (DstType->isInstantiationDependentType() ||
4085 SrcExpr->isInstantiationDependent()),
4086 (DstType->containsUnexpandedParameterPack() ||
4087 SrcExpr->containsUnexpandedParameterPack())),
4088 SrcExpr(SrcExpr), TInfo(TI), BuiltinLoc(BuiltinLoc), RParenLoc(RParenLoc) {}
4131 enum { COND, LHS, RHS, END_EXPR };
4132 Stmt* SubExprs[END_EXPR];
4139 bool TypeDependent,
bool ValueDependent)
4140 :
Expr(ChooseExprClass, t, VK, OK, TypeDependent, ValueDependent,
4141 (cond->isInstantiationDependent() ||
4142 lhs->isInstantiationDependent() ||
4143 rhs->isInstantiationDependent()),
4144 (cond->containsUnexpandedParameterPack() ||
4145 lhs->containsUnexpandedParameterPack() ||
4146 rhs->containsUnexpandedParameterPack())),
4147 BuiltinLoc(BLoc), RParenLoc(RP), CondIsTrue(condIsTrue) {
4148 SubExprs[COND] = cond;
4149 SubExprs[LHS] = lhs;
4150 SubExprs[RHS] = rhs;
4159 assert(!isConditionDependent() &&
4160 "Dependent condition isn't true or false");
4166 return getCond()->isTypeDependent() || getCond()->isValueDependent();
4172 return isConditionTrue() ? getLHS() : getRHS();
4197 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
4246 llvm::PointerIntPair<TypeSourceInfo *, 1, bool> TInfo;
4252 false, (TInfo->getType()->isInstantiationDependentType() ||
4253 e->isInstantiationDependent()),
4254 (TInfo->getType()->containsUnexpandedParameterPack() ||
4255 e->containsUnexpandedParameterPack())),
4256 Val(e), TInfo(TInfo, IsMS), BuiltinLoc(BLoc), RParenLoc(RPLoc) {}
4260 :
Expr(VAArgExprClass, Empty), Val(nullptr), TInfo(nullptr,
false) {}
4311 const Expr *DefaultExpr)
const;
4314 StringRef getBuiltinStr()
const;
4317 return static_cast<IdentKind>(SourceLocExprBits.Kind);
4321 switch (getIdentKind()) {
4329 llvm_unreachable(
"unknown source location expression kind");
4331 bool isIntType() const LLVM_READONLY {
return !isStringType(); }
4406 InitExprsTy InitExprs;
4414 llvm::PointerIntPair<InitListExpr *, 1, bool> AltForm;
4423 llvm::PointerUnion<Expr *, FieldDecl *> ArrayFillerOrUnionFieldInit;
4431 :
Expr(InitListExprClass, Empty), AltForm(nullptr,
true) { }
4440 return reinterpret_cast<Expr *
const *
>(InitExprs.
data());
4444 return llvm::makeArrayRef(
getInits(), getNumInits());
4448 return llvm::makeArrayRef(
getInits(), getNumInits());
4452 assert(Init < getNumInits() &&
"Initializer access out of range!");
4453 return cast_or_null<Expr>(InitExprs[Init]);
4457 assert(Init < getNumInits() &&
"Initializer access out of range!");
4458 return cast_or_null<Expr>(InitExprs[Init]);
4462 assert(Init < getNumInits() &&
"Initializer access out of range!");
4463 InitExprs[Init] =
expr;
4469 ExprBits.ContainsUnexpandedParameterPack |=
4475 void reserveInits(
const ASTContext &C,
unsigned NumInits);
4483 void resizeInits(
const ASTContext &Context,
unsigned NumInits);
4498 return ArrayFillerOrUnionFieldInit.dyn_cast<
Expr *>();
4501 return const_cast<InitListExpr *
>(
this)->getArrayFiller();
4503 void setArrayFiller(
Expr *filler);
4516 return ArrayFillerOrUnionFieldInit.dyn_cast<
FieldDecl *>();
4519 return const_cast<InitListExpr *
>(
this)->getInitializedFieldInUnion();
4522 assert((FD ==
nullptr 4523 || getInitializedFieldInUnion() ==
nullptr 4524 || getInitializedFieldInUnion() == FD)
4525 &&
"Only one field of a union may be initialized at a time!");
4526 ArrayFillerOrUnionFieldInit = FD;
4539 bool isStringLiteralInit()
const;
4544 bool isTransparent()
const;
4548 bool isIdiomaticZeroInitializer(
const LangOptions &LangOpts)
const;
4557 return isSemanticForm() ? nullptr : AltForm.getPointer();
4560 return !AltForm.getInt() || !AltForm.getPointer();
4563 return isSemanticForm() ? AltForm.getPointer() :
nullptr;
4567 AltForm.setPointer(Init);
4568 AltForm.setInt(
true);
4569 Init->AltForm.setPointer(
this);
4570 Init->AltForm.setInt(
false);
4574 return InitListExprBits.HadArrayRangeDesignator != 0;
4577 InitListExprBits.HadArrayRangeDesignator = ARD;
4596 if (InitExprs.
empty())
4609 const_iterator
end()
const {
return InitExprs.
end(); }
4613 const_reverse_iterator
rend()
const {
return InitExprs.
rend(); }
4653 unsigned GNUSyntax : 1;
4656 unsigned NumDesignators : 15;
4661 unsigned NumSubExprs : 16;
4674 NumDesignators(0), NumSubExprs(NumSubExprs), Designators(
nullptr) { }
4719 ArrayRangeDesignator
4737 Field.NameOrField =
reinterpret_cast<uintptr_t>(FieldName) | 0x01;
4745 : Kind(ArrayDesignator) {
4746 ArrayOrRange.
Index = Index;
4755 : Kind(ArrayRangeDesignator) {
4756 ArrayOrRange.
Index = Index;
4769 assert(Kind ==
FieldDesignator &&
"Only valid on a field designator");
4770 if (
Field.NameOrField & 0x01)
4777 assert(Kind ==
FieldDesignator &&
"Only valid on a field designator");
4782 assert(Kind ==
FieldDesignator &&
"Only valid on a field designator");
4787 assert(Kind ==
FieldDesignator &&
"Only valid on a field designator");
4792 assert((Kind == ArrayDesignator || Kind == ArrayRangeDesignator) &&
4793 "Only valid on an array or array-range designator");
4798 assert((Kind == ArrayDesignator || Kind == ArrayRangeDesignator) &&
4799 "Only valid on an array or array-range designator");
4804 assert(Kind == ArrayRangeDesignator &&
4805 "Only valid on an array-range designator");
4810 assert((Kind == ArrayDesignator || Kind == ArrayRangeDesignator) &&
4811 "Only valid on an array or array-range designator");
4812 return ArrayOrRange.
Index;
4817 return getDotLoc().
isInvalid()? getFieldLoc() : getDotLoc();
4819 return getLBracketLoc();
4833 bool GNUSyntax,
Expr *Init);
4836 unsigned NumIndexExprs);
4839 unsigned size()
const {
return NumDesignators; }
4843 return {Designators, NumDesignators};
4847 return {Designators, NumDesignators};
4852 return &designators()[Idx];
4856 unsigned NumDesigs);
4882 *child_begin() = init;
4892 assert(Idx < NumSubExprs &&
"Subscript out of range");
4893 return cast<Expr>(getTrailingObjects<Stmt *>()[Idx]);
4897 assert(Idx < NumSubExprs &&
"Subscript out of range");
4898 getTrailingObjects<Stmt *>()[Idx] = E;
4903 void ExpandDesignator(
const ASTContext &C,
unsigned Idx,
4917 Stmt **begin = getTrailingObjects<Stmt *>();
4921 Stmt *
const *begin = getTrailingObjects<Stmt *>();
4944 :
Expr(NoInitExprClass, Empty) { }
4976 Stmt *BaseAndUpdaterExprs[2];
4983 :
Expr(DesignatedInitUpdateExprClass, Empty) { }
4989 return T->
getStmtClass() == DesignatedInitUpdateExprClass;
4996 return cast<InitListExpr>(BaseAndUpdaterExprs[1]);
5003 return child_range(&BaseAndUpdaterExprs[0], &BaseAndUpdaterExprs[0] + 2);
5007 &BaseAndUpdaterExprs[0] + 2);
5031 :
Expr(ArrayInitLoopExprClass, Empty), SubExprs{} {}
5036 CommonInit->isValueDependent() || ElementInit->isValueDependent(),
5037 T->isInstantiationDependentType(),
5038 CommonInit->containsUnexpandedParameterPack() ||
5039 ElementInit->containsUnexpandedParameterPack()),
5040 SubExprs{CommonInit, ElementInit} {}
5045 return cast<OpaqueValueExpr>(SubExprs[0]);
5052 return cast<ConstantArrayType>(getType()->castAsArrayTypeUnsafe())
5061 return getCommonExpr()->getBeginLoc();
5064 return getCommonExpr()->getEndLoc();
5084 :
Expr(ArrayInitIndexExprClass, Empty) {}
5125 :
Expr(ImplicitValueInitExprClass, Empty) { }
5128 return T->
getStmtClass() == ImplicitValueInitExprClass;
5172 assert(Init < getNumExprs() &&
"Initializer access out of range!");
5173 return getExprs()[Init];
5181 return reinterpret_cast<Expr **
>(getTrailingObjects<Stmt *>());
5185 return llvm::makeArrayRef(getExprs(), getNumExprs());
5200 getTrailingObjects<Stmt *>() + getNumExprs());
5204 getTrailingObjects<Stmt *>() + getNumExprs());
5246 unsigned NumAssocs, ResultIndex;
5249 ControllingIndex = 0,
5250 AssocExprStartIndex = 1
5263 unsigned numTrailingObjects(OverloadToken<Stmt *>)
const {
5266 return 1 + getNumAssocs();
5269 unsigned numTrailingObjects(OverloadToken<TypeSourceInfo *>)
const {
5270 return getNumAssocs();
5273 template <
bool Const>
class AssociationIteratorTy;
5277 template <
bool Const>
class AssociationTy {
5279 template <
bool OtherConst>
friend class AssociationIteratorTy;
5287 AssociationTy(ExprPtrTy E, TSIPtrTy TSI,
bool Selected)
5288 : E(E), TSI(TSI), Selected(Selected) {}
5291 ExprPtrTy getAssociationExpr()
const {
return E; }
5292 TSIPtrTy getTypeSourceInfo()
const {
return TSI; }
5294 bool isSelected()
const {
return Selected; }
5295 AssociationTy *operator->() {
return this; }
5296 const AssociationTy *operator->()
const {
return this; }
5303 template <
bool Const>
5304 class AssociationIteratorTy
5305 :
public llvm::iterator_facade_base<
5306 AssociationIteratorTy<Const>, std::input_iterator_tag,
5307 AssociationTy<Const>, std::ptrdiff_t, AssociationTy<Const>,
5308 AssociationTy<Const>> {
5323 using BaseTy =
typename AssociationIteratorTy::iterator_facade_base;
5324 using StmtPtrPtrTy =
5327 typename std::conditional<
Const,
const TypeSourceInfo *
const *,
5328 TypeSourceInfo **>
::type;
5331 unsigned Offset = 0, SelectedOffset = 0;
5332 AssociationIteratorTy(StmtPtrPtrTy E, TSIPtrPtrTy TSI,
unsigned Offset,
5333 unsigned SelectedOffset)
5334 : E(E), TSI(TSI), Offset(Offset), SelectedOffset(SelectedOffset) {}
5337 AssociationIteratorTy() : E(nullptr), TSI(nullptr) {}
5338 typename BaseTy::reference
operator*()
const {
5339 return AssociationTy<Const>(cast<Expr>(*E), *TSI,
5340 Offset == SelectedOffset);
5342 typename BaseTy::pointer operator->()
const {
return **
this; }
5343 using BaseTy::operator++;
5344 AssociationIteratorTy &operator++() {
5350 bool operator==(AssociationIteratorTy Other)
const {
return E == Other.E; }
5355 Expr *ControllingExpr,
5359 bool ContainsUnexpandedParameterPack,
5360 unsigned ResultIndex);
5364 Expr *ControllingExpr,
5368 bool ContainsUnexpandedParameterPack);
5380 unsigned ResultIndex);
5391 unsigned NumAssocs);
5399 llvm::iterator_range<ConstAssociationIterator>;
5408 assert(!isResultDependent() &&
5409 "Generic selection is result-dependent but getResultIndex called!");
5418 return cast<Expr>(getTrailingObjects<Stmt *>()[ControllingIndex]);
5421 return cast<Expr>(getTrailingObjects<Stmt *>()[ControllingIndex]);
5428 getTrailingObjects<Stmt *>()[AssocExprStartIndex + getResultIndex()]);
5432 getTrailingObjects<Stmt *>()[AssocExprStartIndex + getResultIndex()]);
5436 return {
reinterpret_cast<Expr *
const *
>(getTrailingObjects<Stmt *>() +
5437 AssocExprStartIndex),
5441 return {getTrailingObjects<TypeSourceInfo *>(), NumAssocs};
5447 assert(I < getNumAssocs() &&
5448 "Out-of-range index in GenericSelectionExpr::getAssociation!");
5450 cast<Expr>(getTrailingObjects<Stmt *>()[AssocExprStartIndex + I]),
5451 getTrailingObjects<TypeSourceInfo *>()[I],
5452 !isResultDependent() && (getResultIndex() == I));
5455 assert(I < getNumAssocs() &&
5456 "Out-of-range index in GenericSelectionExpr::getAssociation!");
5458 cast<Expr>(getTrailingObjects<Stmt *>()[AssocExprStartIndex + I]),
5459 getTrailingObjects<TypeSourceInfo *>()[I],
5460 !isResultDependent() && (getResultIndex() == I));
5465 AssocExprStartIndex,
5466 getTrailingObjects<TypeSourceInfo *>(),
5469 NumAssocs, ResultIndex);
5470 return llvm::make_range(Begin, End);
5475 AssocExprStartIndex,
5476 getTrailingObjects<TypeSourceInfo *>(),
5479 NumAssocs, ResultIndex);
5480 return llvm::make_range(Begin, End);
5484 return GenericSelectionExprBits.GenericLoc;
5497 getTrailingObjects<Stmt *>() +
5498 numTrailingObjects(OverloadToken<Stmt *>()));
5502 getTrailingObjects<Stmt *>() +
5503 numTrailingObjects(OverloadToken<Stmt *>()));
5525 :
Expr(ExtVectorElementExprClass, ty, VK,
5527 base->isTypeDependent(), base->isValueDependent(),
5528 base->isInstantiationDependent(),
5529 base->containsUnexpandedParameterPack()),
5530 Base(base), Accessor(&accessor), AccessorLoc(loc) {}
5534 :
Expr(ExtVectorElementExprClass, Empty) { }
5547 unsigned getNumElements()
const;
5551 bool containsDuplicateElements()
const;
5558 return getBase()->getBeginLoc();
5564 bool isArrow()
const;
5585 ty->isDependentType(), ty->isDependentType(),
5586 ty->isInstantiationDependentType() || BD->isDependentContext(),
5599 const Stmt *getBody()
const;
5603 return getCaretLocation();
5630 : ExprAndFlag(CopyExpr, CanThrow) {}
5632 ExprAndFlag.setPointerAndInt(CopyExpr, CanThrow);
5655 :
Expr(AsTypeExprClass, DstType, VK, OK,
5656 DstType->isDependentType(),
5657 DstType->isDependentType() || SrcExpr->isValueDependent(),
5658 (DstType->isInstantiationDependentType() ||
5659 SrcExpr->isInstantiationDependent()),
5660 (DstType->containsUnexpandedParameterPack() ||
5661 SrcExpr->containsUnexpandedParameterPack())),
5662 SrcExpr(SrcExpr), BuiltinLoc(BuiltinLoc), RParenLoc(RParenLoc) {}
5729 Expr **getSubExprsBuffer() {
return getTrailingObjects<Expr *>(); }
5730 const Expr *
const *getSubExprsBuffer()
const {
5731 return getTrailingObjects<Expr *>();
5736 unsigned resultIndex);
5738 PseudoObjectExpr(
EmptyShell shell,
unsigned numSemanticExprs);
5740 unsigned getNumSubExprs()
const {
5741 return PseudoObjectExprBits.NumSubExprs;
5747 enum :
unsigned { NoResult = ~0U };
5751 unsigned resultIndex);
5754 unsigned numSemanticExprs);
5765 if (PseudoObjectExprBits.ResultIndex == 0)
return NoResult;
5766 return PseudoObjectExprBits.ResultIndex - 1;
5771 if (PseudoObjectExprBits.ResultIndex == 0)
5773 return getSubExprsBuffer()[PseudoObjectExprBits.ResultIndex];
5776 return const_cast<PseudoObjectExpr*
>(
this)->getResultExpr();
5784 return getSubExprsBuffer() + 1;
5787 return getSubExprsBuffer() + 1;
5790 return getSubExprsBuffer() + getNumSubExprs();
5793 return getSubExprsBuffer() + getNumSubExprs();
5797 return llvm::make_range(semantics_begin(), semantics_end());
5799 llvm::iterator_range<const_semantics_iterator>
semantics()
const {
5800 return llvm::make_range(semantics_begin(), semantics_end());
5804 assert(index + 1 < getNumSubExprs());
5805 return getSubExprsBuffer()[index + 1];
5808 return const_cast<PseudoObjectExpr*
>(
this)->getSemanticExpr(index);
5812 return getSyntacticForm()->getExprLoc();
5816 return getSyntacticForm()->getBeginLoc();
5819 return getSyntacticForm()->getEndLoc();
5824 const_cast<const PseudoObjectExpr *
>(
this)->
children();
5829 Stmt *
const *cs =
const_cast<Stmt *
const *
>(
5830 reinterpret_cast<const Stmt *
const *
>(getSubExprsBuffer()));
5852 #define BUILTIN(ID, TYPE, ATTRS) 5853 #define ATOMIC_BUILTIN(ID, TYPE, ATTRS) AO ## ID, 5854 #include "clang/Basic/Builtins.def" 5863 enum {
PTR, ORDER, VAL1, ORDER_FAIL, VAL2, WEAK, END_EXPR };
5864 Stmt *SubExprs[END_EXPR + 1];
5865 unsigned NumSubExprs;
5876 static unsigned getNumSubExprs(
AtomicOp Op);
5882 return cast<Expr>(SubExprs[
PTR]);
5885 return cast<Expr>(SubExprs[ORDER]);
5888 assert(getScopeModel() &&
"No scope");
5889 return cast<Expr>(SubExprs[NumSubExprs - 1]);
5892 if (Op == AO__c11_atomic_init || Op == AO__opencl_atomic_init)
5893 return cast<Expr>(SubExprs[ORDER]);
5894 assert(NumSubExprs > VAL1);
5895 return cast<Expr>(SubExprs[VAL1]);
5898 assert(NumSubExprs > ORDER_FAIL);
5899 return cast<Expr>(SubExprs[ORDER_FAIL]);
5902 if (Op == AO__atomic_exchange)
5903 return cast<Expr>(SubExprs[ORDER_FAIL]);
5904 assert(NumSubExprs > VAL2);
5905 return cast<Expr>(SubExprs[VAL2]);
5908 assert(NumSubExprs > WEAK);
5909 return cast<Expr>(SubExprs[WEAK]);
5918 return reinterpret_cast<Expr *
const *
>(SubExprs);
5922 return getPtr()->getType()->getPointeeType().isVolatileQualified();
5926 return getOp() == AO__c11_atomic_compare_exchange_strong ||
5927 getOp() == AO__c11_atomic_compare_exchange_weak ||
5928 getOp() == AO__opencl_atomic_compare_exchange_strong ||
5929 getOp() == AO__opencl_atomic_compare_exchange_weak ||
5930 getOp() == AO__atomic_compare_exchange ||
5931 getOp() == AO__atomic_compare_exchange_n;
5935 return getOp() >= AO__opencl_atomic_init &&
5936 getOp() <= AO__opencl_atomic_fetch_max;
5951 return child_range(SubExprs, SubExprs+NumSubExprs);
5962 (Op >= AO__opencl_atomic_load && Op <= AO__opencl_atomic_fetch_max)
5972 return getScopeModel(getOp());
5986 assert(T->
isDependentType() &&
"TypoExpr given a non-dependent type");
6006 #endif // LLVM_CLANG_AST_EXPR_H void setFPFeatures(FPOptions F)
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
unsigned getNumSemanticExprs() const
const Expr * getSubExpr() const
bool hasArrayFiller() const
Return true if this is an array initializer and its array "filler" has been set.
Represents a single C99 designator.
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
SourceLocation getBeginLoc() const LLVM_READONLY
void setValueDependent(bool VD)
Set whether this expression is value-dependent or not.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const BlockDecl * getBlockDecl() const
const_child_range children() const
bool isCallToStdMove() const
bool isIncrementOp() const
Expr * getChosenSubExpr() const
getChosenSubExpr - Return the subexpression chosen according to the condition.
const_child_range children() const
Represents a function declaration or definition.
NamedDecl * getFoundDecl()
Get the NamedDecl through which this reference occurred.
const StringLiteral * getFunctionName() const
void setSubStmt(CompoundStmt *S)
const Expr * IgnoreParenLValueCasts() const
const Expr * IgnoreParens() const
Expr ** getArgs()
Retrieve the call arguments.
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
BlockExpr(EmptyShell Empty)
Build an empty block expression.
ImplicitCastExpr(OnStack_t _, QualType ty, CastKind kind, Expr *op, ExprValueKind VK)
Expr * getSyntacticForm()
Return the syntactic form of this expression, i.e.
SourceLocation getEndLoc() const LLVM_READONLY
bool hasTemplateKeyword() const
Determines whether the member name was preceded by the template keyword.
reverse_iterator rbegin()
SourceLocation getRParenLoc() const
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
unsigned getRawEncoding() const
When a SourceLocation itself cannot be used, this returns an (opaque) 32-bit integer encoding for it...
const Expr * getIdx() const
A (possibly-)qualified type.
SourceLocation getEndLoc() const LLVM_READONLY
StringKind getKind() const
ResultStorageKind
Describes the kind of result that can be trail-allocated.
enum clang::SubobjectAdjustment::@49 Kind
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
void setOperatorLoc(SourceLocation L)
static Opcode getOpForCompoundAssignment(Opcode Opc)
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
SourceLocation getExprLoc() const
Defines enumerations for the type traits support.
SourceLocation getLParen() const
Get the location of the left parentheses '('.
SourceLocation getEndLoc() const LLVM_READONLY
Expr(StmtClass SC, QualType T, ExprValueKind VK, ExprObjectKind OK, bool TD, bool VD, bool ID, bool ContainsUnexpandedParameterPack)
const_association_range associations() const
bool operator==(CanQual< T > x, CanQual< U > y)
Expr * getExpr(unsigned Index)
getExpr - Return the Expr at the specified index.
llvm::APFloat getValue(const llvm::fltSemantics &Semantics) const
Designator(unsigned Index, SourceLocation LBracketLoc, SourceLocation RBracketLoc)
Initializes an array designator.
unsigned FieldLoc
The location of the field name in the designated initializer.
CharacterLiteral(EmptyShell Empty)
Construct an empty character literal.
unsigned getNumSubExprs() const
getNumSubExprs - Return the size of the SubExprs array.
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.
CompoundStmt * getSubStmt()
InitExprsTy::const_iterator const_iterator
SourceLocation getEndLoc() const LLVM_READONLY
const Expr * getInit(unsigned Init) const
const DeclContext * getParentContext() const
If the SourceLocExpr has been resolved return the subexpression representing the resolved value...
static bool classof(const Stmt *S)
Designator(const IdentifierInfo *FieldName, SourceLocation DotLoc, SourceLocation FieldLoc)
Initializes a field designator.
Expr * getControllingExpr()
Return the controlling expression of this generic selection expression.
bool containsNonAsciiOrNull() const
static bool isBuiltinAssumeFalse(const CFGBlock *B, const Stmt *S, ASTContext &C)
Expr *const * semantics_iterator
Stmt - This represents one statement.
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
CompoundLiteralExpr(EmptyShell Empty)
Construct an empty compound literal.
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
SourceLocation getRParenLoc() const
SourceLocation getLocation() const
SourceLocation getBeginLoc() const LLVM_READONLY
StmtExpr(CompoundStmt *substmt, QualType T, SourceLocation lp, SourceLocation rp)
bool isFEnvAccessOn() const
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
ArrayRef< Stmt * > getRawSubExprs()
This method provides fast access to all the subexpressions of a CallExpr without going through the sl...
C Language Family Type Representation.
static bool isMultiplicativeOp(Opcode Opc)
SourceLocation getRBracketLoc() const
void setOpcode(Opcode Opc)
const_child_range children() const
reverse_iterator rbegin()
const_child_range children() const
TypeSourceInfo * getTypeSourceInfo() const
static unsigned sizeOfTrailingObjects(unsigned NumPreArgs, unsigned NumArgs)
Return the size in bytes needed for the trailing objects.
Decl - This represents one declaration (or definition), e.g.
static bool classof(const Stmt *T)
llvm::APFloat getValue() const
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
LLVM_READNONE bool isASCII(char c)
Returns true if this is an ASCII character.
ConstExprUsage
Indicates how the constant expression will be used.
SourceLocation getBeginLoc() const LLVM_READONLY
const Expr * getSubExpr() const
const_child_range children() const
SourceLocation getEndLoc() const LLVM_READONLY
Classification Classify(ASTContext &Ctx) const
Classify - Classify this expression according to the C++11 expression taxonomy.
static bool classof(const Stmt *T)
const CastExpr * BasePath
unsigned getNumSubExprs() const
Retrieve the total number of subexpressions in this designated initializer expression, including the actual initialized value and any expressions that occur within array and array-range designators.
void setNumArgsUnsafe(unsigned NewNumArgs)
Bluntly set a new number of arguments without doing any checks whatsoever.
void setComputationResultType(QualType T)
ParenExpr - This represents a parethesized expression, e.g.
Expr * getFalseExpr() const
Is the identifier known as a GNU-style attribute?
bool hasQualifier() const
Determines whether this member expression actually had a C++ nested-name-specifier prior to the name ...
Strictly evaluate the expression.
const_arg_iterator arg_begin() const
The base class of the type hierarchy.
FullExpr(StmtClass SC, Expr *subexpr)
ImplicitValueInitExpr(QualType ty)
Expr * getCopyExpr() const
bool isSemanticForm() const
bool hasExplicitTemplateArgs() const
Determines whether this declaration reference was followed by an explicit template argument list...
llvm::iterator_range< child_iterator > child_range
SourceLocation getRParenLoc() const
CastExpr(StmtClass SC, EmptyShell Empty, unsigned BasePathSize)
Construct an empty cast.
bool isIntType() const LLVM_READONLY
static bool isShiftOp(Opcode Opc)
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
const Designator * getDesignator(unsigned Idx) const
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to...
void setADLCallKind(ADLCallKind V=UsesADL)
FPOptions getFPFeatures() const
InitExprsTy::iterator iterator
SourceLocation getLParenLoc() const
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
A container of type source information.
SourceLocation getLocation() const
SourceLocation getBeginLoc() const LLVM_READONLY
void setCanOverflow(bool C)
Floating point control options.
SourceLocation getBeginLoc() const LLVM_READONLY
IdentKind getIdentKind() const
static bool classof(const Stmt *T)
const_child_range children() const
SourceLocation getExprLoc() const LLVM_READONLY
SourceLocation getEndLoc() const LLVM_READONLY
const_child_range children() const
ShuffleVectorExpr(EmptyShell Empty)
Build an empty vector-shuffle expression.
SourceLocation getAccessorLoc() const
bool isDirectInit() const
Whether this designated initializer should result in direct-initialization of the designated subobjec...
BinaryOperator(Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy, ExprValueKind VK, ExprObjectKind OK, SourceLocation opLoc, FPOptions FPFeatures)
const Expr * getResultExpr() const
bool isImplicitAccess() const
Determine whether the base of this explicit is implicit.
SourceLocation getRParenLoc() const
getRParenLoc - Return the location of final right parenthesis.
const Expr * getSubExpr() const
Expr * getIndexExpr(unsigned Idx)
const Expr * getIndexExpr(unsigned Idx) const
const CXXBaseSpecifier *const * path_const_iterator
Represents a variable declaration or definition.
bool hasTemplateKWAndArgsInfo() const
void setIsPartOfExplicitCast(bool PartOfExplicitCast)
CompoundLiteralExpr - [C99 6.5.2.5].
void setSubExpr(unsigned Idx, Expr *E)
static bool isArithmeticOp(Opcode Op)
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
OpaqueValueExpr * getCommonExpr() const
Get the common subexpression shared by all initializations (the source array).
const T * getAs() const
Member-template getAs<specific type>'.
void setInitializer(Expr *E)
bool This(InterpState &S, CodePtr OpPC)
SourceLocation getBeginLoc() const LLVM_READONLY
const Expr * getSemanticExpr(unsigned index) const
unsigned EllipsisLoc
The location of the ellipsis separating the start and end indices.
llvm::iterator_range< arg_iterator > arg_range
SourceLocation getColonLoc() const
BlockExpr(BlockDecl *BD, QualType ty)
void setInit(unsigned Init, Expr *expr)
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...
AddrLabelExpr(EmptyShell Empty)
Build an empty address of a label expression.
void setValue(unsigned Val)
const_iterator begin() const
void setLocation(SourceLocation Location)
static bool classof(const Stmt *T)
static std::unique_ptr< AtomicScopeModel > create(AtomicScopeModelKind K)
Create an atomic scope model by AtomicScopeModelKind.
void setContainsUnexpandedParameterPack(bool PP=true)
Set the bit that describes whether this expression contains an unexpanded parameter pack...
ConditionalOperator(EmptyShell Empty)
Build an empty conditional operator.
static bool classof(const Stmt *T)
void setGNUSyntax(bool GNU)
TypeSourceInfo * getArgumentTypeInfo() const
SourceLocation getBeginLoc() const LLVM_READONLY
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range that covers this offsetof node.
bool isShiftAssignOp() const
unsigned getNumExpressions() const
SourceLocation getLocation() const
Retrieve the location of the literal.
const_child_range children() const
static bool isAssignmentOp(Opcode Opc)
SourceLocation getRParenLoc() const
SourceLocation getLocation() const
Retrieve the location of the literal.
bool isAdditiveOp() const
bool isEqualityOp() const
SourceLocation getBuiltinLoc() const
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getEndLoc() const LLVM_READONLY
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
const Expr * getBase() const
static bool classof(const Stmt *T)
const_child_range children() const
SourceLocation getDotLoc() const
Represents a struct/union/class.
InitExprsTy::const_reverse_iterator const_reverse_iterator
Represents a C99 designated initializer expression.
AbstractConditionalOperator(StmtClass SC, EmptyShell Empty)
bool isOrdinaryOrBitFieldObject() const
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
static bool classof(const Stmt *T)
const Expr * IgnoreParenImpCasts() const
static StringLiteral * Create(const ASTContext &Ctx, StringRef Str, StringKind Kind, bool Pascal, QualType Ty, SourceLocation Loc)
Simple constructor for string literals made from one token.
One of these records is kept for each identifier that is lexed.
Represents a statement that could possibly have a value and type.
Expr * getFalseExpr() const
FieldDecl * getField() const
For a field offsetof node, returns the field.
SourceLocation getRParenLoc() const
AddrLabelExpr(SourceLocation AALoc, SourceLocation LLoc, LabelDecl *L, QualType t)
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(), or __builtin_FILE().
const_reverse_iterator rend() const
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
static Opcode reverseComparisonOp(Opcode Opc)
QualType getComputationResultType() const
bool isArrayRangeDesignator() const
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
A vector component is an element or range of elements on a vector.
StmtIterator cast_away_const(const ConstStmtIterator &RHS)
const_child_range children() const
static bool classof(const Stmt *T)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
Expr * getInit() const
Retrieve the initializer value.
SourceLocation getExprLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
FullExpr - Represents a "full-expression" node.
SourceLocation getAmpAmpLoc() const
static SourceLocation getFromRawEncoding(unsigned Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
SourceLocation getBeginLoc() const LLVM_READONLY
Represents a member of a struct/union/class.
SourceLocation getBeginLoc() const LLVM_READONLY
void setIsMicrosoftABI(bool IsMS)
Represents a place-holder for an object not to be initialized by anything.
SourceLocation getBeginLoc() const LLVM_READONLY
UnaryOperator(Expr *input, Opcode opc, QualType type, ExprValueKind VK, ExprObjectKind OK, SourceLocation l, bool CanOverflow)
static bool isPtrMemOp(Opcode Opc)
predicates to categorize the respective opcodes.
bool isArrayDesignator() const
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
static bool isIncrementDecrementOp(Opcode Op)
unsigned getArrayExprIndex() const
For an array element node, returns the index into the array of expressions.
SourceLocation getLabelLoc() const
ExtVectorElementExpr(EmptyShell Empty)
Build an empty vector element expression.
bool hasExplicitTemplateArgs() const
Determines whether the member name was followed by an explicit template argument list.
UnaryOperator(EmptyShell Empty)
Build an empty unary operator.
const Expr * getResultExpr() const
SourceLocation getRBraceLoc() const
SourceLocation getOperatorLoc() const
SourceLocation getExprLoc() const LLVM_READONLY
unsigned getNumCommas() const
getNumCommas - Return the number of commas that must have been present in this function call...
static bool classof(const Stmt *T)
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
bool isReferenceType() const
SourceLocation getRParenLoc() const
void setArg(unsigned Arg, Expr *ArgExpr)
setArg - Set the specified argument.
SourceLocation getEndLoc() const LLVM_READONLY
void shrinkNumArgs(unsigned NewNumArgs)
Reduce the number of arguments in this call expression.
void setRParen(SourceLocation Loc)
GNUNullExpr(EmptyShell Empty)
Build an empty GNU __null expression.
SourceLocation getBeginLoc() const LLVM_READONLY
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
const_child_range children() const
clang::CharUnits operator*(clang::CharUnits::QuantityType Scale, const clang::CharUnits &CU)
const_child_range children() const
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
SourceLocation getBeginLoc() const LLVM_READONLY
__DEVICE__ int max(int __a, int __b)
Classification ClassifyModifiable(ASTContext &Ctx, SourceLocation &Loc) const
ClassifyModifiable - Classify this expression according to the C++11 expression taxonomy, and see if it is valid on the left side of an assignment.
Association getAssociation(unsigned I)
Return the Ith association expression with its TypeSourceInfo, bundled together in GenericSelectionEx...
std::unique_ptr< AtomicScopeModel > getScopeModel() const
Get atomic scope model.
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getQuestionLoc() const
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
void setComponent(unsigned Idx, OffsetOfNode ON)
SourceLocation getEndLoc() const LLVM_READONLY
const_child_range children() const
unsigned getCharByteWidth() const
SourceLocation getBeginLoc() const LLVM_READONLY
const Expr * ignoreParenBaseCasts() const
bool isAssignmentOp() const
SourceLocation getEndLoc() const LLVM_READONLY
NestedNameSpecifierLoc QualifierLoc
The nested-name-specifier that qualifies the name, including source-location information.
void setRParenLoc(SourceLocation L)
static bool classof(const Stmt *T)
bool hadArrayRangeDesignator() const
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
const Expr *const * const_semantics_iterator
static bool classof(const Stmt *T)
SourceLocation getEndLoc() const LLVM_READONLY
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 isRelationalOp(Opcode Opc)
Expr *const * getInits() const
Retrieve the set of initializers.
void setLBraceLoc(SourceLocation Loc)
StringRef getOpcodeStr() const
const_child_range children() const
void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const
Copies the template arguments (if present) into the given structure.
Describes an C or C++ initializer list.
SourceLocation getEndLoc() const LLVM_READONLY
AsTypeExpr(Expr *SrcExpr, QualType DstType, ExprValueKind VK, ExprObjectKind OK, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
void setValue(const ASTContext &C, const llvm::APInt &Val)
void setBuiltinLoc(SourceLocation L)
SourceLocation getBeginLoc() const LLVM_READONLY
AssociationTy< true > ConstAssociation
SmallVectorImpl< PartialDiagnosticAt > * Diag
Diag - If this is non-null, it will be filled in with a stack of notes indicating why evaluation fail...
unsigned getLength() const
static bool isEqualityOp(Opcode Opc)
unsigned getFirstExprIndex() const
bool refersToBitField() const
Returns true if this expression is a gl-value that potentially refers to a bit-field.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
static bool classof(const Stmt *T)
BlockVarCopyInit(Expr *CopyExpr, bool CanThrow)
APValue Val
Val - This is the value the expression can be folded to.
A convenient class for passing around template argument information.
static bool classof(const Stmt *T)
OffsetOfNode(SourceLocation LBracketLoc, unsigned Index, SourceLocation RBracketLoc)
Create an offsetof node that refers to an array element.
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
An x-value expression is a reference to an object with independent storage but which can be "moved"...
path_iterator path_begin()
const Expr * getArg(unsigned Arg) const
OffsetOfNode(const CXXBaseSpecifier *Base)
Create an offsetof node that refers into a C++ base class.
NullPointerConstantValueDependence
Enumeration used to describe how isNullPointerConstant() should cope with value-dependent expressions...
static bool classof(const Stmt *T)
unsigned getNumPreArgs() const
static bool classof(const Stmt *S)
const Expr * IgnoreCasts() const
semantics_iterator semantics_end()
A builtin binary operation expression such as "x + y" or "x <= y".
static bool classof(const Stmt *T)
tokloc_iterator tokloc_end() const
unsigned RBracketLoc
The location of the ']' terminating the array range designator.
ArrayRef< TemplateArgumentLoc > template_arguments() const
void setAccessor(IdentifierInfo *II)
bool hadMultipleCandidates() const
Returns true if this member expression refers to a method that was resolved from an overloaded set ha...
unsigned getResultExprIndex() const
Return the index of the result-bearing expression into the semantics expressions, or PseudoObjectExpr...
static bool isPostfix(Opcode Op)
isPostfix - Return true if this is a postfix operation, like x++.
static bool classof(const Stmt *T)
ChooseExpr(EmptyShell Empty)
Build an empty __builtin_choose_expr.
static bool classof(const Stmt *T)
bool isFPContractableWithinStatement() const
SourceLocation getEqualOrColonLoc() const
Retrieve the location of the '=' that precedes the initializer value itself, if present.
BinaryOperator(EmptyShell Empty)
Construct an empty binary operator.
StringKind
StringLiteral is followed by several trailing objects.
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
const_child_range children() const
IdentKind getIdentKind() const
void setOperatorLoc(SourceLocation L)
unsigned getInt() const
Used to serialize this.
SourceLocation getEndLoc() const
bool isRelationalOp() const
An adjustment to be made to the temporary created when emitting a reference binding, which accesses a particular subobject of that temporary.
ResultStorageKind getResultStorageKind() const
const Expr * getControllingExpr() const
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Helper class for OffsetOfExpr.
AssociationTy< false > Association
const llvm::fltSemantics & getSemantics() const
Return the APFloat semantics this literal uses.
SourceLocation getBuiltinLoc() const
void setOpcode(Opcode Opc)
NestedNameSpecifierLoc getQualifierLoc() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name, with source-location information.
bool isTypeDependent() const
isTypeDependent - Determines whether this expression is type-dependent (C++ [temp.dep.expr]), which means that its type could change from one template instantiation to the next.
An ordinary object is located at an address in memory.
bool Const(InterpState &S, CodePtr OpPC, const T &Arg)
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
const Expr * IgnoreImplicit() const
void setRParenLoc(SourceLocation R)
SourceLocation getEndLoc() const
static Classification makeSimpleLValue()
Create a simple, modifiably lvalue.
GNUNullExpr(QualType Ty, SourceLocation Loc)
ConvertVectorExpr(Expr *SrcExpr, TypeSourceInfo *TI, QualType DstType, ExprValueKind VK, ExprObjectKind OK, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
SourceLocation getTokenLocation() const
getTokenLocation - The location of the __null token.
llvm::APFloatBase::Semantics getRawSemantics() const
Get a raw enumeration value representing the floating-point semantics of this literal (32-bit IEEE...
void setRParenLoc(SourceLocation L)
uint64_t * pVal
Used to store the >64 bits integer value.
const_child_range children() const
void setCastKind(CastKind K)
NestedNameSpecifierLoc getQualifierLoc() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name...
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getEndLoc() const LLVM_READONLY
Expr ** getSubExprs()
Retrieve the array of expressions.
FullExpr(StmtClass SC, EmptyShell Empty)
ChooseExpr(SourceLocation BLoc, Expr *cond, Expr *lhs, Expr *rhs, QualType t, ExprValueKind VK, ExprObjectKind OK, SourceLocation RP, bool condIsTrue, bool TypeDependent, bool ValueDependent)
static bool classof(const Stmt *T)
void setEqualOrColonLoc(SourceLocation L)
SourceLocation getEllipsisLoc() const
const Expr * getLHS() const
void setArgument(Expr *E)
QualType getTypeAsWritten() const
getTypeAsWritten - Returns the type that this expression is casting to, as written in the source code...
void setTypeSourceInfo(TypeSourceInfo *tsi)
static Opcode negateComparisonOp(Opcode Opc)
SourceLocation getEndLoc() const
static bool classof(const Stmt *T)
const Expr * getExpr(unsigned Index) const
ConditionalOperator - The ?: ternary operator.
void setField(FieldDecl *FD)
StringRef getString() const
ParenExpr(SourceLocation l, SourceLocation r, Expr *val)
void setAmpAmpLoc(SourceLocation L)
llvm::iterator_range< const_child_iterator > const_child_range
CompoundStmt - This represents a group of statements like { stmt stmt }.
Represents a prototype with parameter type info, e.g.
void setBlockDecl(BlockDecl *BD)
bool isMicrosoftABI() const
Returns whether this is really a Win64 ABI va_arg expression.
ArrayInitIndexExpr(QualType T)
SubobjectAdjustment(FieldDecl *Field)
void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const
Copies the template arguments (if present) into the given structure.
QualType getComputationLHSType() const
CastKind
CastKind - The kind of operation required for a conversion.
NestedNameSpecifier * getQualifier() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name...
The return type of classify().
const_semantics_iterator semantics_begin() const
Used by IntegerLiteral/FloatingLiteral to store the numeric without leaking memory.
static std::unique_ptr< AtomicScopeModel > getScopeModel(AtomicOp Op)
Get atomic scope model for the atomic op code.
SourceLocation getBeginLoc() const LLVM_READONLY
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
void setLParen(SourceLocation Loc)
llvm::APInt getIntValue() const
SourceLocation getLocation() const
InitListExpr * getUpdater() const
ConditionalOperator(Expr *cond, SourceLocation QLoc, Expr *lhs, SourceLocation CLoc, Expr *rhs, QualType t, ExprValueKind VK, ExprObjectKind OK)
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
bool HasUndefinedBehavior
Whether the evaluation hit undefined behavior.
Represents a call to the builtin function __builtin_va_arg.
Kinds
The various classification results. Most of these mean prvalue.
SourceLocation getEndLoc() const LLVM_READONLY
unsigned getValue() const
AssociationIteratorTy< true > ConstAssociationIterator
Exposes information about the current target.
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
CompoundAssignOperator(Expr *lhs, Expr *rhs, Opcode opc, QualType ResType, ExprValueKind VK, ExprObjectKind OK, QualType CompLHSType, QualType CompResultType, SourceLocation OpLoc, FPOptions FPFeatures)
llvm::APSInt getShuffleMaskIdx(const ASTContext &Ctx, unsigned N) const
ADLCallKind getADLCallKind() const
SourceLocation getBeginLoc() const LLVM_READONLY
const_child_range children() const
SourceLocation getEndLoc() const LLVM_READONLY
void setLocation(SourceLocation Location)
const_arg_range arguments() const
Represents a block literal declaration, which is like an unnamed FunctionDecl.
llvm::MutableArrayRef< Designator > designators()
static bool classof(const Stmt *T)
DeclAccessPair getFoundDecl() const
Retrieves the declaration found by lookup.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
This represents one expression.
Defines the clang::LangOptions interface.
void setRBraceLoc(SourceLocation Loc)
const_child_range children() const
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
llvm::iterator_range< ConstAssociationIterator > const_association_range
const Expr * getSyntacticForm() const
const_child_range children() const
CXXBaseSpecifier * getBase() const
For a base class node, returns the base specifier.
void setRParenLoc(SourceLocation L)
const Expr * getRHS() const
const AnnotatedLine * Line
static bool classof(const Stmt *T)
void setSyntacticForm(InitListExpr *Init)
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why? This is only meaningful if the named memb...
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getEndLoc() const LLVM_READONLY
void setMemberLoc(SourceLocation L)
void setTypeDependent(bool TD)
Set whether this expression is type-dependent or not.
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
bool isFieldDesignator() const
unsigned getNumInits() const
static bool classof(const Stmt *T)
void setExprAndFlag(Expr *CopyExpr, bool CanThrow)
Expr * getSubExpr() const
Get the initializer to use for each array element.
SourceLocation getBeginLoc() const
const Expr * getCallee() const
SourceLocation getEndLoc() const LLVM_READONLY
An array or GNU array-range designator, e.g., "[9]" or "[10..15]".
Stmt * getPreArg(unsigned I)
const Expr * skipRValueSubobjectAdjustments() const
void setTypeSourceInfo(TypeSourceInfo *ti)
const_iterator end() const
const_child_range children() const
QualType getArgumentType() const
const Expr * IgnoreConversionOperator() const
bool performsVirtualDispatch(const LangOptions &LO) const
Returns true if virtual dispatch is performed.
void setWrittenTypeInfo(TypeSourceInfo *TI)
SourceLocation getLParenLoc() const
const Expr * IgnoreImplicitAsWritten() const
ParenExpr(EmptyShell Empty)
Construct an empty parenthesized expression.
uint32_t getCodeUnit(size_t i) const
void setObjectKind(ExprObjectKind Cat)
setObjectKind - Set the object kind produced by this expression.
bool hasQualifier() const
Determine whether this declaration reference was preceded by a C++ nested-name-specifier, e.g., N::foo.
TypeSourceInfo * getTypeSourceInfo() const
unsigned size() const
Returns the number of designators in this initializer.
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
const_child_range children() const
FunctionDecl * getDirectCallee()
If the callee is a FunctionDecl, return it. Otherwise return null.
bool refersToEnclosingVariableOrCapture() const
Does this DeclRefExpr refer to an enclosing local or a captured variable?
IdentifierInfo & getAccessor() const
static bool EvaluateAsBooleanCondition(const Expr *E, bool &Result, EvalInfo &Info)
BinaryOperator(Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy, ExprValueKind VK, ExprObjectKind OK, SourceLocation opLoc, FPOptions FPFeatures, bool dead2)
const ValueDecl * getDecl() const
ArrayRef< Expr * > inits()
ArraySubscriptExpr(EmptyShell Shell)
Create an empty array subscript expression.
Specifies that a value-dependent expression of integral or dependent type should be considered a null...
Extra data stored in some MemberExpr objects.
Kind getKind() const
Determine what kind of offsetof node this is.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
ArrayRef< Expr * > getAssocExprs() const
QualType getTypeOfArgument() const
Gets the argument type, or the type of the argument expression, whichever is appropriate.
const_semantics_iterator semantics_end() const
void setValueKind(ExprValueKind Cat)
setValueKind - Set the value kind produced by this expression.
SourceLocation getEndLoc() const LLVM_READONLY
static OMPLinearClause * CreateEmpty(const ASTContext &C, unsigned NumVars)
Creates an empty clause with the place for NumVars variables.
SourceLocation getRParenLoc() const
getRParenLoc - Return the location of final right parenthesis.
void setMemberDecl(ValueDecl *D)
const_child_range children() const
const_child_range children() const
ModifiableType
The results of modification testing.
void setRParenLoc(SourceLocation L)
SourceLocation getLBracketLoc() const
SourceLocation getRBracketLoc() const
SourceLocation getEnd() const
const_child_range children() const
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
unsigned Index
Location of the first index expression within the designated initializer expression's list of subexpr...
SourceLocation getMemberLoc() const
getMemberLoc - Return the location of the "member", in X->F, it is the location of 'F'...
const_child_range children() const
bool usesGNUSyntax() const
Determines whether this designated initializer used the deprecated GNU syntax for designated initiali...
static bool CanThrow(Expr *E, ASTContext &Ctx)
static bool EvaluateAsInt(const Expr *E, Expr::EvalResult &ExprResult, const ASTContext &Ctx, Expr::SideEffectsKind AllowSideEffects, EvalInfo &Info)
ArrayRef< Expr * > inits() const
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getEndLoc() const LLVM_READONLY
const_arg_iterator arg_end() const
SourceLocation getEndLoc() const LLVM_READONLY
const OffsetOfNode & getComponent(unsigned Idx) const
Expr * getTrueExpr() const
getTrueExpr - Return the subexpression which will be evaluated if the condition evaluates to true; th...
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
static bool classof(const Stmt *T)
SourceLocation getLocation() const
Expr * getTrueExpr() const
SourceLocation getRParenLoc() const
The result type of a method or function.
Designator(unsigned Index, SourceLocation LBracketLoc, SourceLocation EllipsisLoc, SourceLocation RBracketLoc)
Initializes a GNU array-range designator.
const Expr * getSubExpr() const
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr.cast]), which uses the syntax (Type)expr.
llvm::iterator_range< semantics_iterator > semantics()
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Expr * getLHS()
An array access can be written A[4] or 4[A] (both are equivalent).
static bool classof(const Stmt *T)
bool hadMultipleCandidates() const
Returns true if this expression refers to a function that was resolved from an overloaded set having ...
const_child_range children() const
const_child_range children() const
SourceLocation getBeginLoc() const LLVM_READONLY
ExplicitCastExpr(StmtClass SC, QualType exprTy, ExprValueKind VK, CastKind kind, Expr *op, unsigned PathSize, TypeSourceInfo *writtenTy)
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1...
SourceLocation getEndLoc() const LLVM_READONLY
ArrayRef< TypeSourceInfo * > getAssocTypeSourceInfos() const
SourceLocation getEndLoc() const LLVM_READONLY
void setRParenLoc(SourceLocation L)
bool isDecrementOp() const
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
static bool classof(const Stmt *T)
llvm::iterator_range< AssociationIterator > association_range
SourceLocation getBeginLoc() const LLVM_READONLY
static bool isCommaOp(Opcode Opc)
bool isComparisonOp() const
llvm::iterator_range< path_iterator > path()
static bool isBitwiseOp(Opcode Opc)
const_child_range children() const
static bool classof(const Stmt *T)
Copy initialization expr of a __block variable and a boolean flag that indicates whether the expressi...
void setTypeSourceInfo(TypeSourceInfo *tinfo)
static bool classof(const Stmt *T)
unsigned DotLoc
The location of the '.' in the designated initializer.
UnaryExprOrTypeTraitExpr(UnaryExprOrTypeTrait ExprKind, TypeSourceInfo *TInfo, QualType resultType, SourceLocation op, SourceLocation rp)
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
void setComputationLHSType(QualType T)
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
const Stmt * getPreArg(unsigned I) const
SourceLocation getLParenLoc() const
DesignatedInitUpdateExpr(EmptyShell Empty)
unsigned path_size() const
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
void setLParenLoc(SourceLocation L)
SmallVector< CXXBaseSpecifier *, 4 > CXXCastPath
A simple array of base specifiers.
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on a template...
const CompoundStmt * getSubStmt() const
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
ConstExprIterator const_arg_iterator
SourceLocation getEndLoc() const LLVM_READONLY
void setAccessorLoc(SourceLocation L)
const_child_range children() const
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
StringLiteral * getFunctionName()
SourceLocation getEndLoc() const
const_child_range children() const
unsigned getNumExprs() const
Return the number of expressions in this paren list.
void setLocation(SourceLocation L)
Encodes a location in the source.
void setLocation(SourceLocation L)
void setValue(const ASTContext &C, const llvm::APFloat &Val)
SourceLocation getEndLoc() const LLVM_READONLY
MutableArrayRef< Expr * > getInits()
const NamedDecl * getFoundDecl() const
Get the NamedDecl through which this reference occurred.
SourceLocation getOperatorLoc() const
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
Expr * getSubExpr() const
const Decl * getReferencedDeclOfCallee() const
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
void setUpdater(Expr *Updater)
SourceLocation getBuiltinLoc() const
getBuiltinLoc - Return the location of the __builtin_astype token.
NoInitExpr(EmptyShell Empty)
CastKind getCastKind() const
Expr * getSubExpr(unsigned Idx) const
const Expr *const * getArgs() const
pointer data()
data - Return a pointer to the vector's buffer, even if empty().
bool isModifiable() const
static bool isPlaceholderTypeKind(Kind K)
Determines whether the given kind corresponds to a placeholder type.
static bool classof(const Stmt *T)
Represents the declaration of a label.
static bool classof(const Stmt *T)
void setLabelLoc(SourceLocation L)
const Expr * getExpr(unsigned Init) const
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs. ...
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getStrTokenLoc(unsigned TokNum) const
Get one of the string literal token.
const Expr * IgnoreParenCasts() const
StmtExpr(EmptyShell Empty)
Build an empty statement expression.
bool canOverflow() const
Returns true if the unary operator can cause an overflow.
CompoundAssignOperator(EmptyShell Empty)
Build an empty compound assignment operator expression.
SourceLocation getRParenLoc() const
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
static bool classof(const Stmt *T)
SourceLocation getEndLoc() const LLVM_READONLY
uint64_t VAL
Used to store the <= 64 bits integer value.
const Expr * getSubExprAsWritten() const
static bool classof(const Stmt *T)
const Expr * getArgumentExpr() const
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load, __atomic_store, and __atomic_compare_exchange_*, for the similarly-named C++11 instructions, and __c11 variants for <stdatomic.h>, and corresponding __opencl_atomic_* for OpenCL 2.0.
UnaryExprOrTypeTrait getKind() const
const_child_range children() const
const Expr * IgnoreParenNoopCasts(const ASTContext &Ctx) const
Expr * getExpr(unsigned Init)
const_reverse_iterator rbegin() const
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
static bool classof(const Stmt *T)
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getLParenLoc() const
const_child_range children() const
void setDecl(ValueDecl *NewD)
void setArgument(TypeSourceInfo *TInfo)
SourceLocation getEndLoc() const LLVM_READONLY
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Expr ** getInits()
Retrieve the set of initializers.
bool isLValue() const
isLValue - True if this expression is an "l-value" according to the rules of the current language...
CharacterKind getKind() const
static bool classof(const Stmt *T)
InitListExpr(EmptyShell Empty)
Build an empty initializer list.
SourceLocation getBeginLoc() const LLVM_READONLY
AtomicExpr(EmptyShell Empty)
Build an empty AtomicExpr.
static bool isLogicalOp(Opcode Opc)
const_child_range children() const
ArrayRef< Expr * > exprs()
uintptr_t NameOrField
Refers to the field that is being initialized.
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
OpaqueValueExpr(EmptyShell Empty)
unsigned LBracketLoc
The location of the '[' starting the array range designator.
path_const_iterator path_end() const
bool isArgumentType() const
const SourceLocation * tokloc_iterator
static bool classof(const Stmt *T)
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
void sawArrayRangeDesignator(bool ARD=true)
bool isPartOfExplicitCast() const
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const
Defines the fixed point number interface.
A placeholder type used to construct an empty shell of a type, that will be filled in later (e...
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
bool hasTemplateKeyword() const
Determines whether the name in this declaration reference was preceded by the template keyword...
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why?
const Expr * getInitializer() const
CompoundAssignOperator - For compound assignments (e.g.
A POD class for pairing a NamedDecl* with an access specifier.
DeclarationNameLoc - Additional source/type location info for a declaration name. ...
Represents a C11 generic selection.
VAArgExpr(SourceLocation BLoc, Expr *e, TypeSourceInfo *TInfo, SourceLocation RPLoc, QualType t, bool IsMS)
const Expr * getBase() const
EvalStatus is a struct with detailed info about an evaluation in progress.
ArrayInitLoopExpr(QualType T, Expr *CommonInit, Expr *ElementInit)
AddrLabelExpr - The GNU address of label extension, representing &&label.
Expr * getResultExpr()
Return the result-bearing expression, or null if there is none.
Expr(StmtClass SC, EmptyShell)
Construct an empty expression.
OpaqueValueExpr * getOpaqueValue() const
getOpaqueValue - Return the opaque value placeholder.
void setSemantics(const llvm::fltSemantics &Sem)
Set the APFloat semantics this literal uses.
bool isStringType() const
const FieldDecl * getTargetUnionField() const
const FieldDecl * getInitializedFieldInUnion() const
static bool classof(const Stmt *T)
Expr * getFalseExpr() const
getFalseExpr - Return the subexpression which will be evaluated if the condnition evaluates to false;...
BinaryOperator(StmtClass SC, EmptyShell Empty)
void setLocation(SourceLocation L)
SourceLocation getExprLoc() const LLVM_READONLY
static bool classof(const Stmt *T)
OffsetOfNode(SourceLocation DotLoc, FieldDecl *Field, SourceLocation NameLoc)
Create an offsetof node that refers to a field.
unsigned getNumAssocs() const
The number of association expressions.
Dataflow Directional Tag Classes.
bool isResultDependent() const
Whether this generic selection is result-dependent.
bool isValid() const
Return true if this is a valid SourceLocation object.
bool hasSideEffects() const
tokloc_iterator tokloc_begin() const
void setBuiltinLoc(SourceLocation L)
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
[C99 6.4.2.2] - A predefined identifier such as func.
DeclarationNameInfo getMemberNameInfo() const
Retrieve the member declaration name info.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
SourceLocation getBeginLoc() const LLVM_READONLY
EvalResult is a struct with detailed info about an evaluated expression.
std::reverse_iterator< iterator > reverse_iterator
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
void setRParenLoc(SourceLocation L)
ModifiableType getModifiable() const
void setLabel(LabelDecl *L)
static bool isShiftAssignOp(Opcode Opc)
void setTypeInfoAsWritten(TypeSourceInfo *writtenTy)
const_child_range children() const
BinaryConditionalOperator(EmptyShell Empty)
Build an empty conditional operator.
Reads an AST files chain containing the contents of a translation unit.
A field designator, e.g., ".x".
InitExprsTy::reverse_iterator reverse_iterator
ExtVectorElementExpr(QualType ty, ExprValueKind VK, Expr *base, IdentifierInfo &accessor, SourceLocation loc)
AccessSpecifier getAccess() const
void setFileScope(bool FS)
OpaqueValueExpr(SourceLocation Loc, QualType T, ExprValueKind VK, ExprObjectKind OK=OK_Ordinary, Expr *SourceExpr=nullptr)
const Decl * getCalleeDecl() const
const FieldDecl * getSourceBitField() const
SourceLocation getLBraceLoc() const
StmtClass getStmtClass() const
const char * getCastKindName() const
const_child_range children() const
const Expr * getArrayFiller() const
Expression is a Null pointer constant built from a zero integer expression that is not a simple...
llvm::iterator_range< const_semantics_iterator > semantics() const
void setInstantiationDependent(bool ID)
Set whether this expression is instantiation-dependent or not.
Kind
The kind of offsetof node we have.
Expression is a C++11 nullptr.
OffsetOfNode(SourceLocation DotLoc, IdentifierInfo *Name, SourceLocation NameLoc)
Create an offsetof node that refers to an identifier.
A pointer to member type per C++ 8.3.3 - Pointers to members.
SourceLocation getEndLoc() const LLVM_READONLY
const Expr * getSubExpr() const
VAArgExpr(EmptyShell Empty)
Create an empty __builtin_va_arg expression.
semantics_iterator semantics_begin()
void setLParenLoc(SourceLocation L)
SourceLocation getBeginLoc() const
ExplicitCastExpr - An explicit cast written in the source code.
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
static bool isPrefix(Opcode Op)
isPrefix - Return true if this is a prefix operation, like –x.
void setInitializedFieldInUnion(FieldDecl *FD)
static bool classof(const Stmt *T)
ExplicitCastExpr(StmtClass SC, EmptyShell Shell, unsigned PathSize)
Construct an empty explicit cast.
llvm::APInt getValue() const
unsigned getNumSubExprs() const
LabelDecl * getLabel() const
void setRBracketLoc(SourceLocation L)
static bool EvaluateAsFixedPoint(const Expr *E, Expr::EvalResult &ExprResult, const ASTContext &Ctx, Expr::SideEffectsKind AllowSideEffects, EvalInfo &Info)
bool hasPlaceholderType(BuiltinType::Kind K) const
Returns whether this expression has a specific placeholder type.
unsigned getByteLength() const
static bool classof(const Stmt *T)
SourceLocation getFieldLoc() const
ConstAssociation getAssociation(unsigned I) const
Expr * getOrderFail() const
DeclarationNameInfo getNameInfo() const
bool HasSideEffects
Whether the evaluated expression has side effects.
void setHadMultipleCandidates(bool V=true)
Sets the flag telling whether this expression refers to a method that was resolved from an overloaded...
Location wrapper for a TemplateArgument.
Iterator for iterating over Stmt * arrays that contain only T *.
SourceLocation getBuiltinLoc() const
CompoundLiteralExpr(SourceLocation lparenloc, TypeSourceInfo *tinfo, QualType T, ExprValueKind VK, Expr *init, bool fileScope)
SourceLocation getEndLoc() const LLVM_READONLY
static bool classof(const Stmt *S)
const_child_range children() const
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
static bool classof(const Stmt *S)
AbstractConditionalOperator - An abstract base class for ConditionalOperator and BinaryConditionalOpe...
llvm::iterator_range< path_const_iterator > path() const
llvm::PointerIntPair< Expr *, 1, bool > ExprAndFlag
const_child_range children() const
void setIndexExpr(unsigned Idx, Expr *E)
SourceLocation getLocation() const
Retrieve the location of this expression.
const Expr * IgnoreImpCasts() const
SourceLocation getEndLoc() const
Expr * getCond() const
getCond - Return the condition expression; this is defined in terms of the opaque value...
SourceLocation getRParenLoc() const
SourceLocation getBeginLoc() const LLVM_READONLY
static bool classof(const Stmt *T)
FieldDecl * getField() const
const_child_range children() const
SourceLocation getEndLoc() const LLVM_READONLY
ImaginaryLiteral(Expr *val, QualType Ty)
void setKind(UnaryExprOrTypeTrait K)
void setRParenLoc(SourceLocation L)
static bool isAdditiveOp(Opcode Opc)
Base for LValueReferenceType and RValueReferenceType.
void setOperatorLoc(SourceLocation L)
void setValue(const ASTContext &C, const llvm::APFloat &Val)
SourceLocation getBeginLoc() const
StringRef getBytes() const
Allow access to clients that need the byte representation, such as ASTWriterStmt::VisitStringLiteral(...
SourceLocation getDefaultLoc() const
const_child_range children() const
UnaryExprOrTypeTraitExpr(EmptyShell Empty)
Construct an empty sizeof/alignof expression.
SubobjectAdjustment(const MemberPointerType *MPT, Expr *RHS)
ExprIterator arg_iterator
void setLParenLoc(SourceLocation L)
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat]...
ArraySubscriptExpr(Expr *lhs, Expr *rhs, QualType t, ExprValueKind VK, ExprObjectKind OK, SourceLocation rbracketloc)
const_child_range children() const
Represents a base class of a C++ class.
CharacterLiteral(unsigned value, CharacterKind kind, QualType type, SourceLocation l)
A bitfield object is a bitfield on a C or C++ record.
const_child_range children() const
void setOperatorLoc(SourceLocation L)
void setLocation(SourceLocation Location)
static bool isIncrementOp(Opcode Op)
void setHadMultipleCandidates(bool V=true)
Sets the flag telling whether this expression refers to a function that was resolved from an overload...
SourceLocation getBeginLoc() const LLVM_READONLY
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
bool isArithmeticOp() const
ImplicitValueInitExpr(EmptyShell Empty)
Construct an empty implicit value initialization.
BinaryOperatorKind Opcode
static bool classof(const Stmt *T)
ArrayRef< TemplateArgumentLoc > template_arguments() const
static bool classof(const Stmt *T)
void setBuiltinLoc(SourceLocation L)
static bool classof(const Stmt *T)
Expression is a Null pointer constant built from a literal zero.
SourceLocation getBeginLoc() const LLVM_READONLY
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
const_child_range children() const
BinaryConditionalOperator(Expr *common, OpaqueValueExpr *opaqueValue, Expr *cond, Expr *lhs, Expr *rhs, SourceLocation qloc, SourceLocation cloc, QualType t, ExprValueKind VK, ExprObjectKind OK)
CXXBaseSpecifier ** path_iterator
Provides definitions for the atomic synchronization scopes.
Represents a C++ struct/union/class.
static bool isCompoundAssignmentOp(Opcode Opc)
Expr * getTrueExpr() const
Represents a loop initializing the elements of an array.
bool isSyntacticForm() const
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
SourceLocation getBeginLoc() const LLVM_READONLY
static bool classof(const Stmt *T)
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
static bool classof(const Stmt *T)
SourceLocation getRParenLoc() const
bool isMultiplicativeOp() const
bool hasUnusedResultAttr(const ASTContext &Ctx) const
Returns true if this call expression should warn on unused results.
unsigned getNumConcatenated() const
getNumConcatenated - Get the number of string literal tokens that were concatenated in translation ph...
bool containsNonAscii() const
bool containsUnexpandedParameterPack() const
Whether this expression contains an unexpanded parameter pack (for C++11 variadic templates)...
SourceLocation getBeginLoc() const LLVM_READONLY
unsigned kind
All of the diagnostics that can be emitted by the frontend.
This class is used for builtin types like 'int'.
void SetResult(APValue Value, const ASTContext &Context)
void setPreArg(unsigned I, Stmt *PreArg)
SourceLocation getEndLoc() const LLVM_READONLY
Expr * getInit(unsigned Init)
void setTokenLocation(SourceLocation L)
SourceLocation getBuiltinLoc() const
getBuiltinLoc - Return the location of the __builtin_convertvector token.
StringLiteral - This represents a string literal expression, e.g.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
SourceLocation getBeginLoc() const LLVM_READONLY
const MemberPointerType * MPT
llvm::ArrayRef< Designator > designators() const
Designator * getDesignator(unsigned Idx)
SourceLocation getBeginLoc() const LLVM_READONLY
AbstractConditionalOperator(StmtClass SC, QualType T, ExprValueKind VK, ExprObjectKind OK, bool TD, bool VD, bool ID, bool ContainsUnexpandedParameterPack, SourceLocation qloc, SourceLocation cloc)
static Decl::Kind getKind(const Decl *D)
NonOdrUseReason
The reason why a DeclRefExpr does not constitute an odr-use.
static bool classof(const Stmt *T)
SourceLocation getBeginLoc() const LLVM_READONLY
DeclAccessPair FoundDecl
The DeclAccessPair through which the MemberDecl was found due to name qualifiers. ...
unsigned getNumComponents() const
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
std::reverse_iterator< const_iterator > const_reverse_iterator
void setKind(CharacterKind kind)
A reference to a declared variable, function, enum, etc.
const_child_range children() const
void setRawSemantics(llvm::APFloatBase::Semantics Sem)
Set the raw enumeration value representing the floating-point semantics of this literal (32-bit IEEE...
bool isIncrementDecrementOp() const
Expr * getSemanticExpr(unsigned index)
const APValue & getResultAsAPValue() const
SourceLocation getEndLoc() const LLVM_READONLY
const Expr * IgnoreUnlessSpelledInSource() const
SourceLocation getLocation() const
const Expr *const * getSubExprs() const
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
bool isConditionDependent() const
AssociationIteratorTy< false > AssociationIterator
An l-value expression is a reference to an object with independent storage.
A trivial tuple used to represent a source range.
This represents a decl that may have a name.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding the member name, if any.
NestedNameSpecifier * getQualifier() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name.
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type, member-designator).
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getEndLoc() const LLVM_READONLY
static bool classof(const Stmt *T)
SourceLocation getBuiltinLoc() const
APValue::ValueKind getResultAPValueKind() const
DeclContext * getParentContext()
SourceLocExpr(EmptyShell Empty)
Build an empty call expression.
static bool isDecrementOp(Opcode Op)
Expr * getCommon() const
getCommon - Return the common expression, written to the left of the condition.
TypeSourceInfo * getWrittenTypeInfo() const
const CXXRecordDecl * DerivedClass
path_const_iterator path_begin() const
BlockDecl * getBlockDecl()
bool isInStdNamespace() const
static bool classof(const Stmt *T)
SourceLocation getGenericLoc() const
SubobjectAdjustment(const CastExpr *BasePath, const CXXRecordDecl *DerivedClass)
ImaginaryLiteral(EmptyShell Empty)
Build an empty imaginary literal.
static bool isComparisonOp(Opcode Opc)
SourceLocation getBegin() const
TypeSourceInfo * getTypeSourceInfo() const
getTypeSourceInfo - Return the destination type.
const_child_range children() const
SourceLocation ColonLoc
Location of ':'.
SourceLocation getRParenLoc() const
Return the location of the right parentheses.
llvm::APInt getArraySize() const
bool isConditionTrue() const
isConditionTrue - Return whether the condition is true (i.e.
CastExpr(StmtClass SC, QualType ty, ExprValueKind VK, const CastKind kind, Expr *op, unsigned BasePathSize)
This class handles loading and caching of source files into memory.
InitListExpr * getSyntacticForm() const
Represents an implicitly-generated value initialization of an object of a given type.
NullPointerConstantKind
Enumeration used to describe the kind of Null pointer constant returned from isNullPointerConstant()...
Attr - This represents one attribute.
SourceLocation getEndLoc() const LLVM_READONLY
QualType getType() const
Return the type wrapped by this type source info.
association_range associations()
const FunctionDecl * getDirectCallee() const
SourceLocation getOperatorLoc() const
InitListExpr * getSemanticForm() const
SourceLocation getEndLoc() const LLVM_READONLY
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr *> VL, ArrayRef< Expr *> PL, ArrayRef< Expr *> IL, Expr *Step, Expr *CalcStep, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL and a linear step Step.
static bool classof(const Stmt *T)
void setIsConditionTrue(bool isTrue)
SourceLocation getBeginLoc() const LLVM_READONLY
bool isCompoundAssignmentOp() const
SourceLocation getExprLoc() const
SourceRange getSourceRange() const LLVM_READONLY
static bool EvaluateAsRValue(EvalInfo &Info, const Expr *E, APValue &Result)
EvaluateAsRValue - Try to evaluate this expression, performing an implicit lvalue-to-rvalue cast if i...
llvm::iterator_range< const_arg_iterator > const_arg_range