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;
497 bool isKnownToHaveBooleanValue()
const;
508 bool isEvaluated =
true)
const;
509 bool isIntegerConstantExpr(
const ASTContext &Ctx,
514 bool isCXX98IntegralConstantExpr(
const ASTContext &Ctx)
const;
528 static bool isPotentialConstantExpr(
const FunctionDecl *FD,
537 static bool isPotentialConstantExprUnevaluated(
Expr *E,
546 bool isConstantInitializer(
ASTContext &Ctx,
bool ForRef,
547 const Expr **Culprit =
nullptr)
const;
570 : HasSideEffects(
false), HasUndefinedBehavior(
false), Diag(nullptr) {}
575 return HasSideEffects;
586 bool isGlobalLValue()
const;
596 bool InConstantContext =
false)
const;
603 bool InConstantContext =
false)
const;
607 SE_AllowUndefinedBehavior,
616 bool InConstantContext =
false)
const;
621 bool EvaluateAsFloat(llvm::APFloat &Result,
const ASTContext &Ctx,
623 bool InConstantContext =
false)
const;
629 bool InConstantContext =
false)
const;
644 bool IncludePossibleEffects =
true)
const;
648 bool hasNonTrivialCall(
const ASTContext &Ctx)
const;
653 llvm::APSInt EvaluateKnownConstInt(
657 llvm::APSInt EvaluateKnownConstIntCheckOverflow(
661 void EvaluateForOverflow(
const ASTContext &Ctx)
const;
666 bool InConstantContext =
false)
const;
683 const Expr *This =
nullptr)
const;
699 bool tryEvaluateObjectSize(uint64_t &Result,
ASTContext &Ctx,
700 unsigned Type)
const;
729 NPC_NeverValueDependent = 0,
737 NPC_ValueDependentIsNotNull
749 bool isOBJCGCCandidate(
ASTContext &Ctx)
const;
752 bool isBoundMemberFunction(
ASTContext &Ctx)
const;
763 Expr *IgnoreImpCasts() LLVM_READONLY;
764 const
Expr *IgnoreImpCasts()
const {
765 return const_cast<Expr *
>(
this)->IgnoreImpCasts();
774 Expr *IgnoreCasts() LLVM_READONLY;
776 return const_cast<Expr *
>(
this)->IgnoreCasts();
784 Expr *IgnoreImplicit() LLVM_READONLY;
786 return const_cast<Expr *
>(
this)->IgnoreImplicit();
796 Expr *IgnoreParens() LLVM_READONLY;
798 return const_cast<Expr *
>(
this)->IgnoreParens();
810 Expr *IgnoreParenImpCasts() LLVM_READONLY;
812 return const_cast<Expr *
>(
this)->IgnoreParenImpCasts();
819 Expr *IgnoreParenCasts() LLVM_READONLY;
821 return const_cast<Expr *
>(
this)->IgnoreParenCasts();
826 Expr *IgnoreConversionOperator() LLVM_READONLY;
828 return const_cast<Expr *
>(
this)->IgnoreConversionOperator();
839 Expr *IgnoreParenLValueCasts() LLVM_READONLY;
841 return const_cast<Expr *
>(
this)->IgnoreParenLValueCasts();
852 return const_cast<Expr *
>(
this)->IgnoreParenNoopCasts(Ctx);
860 Expr *ignoreParenBaseCasts() LLVM_READONLY;
862 return const_cast<Expr *
>(
this)->ignoreParenBaseCasts();
872 bool isDefaultArgument()
const;
879 bool isImplicitCXXThis()
const;
895 const Expr *getBestDynamicClassTypeExpr()
const;
900 const Expr *skipRValueSubobjectAdjustments(
906 return skipRValueSubobjectAdjustments(CommaLHSs, Adjustments);
925 :
Expr(SC, subexpr->getType(),
926 subexpr->getValueKind(), subexpr->getObjectKind(),
927 subexpr->isTypeDependent(), subexpr->isValueDependent(),
928 subexpr->isInstantiationDependent(),
929 subexpr->containsUnexpandedParameterPack()), SubExpr(subexpr) {}
951 static_assert(std::is_same<uint64_t, llvm::APInt::WordType>::value,
952 "this class assumes llvm::APInt::WordType is uint64_t for " 953 "trail-allocated storage");
960 size_t numTrailingObjects(OverloadToken<APValue>)
const {
963 size_t numTrailingObjects(OverloadToken<uint64_t>)
const {
968 uint64_t &Int64Result() {
971 return *getTrailingObjects<uint64_t>();
973 const uint64_t &Int64Result()
const {
979 return *getTrailingObjects<APValue>();
981 const APValue &APValueResult()
const {
982 return const_cast<ConstantExpr *
>(
this)->APValueResult();
1005 return SubExpr->getBeginLoc();
1008 return SubExpr->getEndLoc();
1016 MoveIntoResult(Value, Context);
1026 APValue getAPValueResult()
const;
1028 llvm::APSInt getResultAsAPSInt()
const;
1052 Expr *SourceExpr =
nullptr)
1053 :
Expr(OpaqueValueExprClass, T, VK, OK,
1054 T->isDependentType() ||
1055 (SourceExpr && SourceExpr->isTypeDependent()),
1056 T->isDependentType() ||
1057 (SourceExpr && SourceExpr->isValueDependent()),
1058 T->isInstantiationDependentType() ||
1059 (SourceExpr && SourceExpr->isInstantiationDependent()),
1061 SourceExpr(SourceExpr) {
1063 OpaqueValueExprBits.Loc = Loc;
1072 :
Expr(OpaqueValueExprClass, Empty) {}
1078 return SourceExpr ? SourceExpr->
getBeginLoc() : getLocation();
1081 return SourceExpr ? SourceExpr->
getEndLoc() : getLocation();
1084 return SourceExpr ? SourceExpr->
getExprLoc() : getLocation();
1106 assert((!V || SourceExpr) &&
1107 "unique OVEs are expected to have source expressions");
1108 OpaqueValueExprBits.IsUnique =
V;
1111 bool isUnique()
const {
return OpaqueValueExprBits.IsUnique; }
1144 NamedDecl *, ASTTemplateKWAndArgsInfo,
1145 TemplateArgumentLoc> {
1157 size_t numTrailingObjects(OverloadToken<NestedNameSpecifierLoc>)
const {
1158 return hasQualifier();
1161 size_t numTrailingObjects(OverloadToken<NamedDecl *>)
const {
1162 return hasFoundDecl();
1165 size_t numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>)
const {
1166 return hasTemplateKWAndArgsInfo();
1171 bool hasFoundDecl()
const {
return DeclRefExprBits.HasFoundDecl; }
1175 bool RefersToEnlosingVariableOrCapture,
1185 void computeDependence(
const ASTContext &Ctx);
1189 bool RefersToEnclosingVariableOrCapture,
QualType T,
1205 bool RefersToEnclosingVariableOrCapture,
1214 bool HasTemplateKWAndArgsInfo,
1215 unsigned NumTemplateArgs);
1237 if (!hasQualifier())
1239 return *getTrailingObjects<NestedNameSpecifierLoc>();
1245 return getQualifierLoc().getNestedNameSpecifier();
1255 return hasFoundDecl() ? *getTrailingObjects<NamedDecl *>() : D;
1261 return hasFoundDecl() ? *getTrailingObjects<NamedDecl *>() : D;
1265 return DeclRefExprBits.HasTemplateKWAndArgsInfo;
1271 if (!hasTemplateKWAndArgsInfo())
1273 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->TemplateKWLoc;
1279 if (!hasTemplateKWAndArgsInfo())
1281 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->LAngleLoc;
1287 if (!hasTemplateKWAndArgsInfo())
1289 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->RAngleLoc;
1303 if (hasExplicitTemplateArgs())
1304 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->copyInto(
1305 getTrailingObjects<TemplateArgumentLoc>(), List);
1311 if (!hasExplicitTemplateArgs())
1313 return getTrailingObjects<TemplateArgumentLoc>();
1319 if (!hasExplicitTemplateArgs())
1321 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->NumTemplateArgs;
1325 return {getTemplateArgs(), getNumTemplateArgs()};
1331 return DeclRefExprBits.HadMultipleCandidates;
1337 DeclRefExprBits.HadMultipleCandidates =
V;
1348 return DeclRefExprBits.RefersToEnclosingVariableOrCapture;
1380 bool hasAllocation()
const {
return llvm::APInt::getNumWords(BitWidth) > 1; }
1389 unsigned NumWords = llvm::APInt::getNumWords(BitWidth);
1391 return llvm::APInt(BitWidth, NumWords, pVal);
1393 return llvm::APInt(BitWidth, VAL);
1395 void setIntValue(
const ASTContext &
C,
const llvm::APInt &Val);
1402 setIntValue(C, Val);
1408 llvm::APFloat
getValue(
const llvm::fltSemantics &Semantics)
const {
1409 return llvm::APFloat(Semantics, getIntValue());
1412 setIntValue(C, Val.bitcastToAPInt());
1421 :
Expr(IntegerLiteralClass, Empty) { }
1465 :
Expr(FixedPointLiteralClass, Empty) {}
1473 const llvm::APInt &V,
1489 std::string getValueAsString(
unsigned Radix)
const;
1519 Value(value), Loc(l) {
1520 CharacterLiteralBits.Kind =
kind;
1528 return static_cast<CharacterKind>(CharacterLiteralBits.Kind);
1571 assert(&getSemantics() == &Val.getSemantics() &&
"Inconsistent semantics");
1578 return static_cast<llvm::APFloatBase::Semantics
>(
1579 FloatingLiteralBits.Semantics);
1585 FloatingLiteralBits.Semantics = Sem;
1590 return llvm::APFloatBase::EnumToSemantics(
1591 static_cast<llvm::APFloatBase::Semantics>(
1592 FloatingLiteralBits.Semantics));
1597 FloatingLiteralBits.Semantics = llvm::APFloatBase::SemanticsToEnum(Sem);
1600 bool isExact()
const {
return FloatingLiteralBits.IsExact; }
1601 void setExact(
bool E) { FloatingLiteralBits.IsExact = E; }
1606 double getValueAsApproximateDouble()
const;
1642 :
Expr(ImaginaryLiteralClass, Empty) { }
1706 unsigned numTrailingObjects(OverloadToken<unsigned>)
const {
return 1; }
1707 unsigned numTrailingObjects(OverloadToken<SourceLocation>)
const {
1708 return getNumConcatenated();
1711 unsigned numTrailingObjects(OverloadToken<char>)
const {
1712 return getByteLength();
1715 char *getStrDataAsChar() {
return getTrailingObjects<char>(); }
1716 const char *getStrDataAsChar()
const {
return getTrailingObjects<char>(); }
1718 const uint16_t *getStrDataAsUInt16()
const {
1719 return reinterpret_cast<const uint16_t *
>(getTrailingObjects<char>());
1722 const uint32_t *getStrDataAsUInt32()
const {
1723 return reinterpret_cast<const uint32_t *
>(getTrailingObjects<char>());
1729 unsigned NumConcatenated);
1733 unsigned CharByteWidth);
1740 assert(TokNum < getNumConcatenated() &&
"Invalid tok number");
1741 getTrailingObjects<SourceLocation>()[TokNum] = L;
1750 unsigned NumConcatenated);
1756 return Create(Ctx, Str, Kind, Pascal, Ty, &Loc, 1);
1761 unsigned NumConcatenated,
unsigned Length,
1762 unsigned CharByteWidth);
1765 assert(getCharByteWidth() == 1 &&
1766 "This function is used in places that assume strings use char");
1767 return StringRef(getStrDataAsChar(), getByteLength());
1774 return StringRef(getStrDataAsChar(), getByteLength());
1777 void outputString(raw_ostream &OS)
const;
1780 assert(i < getLength() &&
"out of bounds access");
1781 switch (getCharByteWidth()) {
1783 return static_cast<unsigned char>(getStrDataAsChar()[
i]);
1785 return getStrDataAsUInt16()[
i];
1787 return getStrDataAsUInt32()[
i];
1789 llvm_unreachable(
"Unsupported character width!");
1793 unsigned getLength()
const {
return *getTrailingObjects<unsigned>(); }
1797 return static_cast<StringKind>(StringLiteralBits.Kind);
1805 bool isPascal()
const {
return StringLiteralBits.IsPascal; }
1808 for (
auto c : getString())
1815 for (
auto c : getString())
1824 return StringLiteralBits.NumConcatenated;
1829 assert(TokNum < getNumConcatenated() &&
"Invalid tok number");
1830 return getTrailingObjects<SourceLocation>()[TokNum];
1843 unsigned *StartToken =
nullptr,
1844 unsigned *StartTokenByteOffset =
nullptr)
const;
1849 return getTrailingObjects<SourceLocation>();
1853 return getTrailingObjects<SourceLocation>() + getNumConcatenated();
1894 PrettyFunctionNoVirtual
1904 bool hasFunctionName()
const {
return PredefinedExprBits.HasFunctionName; }
1907 assert(hasFunctionName() &&
1908 "This PredefinedExpr has no storage for a function name!");
1909 *getTrailingObjects<Stmt *>() = SL;
1919 bool HasFunctionName);
1922 return static_cast<IdentKind>(PredefinedExprBits.Kind);
1929 return hasFunctionName()
1930 ?
static_cast<StringLiteral *
>(*getTrailingObjects<Stmt *>())
1935 return hasFunctionName()
1936 ?
static_cast<StringLiteral *
>(*getTrailingObjects<Stmt *>())
1940 static StringRef getIdentKindName(
IdentKind IK);
1941 static std::string ComputeName(
IdentKind IK,
const Decl *CurrentDecl);
1953 getTrailingObjects<Stmt *>() + hasFunctionName());
1958 getTrailingObjects<Stmt *>() + hasFunctionName());
1969 :
Expr(ParenExprClass, val->getType(),
1970 val->getValueKind(), val->getObjectKind(),
1971 val->isTypeDependent(), val->isValueDependent(),
1972 val->isInstantiationDependent(),
1973 val->containsUnexpandedParameterPack()),
1974 L(l), R(r), Val(val) {}
1978 :
Expr(ParenExprClass, Empty) { }
2024 :
Expr(UnaryOperatorClass, type, VK, OK,
2025 input->isTypeDependent() || type->isDependentType(),
2026 input->isValueDependent(),
2027 (input->isInstantiationDependent() ||
2028 type->isInstantiationDependentType()),
2029 input->containsUnexpandedParameterPack()),
2031 UnaryOperatorBits.Opc = opc;
2032 UnaryOperatorBits.CanOverflow = CanOverflow;
2033 UnaryOperatorBits.Loc = l;
2038 UnaryOperatorBits.Opc = UO_AddrOf;
2042 return static_cast<Opcode
>(UnaryOperatorBits.Opc);
2064 return Op == UO_PostInc || Op == UO_PostDec;
2069 return Op == UO_PreInc || Op == UO_PreDec;
2076 return Op == UO_PreInc || Op == UO_PostInc;
2079 return isIncrementOp(getOpcode());
2083 return Op == UO_PreDec || Op == UO_PostDec;
2086 return isDecrementOp(getOpcode());
2091 return isIncrementDecrementOp(getOpcode());
2095 return Op >= UO_Plus && Op <= UO_LNot;
2101 static StringRef getOpcodeStr(Opcode Op);
2112 return isPostfix() ? Val->
getBeginLoc() : getOperatorLoc();
2115 return isPostfix() ? getOperatorLoc() : Val->
getEndLoc();
2149 enum { MaskBits = 2, Mask = 0x03 };
2169 : Range(LBracketLoc, RBracketLoc), Data((Index << 2) | Array) {}
2173 : Range(DotLoc.isValid() ? DotLoc : NameLoc, NameLoc),
2179 : Range(DotLoc.isValid() ? DotLoc : NameLoc, NameLoc),
2248 size_t numTrailingObjects(OverloadToken<OffsetOfNode>)
const {
2257 explicit OffsetOfExpr(
unsigned numComps,
unsigned numExprs)
2259 TSInfo(
nullptr), NumComps(numComps), NumExprs(numExprs) {}
2269 unsigned NumComps,
unsigned NumExprs);
2287 assert(Idx < NumComps &&
"Subscript out of range");
2288 return getTrailingObjects<OffsetOfNode>()[Idx];
2292 assert(Idx < NumComps &&
"Subscript out of range");
2293 getTrailingObjects<OffsetOfNode>()[Idx] = ON;
2301 assert(Idx < NumExprs &&
"Subscript out of range");
2302 return getTrailingObjects<Expr *>()[Idx];
2306 assert(Idx < NumExprs &&
"Subscript out of range");
2307 return getTrailingObjects<Expr *>()[Idx];
2311 assert(Idx < NumComps &&
"Subscript out of range");
2312 getTrailingObjects<Expr *>()[Idx] = E;
2328 Stmt **begin =
reinterpret_cast<Stmt **
>(getTrailingObjects<Expr *>());
2332 Stmt *
const *begin =
2333 reinterpret_cast<Stmt *
const *
>(getTrailingObjects<Expr *>());
2356 TInfo->getType()->isDependentType(),
2357 TInfo->getType()->isInstantiationDependentType(),
2358 TInfo->getType()->containsUnexpandedParameterPack()),
2359 OpLoc(op), RParenLoc(rp) {
2360 UnaryExprOrTypeTraitExprBits.Kind = ExprKind;
2361 UnaryExprOrTypeTraitExprBits.IsType =
true;
2362 Argument.Ty = TInfo;
2371 :
Expr(UnaryExprOrTypeTraitExprClass, Empty) { }
2380 return getArgumentTypeInfo()->getType();
2383 assert(isArgumentType() &&
"calling getArgumentType() when arg is expr");
2387 assert(!isArgumentType() &&
"calling getArgumentExpr() when arg is type");
2388 return static_cast<Expr*
>(Argument.Ex);
2396 UnaryExprOrTypeTraitExprBits.IsType =
false;
2399 Argument.Ty = TInfo;
2400 UnaryExprOrTypeTraitExprBits.IsType =
true;
2406 return isArgumentType() ? getArgumentType() : getArgumentExpr()->getType();
2419 return T->
getStmtClass() == UnaryExprOrTypeTraitExprClass;
2433 enum { LHS, RHS, END_EXPR };
2434 Stmt *SubExprs[END_EXPR];
2436 bool lhsIsBase()
const {
return getRHS()->getType()->isIntegerType(); }
2442 :
Expr(ArraySubscriptExprClass, t, VK, OK,
2443 lhs->isTypeDependent() || rhs->isTypeDependent(),
2444 lhs->isValueDependent() || rhs->isValueDependent(),
2445 (lhs->isInstantiationDependent() ||
2446 rhs->isInstantiationDependent()),
2447 (lhs->containsUnexpandedParameterPack() ||
2448 rhs->containsUnexpandedParameterPack())) {
2449 SubExprs[LHS] = lhs;
2450 SubExprs[RHS] = rhs;
2451 ArraySubscriptExprBits.RBracketLoc = rbracketloc;
2456 :
Expr(ArraySubscriptExprClass, Shell) { }
2476 const Expr *
getBase()
const {
return lhsIsBase() ? getLHS() : getRHS(); }
2479 const Expr *
getIdx()
const {
return lhsIsBase() ? getRHS() : getLHS(); }
2482 return getLHS()->getBeginLoc();
2487 return ArraySubscriptExprBits.RBracketLoc;
2490 ArraySubscriptExprBits.RBracketLoc = L;
2494 return getBase()->getExprLoc();
2503 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
2517 enum { FN = 0, PREARGS_START = 1 };
2526 void updateDependenciesFromArg(
Expr *Arg);
2550 Stmt **getTrailingStmts() {
2551 return reinterpret_cast<Stmt **
>(
reinterpret_cast<char *
>(
this) +
2552 CallExprBits.OffsetToTrailingObjects);
2554 Stmt *
const *getTrailingStmts()
const {
2555 return const_cast<CallExpr *
>(
this)->getTrailingStmts();
2560 static unsigned offsetToTrailingObjects(
StmtClass SC);
2581 return (1 + NumPreArgs + NumArgs) *
sizeof(
Stmt *);
2585 assert(I < getNumPreArgs() &&
"Prearg access out of range!");
2586 return getTrailingStmts()[PREARGS_START + I];
2589 assert(I < getNumPreArgs() &&
"Prearg access out of range!");
2590 return getTrailingStmts()[PREARGS_START + I];
2593 assert(I < getNumPreArgs() &&
"Prearg access out of range!");
2594 getTrailingStmts()[PREARGS_START + I] = PreArg;
2639 return static_cast<ADLCallKind>(CallExprBits.UsesADL);
2642 CallExprBits.UsesADL =
static_cast<bool>(
V);
2644 bool usesADL()
const {
return getADLCallKind() == UsesADL; }
2648 return getCallee()->getReferencedDeclOfCallee();
2653 return dyn_cast_or_null<FunctionDecl>(getCalleeDecl());
2656 return dyn_cast_or_null<FunctionDecl>(getCalleeDecl());
2664 return reinterpret_cast<Expr **
>(getTrailingStmts() + PREARGS_START +
2668 return reinterpret_cast<const Expr *
const *
>(
2669 getTrailingStmts() + PREARGS_START + getNumPreArgs());
2674 assert(Arg < getNumArgs() &&
"Arg access out of range!");
2675 return getArgs()[Arg];
2678 assert(Arg < getNumArgs() &&
"Arg access out of range!");
2679 return getArgs()[Arg];
2684 assert(Arg < getNumArgs() &&
"Arg access out of range!");
2685 getArgs()[Arg] = ArgExpr;
2695 assert((NewNumArgs <= getNumArgs()) &&
2696 "shrinkNumArgs cannot increase the number of arguments!");
2697 NumArgs = NewNumArgs;
2710 arg_range
arguments() {
return arg_range(arg_begin(), arg_end()); }
2712 return const_arg_range(arg_begin(), arg_end());
2716 return getTrailingStmts() + PREARGS_START + getNumPreArgs();
2718 arg_iterator
arg_end() {
return arg_begin() + getNumArgs(); }
2721 return getTrailingStmts() + PREARGS_START + getNumPreArgs();
2723 const_arg_iterator
arg_end()
const {
return arg_begin() + getNumArgs(); }
2730 return llvm::makeArrayRef(getTrailingStmts(),
2731 PREARGS_START + getNumPreArgs() + getNumArgs());
2736 unsigned getNumCommas()
const {
return getNumArgs() ? getNumArgs() - 1 : 0; }
2740 unsigned getBuiltinCallee()
const;
2744 bool isUnevaluatedBuiltinCall(
const ASTContext &Ctx)
const;
2757 return getUnusedResultAttr(Ctx) !=
nullptr;
2783 return child_range(getTrailingStmts(), getTrailingStmts() + PREARGS_START +
2784 getNumPreArgs() + getNumArgs());
2789 getTrailingStmts() + PREARGS_START +
2790 getNumPreArgs() + getNumArgs());
2810 ASTTemplateKWAndArgsInfo,
2811 TemplateArgumentLoc> {
2832 size_t numTrailingObjects(OverloadToken<MemberExprNameQualifier>)
const {
2833 return hasQualifierOrFoundDecl();
2836 size_t numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>)
const {
2837 return hasTemplateKWAndArgsInfo();
2840 bool hasQualifierOrFoundDecl()
const {
2841 return MemberExprBits.HasQualifierOrFoundDecl;
2844 bool hasTemplateKWAndArgsInfo()
const {
2845 return MemberExprBits.HasTemplateKWAndArgsInfo;
2853 :
Expr(MemberExprClass, Empty), Base(), MemberDecl() {}
2880 bool HasTemplateKWAndArgsInfo,
2881 unsigned NumTemplateArgs);
2895 if (!hasQualifierOrFoundDecl())
2897 getMemberDecl()->getAccess());
2898 return getTrailingObjects<MemberExprNameQualifier>()->FoundDecl;
2910 if (!hasQualifierOrFoundDecl())
2912 return getTrailingObjects<MemberExprNameQualifier>()->QualifierLoc;
2919 return getQualifierLoc().getNestedNameSpecifier();
2925 if (!hasTemplateKWAndArgsInfo())
2927 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->TemplateKWLoc;
2933 if (!hasTemplateKWAndArgsInfo())
2935 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->LAngleLoc;
2941 if (!hasTemplateKWAndArgsInfo())
2943 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->RAngleLoc;
2956 if (hasExplicitTemplateArgs())
2957 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->copyInto(
2958 getTrailingObjects<TemplateArgumentLoc>(), List);
2964 if (!hasExplicitTemplateArgs())
2967 return getTrailingObjects<TemplateArgumentLoc>();
2973 if (!hasExplicitTemplateArgs())
2976 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->NumTemplateArgs;
2980 return {getTemplateArgs(), getNumTemplateArgs()};
2986 MemberLoc, MemberDNLoc);
2991 bool isArrow()
const {
return MemberExprBits.IsArrow; }
3006 return getBase() && getBase()->isImplicitCXXThis();
3012 return MemberExprBits.HadMultipleCandidates;
3018 MemberExprBits.HadMultipleCandidates =
V;
3026 return LO.AppleKext || !hasQualifier();
3057 llvm::PointerIntPair<TypeSourceInfo *, 1, bool> TInfoAndScope;
3063 tinfo->getType()->isDependentType(),
3064 init->isValueDependent(),
3065 (init->isInstantiationDependent() ||
3066 tinfo->getType()->isInstantiationDependentType()),
3067 init->containsUnexpandedParameterPack()),
3068 LParenLoc(lparenloc), TInfoAndScope(tinfo, fileScope), Init(init) {}
3072 :
Expr(CompoundLiteralExprClass, Empty) { }
3085 return TInfoAndScope.getPointer();
3088 TInfoAndScope.setPointer(tinfo);
3124 bool CastConsistency()
const;
3127 return const_cast<CastExpr*
>(
this)->path_buffer();
3133 Expr *op,
unsigned BasePathSize)
3137 ty->isDependentType(),
3140 ty->isDependentType() || (op && op->isValueDependent()),
3141 (ty->isInstantiationDependentType() ||
3142 (op && op->isInstantiationDependent())),
3145 ((SC != ImplicitCastExprClass &&
3146 ty->containsUnexpandedParameterPack()) ||
3147 (op && op->containsUnexpandedParameterPack()))),
3149 CastExprBits.Kind =
kind;
3150 CastExprBits.PartOfExplicitCast =
false;
3151 CastExprBits.BasePathSize = BasePathSize;
3152 assert((CastExprBits.BasePathSize == BasePathSize) &&
3153 "BasePathSize overflow!");
3154 assert(CastConsistency());
3160 CastExprBits.PartOfExplicitCast =
false;
3161 CastExprBits.BasePathSize = BasePathSize;
3162 assert((CastExprBits.BasePathSize == BasePathSize) &&
3163 "BasePathSize overflow!");
3170 static const char *getCastKindName(
CastKind CK);
3180 Expr *getSubExprAsWritten();
3182 return const_cast<CastExpr *
>(
this)->getSubExprAsWritten();
3187 NamedDecl *getConversionFunction()
const;
3192 unsigned path_size()
const {
return CastExprBits.BasePathSize; }
3194 path_iterator
path_end() {
return path_buffer() + path_size(); }
3196 path_const_iterator
path_end()
const {
return path_buffer() + path_size(); }
3198 llvm::iterator_range<path_iterator>
path() {
3199 return llvm::make_range(path_begin(), path_end());
3201 llvm::iterator_range<path_const_iterator>
path()
const {
3202 return llvm::make_range(path_begin(), path_end());
3206 assert(getCastKind() == CK_ToUnion);
3207 return getTargetFieldForToUnionCast(getType(), getSubExpr()->getType());
3251 :
CastExpr(ImplicitCastExprClass, ty, VK, kind, op, BasePathLength) { }
3254 explicit ImplicitCastExpr(
EmptyShell Shell,
unsigned PathSize)
3255 :
CastExpr(ImplicitCastExprClass, Shell, PathSize) { }
3261 :
CastExpr(ImplicitCastExprClass, ty, VK, kind, op, 0) {
3266 CastExprBits.PartOfExplicitCast = PartOfExplicitCast;
3278 return getSubExpr()->getBeginLoc();
3281 return getSubExpr()->getEndLoc();
3317 :
CastExpr(SC, exprTy, VK, kind, op, PathSize), TInfo(writtenTy) {}
3321 :
CastExpr(SC, Shell, PathSize) { }
3334 return T->
getStmtClass() >= firstExplicitCastExprConstant &&
3352 writtenTy), LPLoc(l), RPLoc(r) {}
3376 return getSubExpr()->getEndLoc();
3406 enum { LHS, RHS, END_EXPR };
3407 Stmt *SubExprs[END_EXPR];
3415 :
Expr(BinaryOperatorClass, ResTy, VK, OK,
3416 lhs->isTypeDependent() || rhs->isTypeDependent(),
3417 lhs->isValueDependent() || rhs->isValueDependent(),
3418 (lhs->isInstantiationDependent() ||
3419 rhs->isInstantiationDependent()),
3420 (lhs->containsUnexpandedParameterPack() ||
3421 rhs->containsUnexpandedParameterPack())) {
3422 BinaryOperatorBits.Opc = opc;
3423 BinaryOperatorBits.FPFeatures = FPFeatures.
getInt();
3424 BinaryOperatorBits.OpLoc = opLoc;
3425 SubExprs[LHS] = lhs;
3426 SubExprs[RHS] = rhs;
3427 assert(!isCompoundAssignmentOp() &&
3428 "Use CompoundAssignOperator for compound assignments");
3433 BinaryOperatorBits.Opc = BO_Comma;
3441 return static_cast<Opcode
>(BinaryOperatorBits.Opc);
3443 void setOpcode(Opcode Opc) { BinaryOperatorBits.Opc = Opc; }
3451 return getLHS()->getBeginLoc();
3454 return getRHS()->getEndLoc();
3459 static StringRef getOpcodeStr(Opcode Op);
3473 return Opc == BO_PtrMemD || Opc == BO_PtrMemI;
3478 return Opc >= BO_Mul && Opc <= BO_Rem;
3481 static bool isAdditiveOp(Opcode Opc) {
return Opc == BO_Add || Opc==BO_Sub; }
3483 static bool isShiftOp(Opcode Opc) {
return Opc == BO_Shl || Opc == BO_Shr; }
3486 static bool isBitwiseOp(Opcode Opc) {
return Opc >= BO_And && Opc <= BO_Or; }
3492 static bool isEqualityOp(Opcode Opc) {
return Opc == BO_EQ || Opc == BO_NE; }
3498 static bool isCommaOp(Opcode Opc) {
return Opc == BO_Comma; }
3504 llvm_unreachable(
"Not a comparison operator.");
3505 case BO_LT:
return BO_GE;
3506 case BO_GT:
return BO_LE;
3507 case BO_LE:
return BO_GT;
3508 case BO_GE:
return BO_LT;
3509 case BO_EQ:
return BO_NE;
3510 case BO_NE:
return BO_EQ;
3517 llvm_unreachable(
"Not a comparison operator.");
3518 case BO_LT:
return BO_GT;
3519 case BO_GT:
return BO_LT;
3520 case BO_LE:
return BO_GE;
3521 case BO_GE:
return BO_LE;
3528 static bool isLogicalOp(Opcode Opc) {
return Opc == BO_LAnd || Opc==BO_LOr; }
3532 return Opc >= BO_Assign && Opc <= BO_OrAssign;
3537 return Opc > BO_Assign && Opc <= BO_OrAssign;
3540 return isCompoundAssignmentOp(getOpcode());
3543 assert(isCompoundAssignmentOp(Opc));
3544 if (Opc >= BO_AndAssign)
3545 return Opcode(
unsigned(Opc) - BO_AndAssign + BO_And);
3547 return Opcode(
unsigned(Opc) - BO_MulAssign + BO_Mul);
3551 return Opc == BO_ShlAssign || Opc == BO_ShrAssign;
3554 return isShiftAssignOp(getOpcode());
3560 static bool isNullPointerArithmeticExtension(
ASTContext &Ctx, Opcode Opc,
3564 return S->
getStmtClass() >= firstBinaryOperatorConstant &&
3570 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
3579 BinaryOperatorBits.FPFeatures = F.
getInt();
3583 return FPOptions(BinaryOperatorBits.FPFeatures);
3589 return getFPFeatures().allowFPContractWithinStatement();
3600 :
Expr(CompoundAssignOperatorClass, ResTy, VK, OK,
3601 lhs->isTypeDependent() || rhs->isTypeDependent(),
3602 lhs->isValueDependent() || rhs->isValueDependent(),
3603 (lhs->isInstantiationDependent() ||
3604 rhs->isInstantiationDependent()),
3605 (lhs->containsUnexpandedParameterPack() ||
3606 rhs->containsUnexpandedParameterPack())) {
3607 BinaryOperatorBits.Opc = opc;
3608 BinaryOperatorBits.FPFeatures = FPFeatures.
getInt();
3609 BinaryOperatorBits.OpLoc = opLoc;
3610 SubExprs[LHS] = lhs;
3611 SubExprs[RHS] = rhs;
3615 BinaryOperatorBits.Opc = BO_MulAssign;
3633 :
BinaryOperator(lhs, rhs, opc, ResType, VK, OK, OpLoc, FPFeatures,
3635 ComputationLHSType(CompLHSType),
3636 ComputationResultType(CompResultType) {
3637 assert(isCompoundAssignmentOp() &&
3638 "Only should be used for compound assignments");
3655 return S->
getStmtClass() == CompoundAssignOperatorClass;
3668 bool TD,
bool VD,
bool ID,
3669 bool ContainsUnexpandedParameterPack,
3672 :
Expr(SC, T, VK, OK, TD, VD, ID, ContainsUnexpandedParameterPack),
3673 QuestionLoc(qloc), ColonLoc(cloc) {}
3676 :
Expr(SC, Empty) { }
3681 Expr *getCond()
const;
3685 Expr *getTrueExpr()
const;
3690 Expr *getFalseExpr()
const;
3696 return T->
getStmtClass() == ConditionalOperatorClass ||
3704 enum { COND, LHS, RHS, END_EXPR };
3705 Stmt* SubExprs[END_EXPR];
3716 (lhs->isTypeDependent() || rhs->isTypeDependent()),
3717 (cond->isValueDependent() || lhs->isValueDependent() ||
3718 rhs->isValueDependent()),
3719 (cond->isInstantiationDependent() ||
3720 lhs->isInstantiationDependent() ||
3721 rhs->isInstantiationDependent()),
3722 (cond->containsUnexpandedParameterPack() ||
3723 lhs->containsUnexpandedParameterPack() ||
3724 rhs->containsUnexpandedParameterPack()),
3726 SubExprs[COND] = cond;
3727 SubExprs[LHS] = lhs;
3728 SubExprs[RHS] = rhs;
3752 return getCond()->getBeginLoc();
3755 return getRHS()->getEndLoc();
3764 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
3777 enum { COMMON, COND, LHS, RHS, NUM_SUBEXPRS };
3784 Stmt *SubExprs[NUM_SUBEXPRS];
3794 (common->isTypeDependent() || rhs->isTypeDependent()),
3795 (common->isValueDependent() || rhs->isValueDependent()),
3796 (common->isInstantiationDependent() ||
3797 rhs->isInstantiationDependent()),
3798 (common->containsUnexpandedParameterPack() ||
3799 rhs->containsUnexpandedParameterPack()),
3801 OpaqueValue(opaqueValue) {
3802 SubExprs[COMMON] = common;
3803 SubExprs[COND] = cond;
3804 SubExprs[LHS] = lhs;
3805 SubExprs[RHS] = rhs;
3806 assert(OpaqueValue->
getSourceExpr() == common &&
"Wrong opaque value");
3829 return cast<Expr>(SubExprs[LHS]);
3836 return cast<Expr>(SubExprs[RHS]);
3840 return getCommon()->getBeginLoc();
3843 return getFalseExpr()->getEndLoc();
3847 return T->
getStmtClass() == BinaryConditionalOperatorClass;
3852 return child_range(SubExprs, SubExprs + NUM_SUBEXPRS);
3861 return co->getCond();
3862 return cast<BinaryConditionalOperator>(
this)->getCond();
3867 return co->getTrueExpr();
3868 return cast<BinaryConditionalOperator>(
this)->getTrueExpr();
3873 return co->getFalseExpr();
3874 return cast<BinaryConditionalOperator>(
this)->getFalseExpr();
3886 AmpAmpLoc(AALoc), LabelLoc(LLoc), Label(L) {}
3890 :
Expr(AddrLabelExprClass, Empty) { }
3933 SubStmt(substmt), LParenLoc(lp), RParenLoc(rp) { }
3983 :
Expr(ShuffleVectorExprClass, Empty), SubExprs(nullptr) { }
4008 assert((Index < NumExprs) &&
"Arg access out of range!");
4009 return cast<Expr>(SubExprs[Index]);
4012 assert((Index < NumExprs) &&
"Arg access out of range!");
4013 return cast<Expr>(SubExprs[Index]);
4019 assert((N < NumExprs - 2) &&
"Shuffle idx out of range!");
4020 return getExpr(N+2)->EvaluateKnownConstInt(Ctx);
4025 return child_range(&SubExprs[0], &SubExprs[0]+NumExprs);
4049 :
Expr(ConvertVectorExprClass, DstType, VK, OK,
4050 DstType->isDependentType(),
4051 DstType->isDependentType() || SrcExpr->isValueDependent(),
4052 (DstType->isInstantiationDependentType() ||
4053 SrcExpr->isInstantiationDependent()),
4054 (DstType->containsUnexpandedParameterPack() ||
4055 SrcExpr->containsUnexpandedParameterPack())),
4056 SrcExpr(SrcExpr), TInfo(TI), BuiltinLoc(BuiltinLoc), RParenLoc(RParenLoc) {}
4099 enum { COND, LHS, RHS, END_EXPR };
4100 Stmt* SubExprs[END_EXPR];
4107 bool TypeDependent,
bool ValueDependent)
4108 :
Expr(ChooseExprClass, t, VK, OK, TypeDependent, ValueDependent,
4109 (cond->isInstantiationDependent() ||
4110 lhs->isInstantiationDependent() ||
4111 rhs->isInstantiationDependent()),
4112 (cond->containsUnexpandedParameterPack() ||
4113 lhs->containsUnexpandedParameterPack() ||
4114 rhs->containsUnexpandedParameterPack())),
4115 BuiltinLoc(BLoc), RParenLoc(RP), CondIsTrue(condIsTrue) {
4116 SubExprs[COND] = cond;
4117 SubExprs[LHS] = lhs;
4118 SubExprs[RHS] = rhs;
4127 assert(!isConditionDependent() &&
4128 "Dependent condition isn't true or false");
4134 return getCond()->isTypeDependent() || getCond()->isValueDependent();
4140 return isConditionTrue() ? getLHS() : getRHS();
4165 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
4214 llvm::PointerIntPair<TypeSourceInfo *, 1, bool> TInfo;
4220 false, (TInfo->getType()->isInstantiationDependentType() ||
4221 e->isInstantiationDependent()),
4222 (TInfo->getType()->containsUnexpandedParameterPack() ||
4223 e->containsUnexpandedParameterPack())),
4224 Val(e), TInfo(TInfo, IsMS), BuiltinLoc(BLoc), RParenLoc(RPLoc) {}
4228 :
Expr(VAArgExprClass, Empty), Val(nullptr), TInfo(nullptr,
false) {}
4279 const Expr *DefaultExpr)
const;
4282 StringRef getBuiltinStr()
const;
4285 return static_cast<IdentKind>(SourceLocExprBits.Kind);
4289 switch (getIdentKind()) {
4297 llvm_unreachable(
"unknown source location expression kind");
4299 bool isIntType() const LLVM_READONLY {
return !isStringType(); }
4374 InitExprsTy InitExprs;
4382 llvm::PointerIntPair<InitListExpr *, 1, bool> AltForm;
4391 llvm::PointerUnion<Expr *, FieldDecl *> ArrayFillerOrUnionFieldInit;
4399 :
Expr(InitListExprClass, Empty), AltForm(nullptr,
true) { }
4408 return reinterpret_cast<Expr *
const *
>(InitExprs.
data());
4412 return llvm::makeArrayRef(
getInits(), getNumInits());
4416 return llvm::makeArrayRef(
getInits(), getNumInits());
4420 assert(Init < getNumInits() &&
"Initializer access out of range!");
4421 return cast_or_null<Expr>(InitExprs[Init]);
4425 assert(Init < getNumInits() &&
"Initializer access out of range!");
4426 return cast_or_null<Expr>(InitExprs[Init]);
4430 assert(Init < getNumInits() &&
"Initializer access out of range!");
4431 InitExprs[Init] =
expr;
4437 ExprBits.ContainsUnexpandedParameterPack |=
4443 void reserveInits(
const ASTContext &C,
unsigned NumInits);
4451 void resizeInits(
const ASTContext &Context,
unsigned NumInits);
4466 return ArrayFillerOrUnionFieldInit.dyn_cast<
Expr *>();
4469 return const_cast<InitListExpr *
>(
this)->getArrayFiller();
4471 void setArrayFiller(
Expr *filler);
4484 return ArrayFillerOrUnionFieldInit.dyn_cast<
FieldDecl *>();
4487 return const_cast<InitListExpr *
>(
this)->getInitializedFieldInUnion();
4490 assert((FD ==
nullptr 4491 || getInitializedFieldInUnion() ==
nullptr 4492 || getInitializedFieldInUnion() == FD)
4493 &&
"Only one field of a union may be initialized at a time!");
4494 ArrayFillerOrUnionFieldInit = FD;
4505 bool isStringLiteralInit()
const;
4510 bool isTransparent()
const;
4514 bool isIdiomaticZeroInitializer(
const LangOptions &LangOpts)
const;
4523 return isSemanticForm() ? nullptr : AltForm.getPointer();
4526 return !AltForm.getInt() || !AltForm.getPointer();
4529 return isSemanticForm() ? AltForm.getPointer() :
nullptr;
4533 AltForm.setPointer(Init);
4534 AltForm.setInt(
true);
4535 Init->AltForm.setPointer(
this);
4536 Init->AltForm.setInt(
false);
4540 return InitListExprBits.HadArrayRangeDesignator != 0;
4543 InitListExprBits.HadArrayRangeDesignator = ARD;
4562 if (InitExprs.
empty())
4575 const_iterator
end()
const {
return InitExprs.
end(); }
4579 const_reverse_iterator
rend()
const {
return InitExprs.
rend(); }
4619 unsigned GNUSyntax : 1;
4622 unsigned NumDesignators : 15;
4627 unsigned NumSubExprs : 16;
4640 NumDesignators(0), NumSubExprs(NumSubExprs), Designators(
nullptr) { }
4685 ArrayRangeDesignator
4703 Field.NameOrField =
reinterpret_cast<uintptr_t>(FieldName) | 0x01;
4711 : Kind(ArrayDesignator) {
4712 ArrayOrRange.
Index = Index;
4721 : Kind(ArrayRangeDesignator) {
4722 ArrayOrRange.
Index = Index;
4735 assert(Kind ==
FieldDesignator &&
"Only valid on a field designator");
4736 if (
Field.NameOrField & 0x01)
4743 assert(Kind ==
FieldDesignator &&
"Only valid on a field designator");
4748 assert(Kind ==
FieldDesignator &&
"Only valid on a field designator");
4753 assert(Kind ==
FieldDesignator &&
"Only valid on a field designator");
4758 assert((Kind == ArrayDesignator || Kind == ArrayRangeDesignator) &&
4759 "Only valid on an array or array-range designator");
4764 assert((Kind == ArrayDesignator || Kind == ArrayRangeDesignator) &&
4765 "Only valid on an array or array-range designator");
4770 assert(Kind == ArrayRangeDesignator &&
4771 "Only valid on an array-range designator");
4776 assert((Kind == ArrayDesignator || Kind == ArrayRangeDesignator) &&
4777 "Only valid on an array or array-range designator");
4778 return ArrayOrRange.
Index;
4783 return getDotLoc().
isInvalid()? getFieldLoc() : getDotLoc();
4785 return getLBracketLoc();
4799 bool GNUSyntax,
Expr *Init);
4802 unsigned NumIndexExprs);
4805 unsigned size()
const {
return NumDesignators; }
4809 return {Designators, NumDesignators};
4813 return {Designators, NumDesignators};
4818 return &designators()[Idx];
4822 unsigned NumDesigs);
4844 *child_begin() = init;
4854 assert(Idx < NumSubExprs &&
"Subscript out of range");
4855 return cast<Expr>(getTrailingObjects<Stmt *>()[Idx]);
4859 assert(Idx < NumSubExprs &&
"Subscript out of range");
4860 getTrailingObjects<Stmt *>()[Idx] = E;
4865 void ExpandDesignator(
const ASTContext &C,
unsigned Idx,
4879 Stmt **begin = getTrailingObjects<Stmt *>();
4883 Stmt *
const *begin = getTrailingObjects<Stmt *>();
4906 :
Expr(NoInitExprClass, Empty) { }
4938 Stmt *BaseAndUpdaterExprs[2];
4945 :
Expr(DesignatedInitUpdateExprClass, Empty) { }
4951 return T->
getStmtClass() == DesignatedInitUpdateExprClass;
4958 return cast<InitListExpr>(BaseAndUpdaterExprs[1]);
4965 return child_range(&BaseAndUpdaterExprs[0], &BaseAndUpdaterExprs[0] + 2);
4969 &BaseAndUpdaterExprs[0] + 2);
4993 :
Expr(ArrayInitLoopExprClass, Empty), SubExprs{} {}
4998 CommonInit->isValueDependent() || ElementInit->isValueDependent(),
4999 T->isInstantiationDependentType(),
5000 CommonInit->containsUnexpandedParameterPack() ||
5001 ElementInit->containsUnexpandedParameterPack()),
5002 SubExprs{CommonInit, ElementInit} {}
5007 return cast<OpaqueValueExpr>(SubExprs[0]);
5014 return cast<ConstantArrayType>(getType()->castAsArrayTypeUnsafe())
5023 return getCommonExpr()->getBeginLoc();
5026 return getCommonExpr()->getEndLoc();
5046 :
Expr(ArrayInitIndexExprClass, Empty) {}
5087 :
Expr(ImplicitValueInitExprClass, Empty) { }
5090 return T->
getStmtClass() == ImplicitValueInitExprClass;
5134 assert(Init < getNumExprs() &&
"Initializer access out of range!");
5135 return getExprs()[Init];
5143 return reinterpret_cast<Expr **
>(getTrailingObjects<Stmt *>());
5147 return llvm::makeArrayRef(getExprs(), getNumExprs());
5162 getTrailingObjects<Stmt *>() + getNumExprs());
5166 getTrailingObjects<Stmt *>() + getNumExprs());
5208 unsigned NumAssocs, ResultIndex;
5211 ControllingIndex = 0,
5212 AssocExprStartIndex = 1
5225 unsigned numTrailingObjects(OverloadToken<Stmt *>)
const {
5228 return 1 + getNumAssocs();
5231 unsigned numTrailingObjects(OverloadToken<TypeSourceInfo *>)
const {
5232 return getNumAssocs();
5235 template <
bool Const>
class AssociationIteratorTy;
5239 template <
bool Const>
class AssociationTy {
5241 template <
bool OtherConst>
friend class AssociationIteratorTy;
5244 using TSIPtrTy =
typename std::conditional<Const,
const TypeSourceInfo *,
5249 AssociationTy(ExprPtrTy E, TSIPtrTy TSI,
bool Selected)
5250 : E(E), TSI(TSI), Selected(Selected) {}
5253 ExprPtrTy getAssociationExpr()
const {
return E; }
5254 TSIPtrTy getTypeSourceInfo()
const {
return TSI; }
5256 bool isSelected()
const {
return Selected; }
5257 AssociationTy *operator->() {
return this; }
5258 const AssociationTy *operator->()
const {
return this; }
5265 template <
bool Const>
5266 class AssociationIteratorTy
5267 :
public llvm::iterator_facade_base<
5268 AssociationIteratorTy<Const>, std::input_iterator_tag,
5269 AssociationTy<Const>, std::ptrdiff_t, AssociationTy<Const>,
5270 AssociationTy<Const>> {
5285 using BaseTy =
typename AssociationIteratorTy::iterator_facade_base;
5286 using StmtPtrPtrTy =
5289 typename std::conditional<Const,
const TypeSourceInfo *
const *,
5290 TypeSourceInfo **>
::type;
5293 unsigned Offset = 0, SelectedOffset = 0;
5294 AssociationIteratorTy(StmtPtrPtrTy E, TSIPtrPtrTy TSI,
unsigned Offset,
5295 unsigned SelectedOffset)
5296 : E(E), TSI(TSI), Offset(Offset), SelectedOffset(SelectedOffset) {}
5299 AssociationIteratorTy() : E(nullptr), TSI(nullptr) {}
5300 typename BaseTy::reference
operator*()
const {
5301 return AssociationTy<Const>(cast<Expr>(*E), *TSI,
5302 Offset == SelectedOffset);
5304 typename BaseTy::pointer operator->()
const {
return **
this; }
5305 using BaseTy::operator++;
5306 AssociationIteratorTy &operator++() {
5312 bool operator==(AssociationIteratorTy Other)
const {
return E == Other.E; }
5317 Expr *ControllingExpr,
5321 bool ContainsUnexpandedParameterPack,
5322 unsigned ResultIndex);
5326 Expr *ControllingExpr,
5330 bool ContainsUnexpandedParameterPack);
5342 unsigned ResultIndex);
5353 unsigned NumAssocs);
5361 llvm::iterator_range<ConstAssociationIterator>;
5370 assert(!isResultDependent() &&
5371 "Generic selection is result-dependent but getResultIndex called!");
5380 return cast<Expr>(getTrailingObjects<Stmt *>()[ControllingIndex]);
5383 return cast<Expr>(getTrailingObjects<Stmt *>()[ControllingIndex]);
5390 getTrailingObjects<Stmt *>()[AssocExprStartIndex + getResultIndex()]);
5394 getTrailingObjects<Stmt *>()[AssocExprStartIndex + getResultIndex()]);
5398 return {
reinterpret_cast<Expr *
const *
>(getTrailingObjects<Stmt *>() +
5399 AssocExprStartIndex),
5403 return {getTrailingObjects<TypeSourceInfo *>(), NumAssocs};
5409 assert(I < getNumAssocs() &&
5410 "Out-of-range index in GenericSelectionExpr::getAssociation!");
5412 cast<Expr>(getTrailingObjects<Stmt *>()[AssocExprStartIndex + I]),
5413 getTrailingObjects<TypeSourceInfo *>()[I],
5414 !isResultDependent() && (getResultIndex() == I));
5417 assert(I < getNumAssocs() &&
5418 "Out-of-range index in GenericSelectionExpr::getAssociation!");
5420 cast<Expr>(getTrailingObjects<Stmt *>()[AssocExprStartIndex + I]),
5421 getTrailingObjects<TypeSourceInfo *>()[I],
5422 !isResultDependent() && (getResultIndex() == I));
5427 AssocExprStartIndex,
5428 getTrailingObjects<TypeSourceInfo *>(),
5431 NumAssocs, ResultIndex);
5432 return llvm::make_range(Begin, End);
5437 AssocExprStartIndex,
5438 getTrailingObjects<TypeSourceInfo *>(),
5441 NumAssocs, ResultIndex);
5442 return llvm::make_range(Begin, End);
5446 return GenericSelectionExprBits.GenericLoc;
5459 getTrailingObjects<Stmt *>() +
5460 numTrailingObjects(OverloadToken<Stmt *>()));
5464 getTrailingObjects<Stmt *>() +
5465 numTrailingObjects(OverloadToken<Stmt *>()));
5487 :
Expr(ExtVectorElementExprClass, ty, VK,
5489 base->isTypeDependent(), base->isValueDependent(),
5490 base->isInstantiationDependent(),
5491 base->containsUnexpandedParameterPack()),
5492 Base(base), Accessor(&accessor), AccessorLoc(loc) {}
5496 :
Expr(ExtVectorElementExprClass, Empty) { }
5509 unsigned getNumElements()
const;
5513 bool containsDuplicateElements()
const;
5520 return getBase()->getBeginLoc();
5526 bool isArrow()
const;
5547 ty->isDependentType(), ty->isDependentType(),
5548 ty->isInstantiationDependentType() || BD->isDependentContext(),
5561 const Stmt *getBody()
const;
5565 return getCaretLocation();
5603 :
Expr(AsTypeExprClass, DstType, VK, OK,
5604 DstType->isDependentType(),
5605 DstType->isDependentType() || SrcExpr->isValueDependent(),
5606 (DstType->isInstantiationDependentType() ||
5607 SrcExpr->isInstantiationDependent()),
5608 (DstType->containsUnexpandedParameterPack() ||
5609 SrcExpr->containsUnexpandedParameterPack())),
5610 SrcExpr(SrcExpr), BuiltinLoc(BuiltinLoc), RParenLoc(RParenLoc) {}
5677 Expr **getSubExprsBuffer() {
return getTrailingObjects<Expr *>(); }
5678 const Expr *
const *getSubExprsBuffer()
const {
5679 return getTrailingObjects<Expr *>();
5684 unsigned resultIndex);
5686 PseudoObjectExpr(
EmptyShell shell,
unsigned numSemanticExprs);
5688 unsigned getNumSubExprs()
const {
5689 return PseudoObjectExprBits.NumSubExprs;
5695 enum :
unsigned { NoResult = ~0U };
5699 unsigned resultIndex);
5702 unsigned numSemanticExprs);
5713 if (PseudoObjectExprBits.ResultIndex == 0)
return NoResult;
5714 return PseudoObjectExprBits.ResultIndex - 1;
5719 if (PseudoObjectExprBits.ResultIndex == 0)
5721 return getSubExprsBuffer()[PseudoObjectExprBits.ResultIndex];
5724 return const_cast<PseudoObjectExpr*
>(
this)->getResultExpr();
5732 return getSubExprsBuffer() + 1;
5735 return getSubExprsBuffer() + 1;
5738 return getSubExprsBuffer() + getNumSubExprs();
5741 return getSubExprsBuffer() + getNumSubExprs();
5745 return llvm::make_range(semantics_begin(), semantics_end());
5747 llvm::iterator_range<const_semantics_iterator>
semantics()
const {
5748 return llvm::make_range(semantics_begin(), semantics_end());
5752 assert(index + 1 < getNumSubExprs());
5753 return getSubExprsBuffer()[index + 1];
5756 return const_cast<PseudoObjectExpr*
>(
this)->getSemanticExpr(index);
5760 return getSyntacticForm()->getExprLoc();
5764 return getSyntacticForm()->getBeginLoc();
5767 return getSyntacticForm()->getEndLoc();
5772 const_cast<const PseudoObjectExpr *
>(
this)->
children();
5777 Stmt *
const *cs =
const_cast<Stmt *
const *
>(
5778 reinterpret_cast<const Stmt *
const *
>(getSubExprsBuffer()));
5800 #define BUILTIN(ID, TYPE, ATTRS) 5801 #define ATOMIC_BUILTIN(ID, TYPE, ATTRS) AO ## ID, 5802 #include "clang/Basic/Builtins.def" 5811 enum {
PTR, ORDER, VAL1, ORDER_FAIL, VAL2, WEAK, END_EXPR };
5812 Stmt *SubExprs[END_EXPR + 1];
5813 unsigned NumSubExprs;
5824 static unsigned getNumSubExprs(
AtomicOp Op);
5830 return cast<Expr>(SubExprs[
PTR]);
5833 return cast<Expr>(SubExprs[ORDER]);
5836 assert(getScopeModel() &&
"No scope");
5837 return cast<Expr>(SubExprs[NumSubExprs - 1]);
5840 if (Op == AO__c11_atomic_init || Op == AO__opencl_atomic_init)
5841 return cast<Expr>(SubExprs[ORDER]);
5842 assert(NumSubExprs > VAL1);
5843 return cast<Expr>(SubExprs[VAL1]);
5846 assert(NumSubExprs > ORDER_FAIL);
5847 return cast<Expr>(SubExprs[ORDER_FAIL]);
5850 if (Op == AO__atomic_exchange)
5851 return cast<Expr>(SubExprs[ORDER_FAIL]);
5852 assert(NumSubExprs > VAL2);
5853 return cast<Expr>(SubExprs[VAL2]);
5856 assert(NumSubExprs > WEAK);
5857 return cast<Expr>(SubExprs[WEAK]);
5866 return reinterpret_cast<Expr *
const *
>(SubExprs);
5870 return getPtr()->getType()->getPointeeType().isVolatileQualified();
5874 return getOp() == AO__c11_atomic_compare_exchange_strong ||
5875 getOp() == AO__c11_atomic_compare_exchange_weak ||
5876 getOp() == AO__opencl_atomic_compare_exchange_strong ||
5877 getOp() == AO__opencl_atomic_compare_exchange_weak ||
5878 getOp() == AO__atomic_compare_exchange ||
5879 getOp() == AO__atomic_compare_exchange_n;
5883 return getOp() >= AO__opencl_atomic_init &&
5884 getOp() <= AO__opencl_atomic_fetch_max;
5899 return child_range(SubExprs, SubExprs+NumSubExprs);
5910 (Op >= AO__opencl_atomic_load && Op <= AO__opencl_atomic_fetch_max)
5920 return getScopeModel(getOp());
5934 assert(T->
isDependentType() &&
"TypoExpr given a non-dependent type");
5954 #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.
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)
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
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)
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)
enum clang::SubobjectAdjustment::@47 Kind
static bool classof(const Stmt *T)
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.
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)
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
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 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)
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
const_child_range children() const
void setIndexExpr(unsigned Idx, Expr *E)
SourceLocation getLocation() const
Retrieve the location of this expression.
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
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