|
reference, declaration → definition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
|
References
tools/clang/lib/AST/ExprConstant.cpp 6626 assert(Info.checkingPotentialConstantExpression());
6631 SpeculativeEvaluationRAII Speculate(Info, &Diag);
6638 SpeculativeEvaluationRAII Speculate(Info, &Diag);
6652 if (!EvaluateAsBooleanCondition(E->getCond(), BoolResult, Info)) {
6653 if (Info.checkingPotentialConstantExpression() && Info.noteFailure()) {
6653 if (Info.checkingPotentialConstantExpression() && Info.noteFailure()) {
6657 if (Info.noteFailure()) {
6674 return Info.CCEDiag(E, D);
6682 EvalInfo &getEvalInfo() { return Info; }
6687 Info.FFDiag(E, D);
6716 TempVersionRAII RAII(*Info.CurrentCall);
6717 SourceLocExprScopeGuard Guard(E, Info.CurrentCall->CurSourceLocExprScope);
6721 TempVersionRAII RAII(*Info.CurrentCall);
6725 SourceLocExprScopeGuard Guard(E, Info.CurrentCall->CurSourceLocExprScope);
6730 FullExpressionRAII Scope(Info);
6745 if (!Info.Ctx.getLangOpts().CPlusPlus2a)
6765 if (!HandleMemberPointerAccess(Info, E, Obj))
6768 if (!handleLValueToRValueConversion(Info, E, E->getType(), Obj, Result))
6783 if (!Evaluate(Info.CurrentCall->createTemporary(
6785 getStorageType(Info.Ctx, E->getOpaqueValue()), false,
6787 Info, E->getCommon()))
6808 if (Info.checkingPotentialConstantExpression() && IsBcpCall)
6811 FoldConstant Fold(Info, IsBcpCall);
6821 if (APValue *Value = Info.CurrentCall->getCurrentTemporary(E))
6856 if (!EvaluateObjectArgument(Info, ME->getBase(), ThisVal))
6866 HandleMemberPointerAccess(Info, BE, ThisVal, false);
6874 if (!Info.getLangOpts().CPlusPlus2a)
6875 Info.CCEDiag(PDE, diag::note_constexpr_pseudo_destructor);
6879 return EvaluateObjectArgument(Info, PDE->getBase(), ThisVal);
6885 if (!EvaluatePointer(Callee, Call, Info))
6896 if (!Info.Ctx.hasSameFunctionTypeIgnoringExceptionSpec(
6911 if (!EvaluateObjectArgument(Info, Args[0], ThisVal))
6952 if (!HandleOperatorNewCall(Info, E, Ptr))
6957 return HandleOperatorDeleteCall(Info, E);
6968 FD = HandleVirtualDispatch(Info, E, *This, NamedMember,
6976 if (!checkNonVirtualMemberCallThisPointer(Info, E, *This, NamedMember))
6984 return HandleDestruction(Info, E, *This,
6985 Info.Ctx.getRecordType(DD->getParent()));
6991 if (!CheckConstexprFunction(Info, E->getExprLoc(), FD, Definition, Body) ||
6992 !HandleFunctionCall(E->getExprLoc(), Definition, This, Args, Body, Info,
6997 !HandleCovariantReturnAdjustment(Info, E, Result,
7026 assert(!Info.Ctx.getLangOpts().CPlusPlus11 &&
7031 if (!Evaluate(Val, Info, E->getBase()))
7050 return extractSubobject(Info, E, Obj, Designator, Result) &&
7064 if (!Evaluate(AtomicVal, Info, E->getSubExpr()))
7075 if (!EvaluateLValue(E->getSubExpr(), LVal, Info))
7079 if (!handleLValueToRValueConversion(Info, E, E->getSubExpr()->getType(),
7086 if (!Evaluate(SourceValue, Info, E->getSubExpr()))
7088 if (!handleLValueToRValueBitCast(Info, DestValue, SourceValue, E))
7104 if (!Info.getLangOpts().CPlusPlus14 && !Info.keepEvaluatingAfterFailure())
7104 if (!Info.getLangOpts().CPlusPlus14 && !Info.keepEvaluatingAfterFailure())
7108 if (!EvaluateLValue(UO->getSubExpr(), LVal, Info))
7111 if (!handleIncDec(this->Info, UO, LVal, UO->getSubExpr()->getType(),
7120 if (Info.checkingForUndefinedBehavior())
7127 BlockScopeRAII Scope(Info);
7134 Info.FFDiag((*BI)->getBeginLoc(),
7143 EvalStmtResult ESR = EvaluateStmt(Result, Info, *BI);
7149 Info.FFDiag((*BI)->getBeginLoc(),
7160 EvaluateIgnoredValue(Info, E);
7167 if (Info.getLangOpts().MSVCCompat && !E->HasSideEffects(Info.Ctx))
7167 if (Info.getLangOpts().MSVCCompat && !E->HasSideEffects(Info.Ctx))
7194 return EvaluatePointer(E, Result, this->Info, InvalidBaseOK);
7203 Result.setFrom(this->Info.Ctx, V);
7216 EvalOK = EvaluateTemporary(E->getBase(), Result, this->Info);
7234 if (!HandleLValueMember(this->Info, E, Result, FD))
7237 if (!HandleLValueIndirectMember(this->Info, E, Result, IFD))
7244 if (!handleLValueToRValueConversion(this->Info, E, MD->getType(), Result,
7259 return HandleMemberPointerAccess(this->Info, E, Result);
7275 return HandleLValueBasePath(this->Info, E, E->getSubExpr()->getType(),
7360 return HandleBaseToDerivedCast(Info, E, Result);
7365 return HandleDynamicCast(Info, cast<ExplicitCastExpr>(E), Result);
7400 if (Info.CurrentCall && isLambdaCallOperator(Info.CurrentCall->Callee) &&
7400 if (Info.CurrentCall && isLambdaCallOperator(Info.CurrentCall->Callee) &&
7407 if (Info.checkingPotentialConstantExpression())
7410 if (auto *FD = Info.CurrentCall->LambdaCaptureFields.lookup(VD)) {
7412 Result = *Info.CurrentCall->This;
7415 if (!HandleLValueMember(Info, E, Result, FD))
7421 if (!handleLValueToRValueConversion(Info, E, FD->getType(), Result,
7424 Result.setFrom(Info.Ctx, RVal);
7430 if (VD->hasLocalStorage() && Info.CurrentCall->Index > 1) {
7437 if (Info.CurrentCall->Callee &&
7438 Info.CurrentCall->Callee->Equals(VD->getDeclContext())) {
7439 Frame = Info.CurrentCall;
7446 Info.CurrentCall->getCurrentTemporaryVersion(VD)});
7453 if (!evaluateVarDeclInit(Info, E, VD, Frame, V, nullptr))
7458 if (!Info.checkingPotentialConstantExpression())
7459 Info.FFDiag(E, diag::note_constexpr_use_uninit_reference);
7475 if (!EvaluateIgnoredValue(Info, CommaLHSs[I]))
7483 Value = Info.Ctx.getMaterializedTemporaryValue(E, true);
7487 Value = &Info.CurrentCall->createTemporary(
7494 if (!EvaluateInPlace(*Value, Info, Result, Inner)) {
7504 if (!HandleLValueBasePath(Info, Adjustments[I].DerivedToBase.BasePath,
7511 if (!HandleLValueMember(Info, E, Result, Adjustments[I].Field))
7517 if (!HandleMemberPointerAccess(this->Info, Type, Result,
7530 assert((!Info.getLangOpts().CPlusPlus || E->isFileScope()) &&
7542 TypeInfo = TypeInfoLValue(E->getTypeOperand(Info.Ctx).getTypePtr());
7546 if (!Info.Ctx.getLangOpts().CPlusPlus2a) {
7547 Info.CCEDiag(E, diag::note_constexpr_typeid_polymorphic)
7556 ComputeDynamicType(Info, E, Result, AK_TypeId);
7561 TypeInfoLValue(Info.Ctx.getRecordType(DynType->Type).getTypePtr());
7597 if (!Info.noteFailure())
7603 if (!EvaluateInteger(E->getIdx(), Index, Info))
7607 HandleLValueArrayAdjustment(Info, E, Result, E->getType(), Index);
7619 HandleLValueComplexElement(Info, E, Result, E->getType(), false);
7628 HandleLValueComplexElement(Info, E, Result, E->getType(), true);
7633 if (!Info.getLangOpts().CPlusPlus14 && !Info.keepEvaluatingAfterFailure())
7633 if (!Info.getLangOpts().CPlusPlus14 && !Info.keepEvaluatingAfterFailure())
7640 this->Info, UO, Result, UO->getSubExpr()->getType(),
7646 if (!Info.getLangOpts().CPlusPlus14 && !Info.keepEvaluatingAfterFailure())
7646 if (!Info.getLangOpts().CPlusPlus14 && !Info.keepEvaluatingAfterFailure())
7653 if (Info.noteFailure())
7654 Evaluate(RHS, this->Info, CAO->getRHS());
7658 if (!Evaluate(RHS, this->Info, CAO->getRHS()))
7662 this->Info, CAO,
7668 if (!Info.getLangOpts().CPlusPlus14 && !Info.keepEvaluatingAfterFailure())
7668 if (!Info.getLangOpts().CPlusPlus14 && !Info.keepEvaluatingAfterFailure())
7674 if (Info.noteFailure())
7675 Evaluate(NewVal, this->Info, E->getRHS());
7679 if (!Evaluate(NewVal, this->Info, E->getRHS()))
7682 if (Info.getLangOpts().CPlusPlus2a &&
7683 !HandleUnionActiveMemberChange(Info, E->getLHS(), Result))
7686 return handleAssignment(this->Info, E, Result, E->getLHS()->getType(),
7805 return EvaluateLValue(E, Result, Info, InvalidBaseOK);
7809 return EvaluatePointer(E, Result, Info, InvalidBaseOK);
7820 Result.setFrom(Info.Ctx, V);
7824 Result.setNull(Info.Ctx, E->getType());
7836 if (Info.noteFailure())
7837 EvaluateIgnoredValue(Info, E->getSubExpr());
7851 if (Info.checkingPotentialConstantExpression())
7853 if (!Info.CurrentCall->This) {
7854 if (Info.getLangOpts().CPlusPlus11)
7855 Info.FFDiag(E, diag::note_constexpr_this) << E->isImplicit();
7857 Info.FFDiag(E);
7860 Result = *Info.CurrentCall->This;
7865 if (isLambdaCallOperator(Info.CurrentCall->Callee)) {
7868 if (!HandleLValueMember(Info, E, Result,
7869 Info.CurrentCall->LambdaThisCaptureField))
7872 if (Info.CurrentCall->LambdaThisCaptureField->getType()
7875 if (!handleLValueToRValueConversion(Info, E, E->getType(), Result,
7879 Result.setFrom(Info.Ctx, RVal);
7890 Info.Ctx, Info.CurrentCall->CurSourceLocExprScope.getDefaultExpr());
7890 Info.Ctx, Info.CurrentCall->CurSourceLocExprScope.getDefaultExpr());
7891 Result.setFrom(Info.Ctx, LValResult);
7916 if (!EvalPtrOK && !Info.noteFailure())
7920 if (!EvaluateInteger(IExp, Offset, Info) || !EvalPtrOK)
7927 return HandleLValueArrayAdjustment(Info, E, Result, Pointee, Offset);
7953 Info.Ctx.hasSameUnqualifiedType(Result.Designator.getType(Info.Ctx),
7953 Info.Ctx.hasSameUnqualifiedType(Result.Designator.getType(Info.Ctx),
7955 Info.getStdAllocatorCaller("allocate")) {
7981 return HandleLValueBasePath(Info, E, E->getSubExpr()->getType()->
7990 return HandleBaseToDerivedCast(Info, E, Result);
7995 return HandleDynamicCast(Info, cast<ExplicitCastExpr>(E), Result);
8005 if (!EvaluateIntegerOrLValue(SubExpr, Value, Info))
8009 unsigned Size = Info.Ctx.getTypeSize(E->getType());
8019 Result.setFrom(Info.Ctx, Value);
8029 APValue &Value = Info.CurrentCall->createTemporary(
8031 if (!EvaluateInPlace(Value, Info, Result, SubExpr))
8035 auto *AT = Info.Ctx.getAsArrayType(SubExpr->getType());
8037 Result.addArray(Info, E, CAT);
8039 Result.addUnsizedArray(Info, E, AT->getElementType());
8053 if (!handleLValueToRValueConversion(Info, E, E->getSubExpr()->getType(),
8056 evaluateLValueAsAllocSize(Info, LVal.Base, Result);
8122 Result.addUnsizedArray(Info, E, PointeeTy);
8150 if (!EvaluateInteger(E->getArg(1), Alignment, Info))
8156 if (!EvaluateInteger(E->getArg(2), Offset, Info))
8168 BaseAlignment = Info.Ctx.getDeclAlign(VD);
8170 BaseAlignment = GetAlignOfExpr(Info, E, UETT_AlignOf);
8173 Info, OffsetResult.Base.getTypeInfoType(), UETT_AlignOf);
8204 return HandleOperatorNewCall(Info, E, Result);
8211 if (Info.getLangOpts().CPlusPlus11)
8212 Info.CCEDiag(E, diag::note_constexpr_invalid_function)
8214 << (std::string("'") + Info.Ctx.BuiltinInfo.getName(BuiltinOp) + "'");
8216 Info.CCEDiag(E, diag::note_invalid_subexpr_in_const_expr);
8226 if (!EvaluateInteger(E->getArg(1), Desired, Info))
8234 if (!EvaluateInteger(E->getArg(2), N, Info))
8241 if (!Result.checkNullPointerForFoldAccess(Info, E, AK_Read) ||
8244 QualType CharTy = Result.Designator.getType(Info.Ctx);
8248 Info.Ctx.hasSameUnqualifiedType(
8252 Info.FFDiag(E, diag::note_constexpr_ltor_incomplete_type) << CharTy;
8257 if (IsRawByte && Info.Ctx.getTypeSizeInChars(CharTy) != CharUnits::One())
8268 if (!APSInt::isSameValue(HandleIntToIntCast(Info, E, CharTy,
8281 DesiredVal = Desired.trunc(Info.Ctx.getCharWidth()).getZExtValue();
8297 if (!handleLValueToRValueConversion(Info, E, CharTy, Result, Char) ||
8304 if (!HandleLValueArrayAdjustment(Info, E, Result, CharTy, 1))
8315 if (Info.getLangOpts().CPlusPlus11)
8316 Info.CCEDiag(E, diag::note_constexpr_invalid_function)
8318 << (std::string("'") + Info.Ctx.BuiltinInfo.getName(BuiltinOp) + "'");
8320 Info.CCEDiag(E, diag::note_invalid_subexpr_in_const_expr);
8341 if (!EvaluatePointer(E->getArg(1), Src, Info))
8345 if (!EvaluateInteger(E->getArg(2), N, Info))
8360 Info.FFDiag(E, diag::note_constexpr_memcpy_null)
8362 << Val.getAsString(Info.Ctx, E->getArg(0)->getType());
8371 QualType T = Dest.Designator.getType(Info.Ctx);
8372 QualType SrcT = Src.Designator.getType(Info.Ctx);
8373 if (!Info.Ctx.hasSameUnqualifiedType(T, SrcT)) {
8374 Info.FFDiag(E, diag::note_constexpr_memcpy_type_pun) << Move << SrcT << T;
8378 Info.FFDiag(E, diag::note_constexpr_memcpy_incomplete_type) << Move << T;
8381 if (!T.isTriviallyCopyableType(Info.Ctx)) {
8382 Info.FFDiag(E, diag::note_constexpr_memcpy_nontrivial) << Move << T;
8387 uint64_t TSize = Info.Ctx.getTypeSizeInChars(T).getQuantity();
8393 Info.FFDiag(E, diag::note_constexpr_memcpy_unsupported)
8406 Info.FFDiag(E, diag::note_constexpr_memcpy_unsupported)
8422 Info.FFDiag(E, diag::note_constexpr_memcpy_overlap) << WChar;
8426 if (!HandleLValueArrayAdjustment(Info, E, Src, T, NElems - 1) ||
8427 !HandleLValueArrayAdjustment(Info, E, Dest, T, NElems - 1))
8433 Info.FFDiag(E, diag::note_constexpr_memcpy_overlap) << WChar;
8442 if (!handleLValueToRValueConversion(Info, E, T, Src, Val) ||
8443 !handleAssignment(Info, E, Dest, T, Val))
8449 if (!HandleLValueArrayAdjustment(Info, E, Src, T, Direction) ||
8450 !HandleLValueArrayAdjustment(Info, E, Dest, T, Direction))
8467 if (!Info.getLangOpts().CPlusPlus2a)
8468 Info.CCEDiag(E, diag::note_constexpr_new);
8471 if (Info.SpeculativeEvaluationDepth)
8479 Info.CurrentCall->isStdFunction() && !E->isArray()) {
8482 if (!EvaluatePointer(E->getPlacementArg(0), Result, Info))
8488 Info.FFDiag(E, diag::note_constexpr_new_non_replaceable)
8507 if (!EvaluateLValue(E->getPlacementArg(0), Nothrow, Info))
8525 if (!EvaluateInteger(Stripped, ArrayBound, Info))
8536 Info.FFDiag(*ArraySize, diag::note_constexpr_new_negative)
8543 if (ConstantArrayType::getNumAddressingBits(Info.Ctx, AllocType,
8545 ConstantArrayType::getMaxSizeBits(Info.Ctx)) {
8549 Info.FFDiag(*ArraySize, diag::note_constexpr_new_too_large)
8558 auto *CAT = Info.Ctx.getAsConstantArrayType(Init->getType());
8569 Info.FFDiag(*ArraySize, diag::note_constexpr_new_too_small)
8582 AllocType = Info.Ctx.getConstantArrayType(AllocType, ArrayBound, nullptr,
8620 } Handler = {Info, E, AllocType, AK, nullptr};
8622 CompleteObject Obj = findCompleteObject(Info, E, AK, Result, AllocType);
8623 if (!Obj || !findSubobject(Info, E, Obj, Result.Designator, Handler))
8635 Val = Info.createHeapAlloc(E, AllocType, Result);
8641 if (!EvaluateArrayNewInitList(Info, Result, *Val, ResizedArrayILE,
8645 if (!EvaluateInPlace(*Val, Info, Result, Init))
8654 Result.addArray(Info, E, cast<ConstantArrayType>(AT));
8848 if (!HandleLValueMember(Info, E, Subobject, *I))
8852 return EvaluateInPlace(Result.getUnionValue(), Info, Subobject, &VIE);
8856 Info.FFDiag(E, diag::note_constexpr_virtual_base) << RD;
8860 return HandleClassZeroInitialization(Info, E, RD, This, Result);
8874 if (!Evaluate(DerivedObject, Info, E->getSubExpr()))
8901 const ASTRecordLayout &Layout = Info.Ctx.getASTRecordLayout(RD);
8905 Info,
8924 if (!HandleLValueMember(Info, InitExpr, Subobject, Field, &Layout))
8928 ThisOverrideRAII ThisOverride(*Info.CurrentCall, &This,
8931 return EvaluateInPlace(Result.getUnionValue(), Info, Subobject, InitExpr);
8947 if (!HandleLValueBase(Info, Init, Subobject, CXXRD, &Base))
8951 if (!EvaluateInPlace(FieldVal, Info, Subobject, Init)) {
8952 if (!Info.noteFailure())
8975 if (!HandleLValueMember(Info, HaveInit ? E->getInit(ElementNo) : E,
8981 ImplicitValueInitExpr VIE(HaveInit ? Info.Ctx.IntTy : Field->getType());
8985 ThisOverrideRAII ThisOverride(*Info.CurrentCall, &This,
8989 if (!EvaluateInPlace(FieldVal, Info, Subobject, Init) ||
8990 (Field->isBitField() && !truncateBitfieldValue(Info, Init,
8992 if (!Info.noteFailure())
9009 if (CheckTrivialDefaultConstructor(Info, E->getExprLoc(), FD, ZeroInit)) {
9024 if (!CheckConstexprFunction(Info, E->getExprLoc(), FD, Definition, Body))
9038 cast<CXXConstructorDecl>(Definition), Info,
9044 if (!Info.CurrentCall) {
9045 assert(Info.checkingPotentialConstantExpression());
9056 if (!CheckConstexprFunction(Info, E->getExprLoc(), FD, Definition, Body))
9059 return HandleConstructorCall(E, This, Info.CurrentCall->Arguments,
9060 cast<CXXConstructorDecl>(Definition), Info,
9067 Info.Ctx.getAsConstantArrayType(E->getSubExpr()->getType());
9070 if (!EvaluateLValue(E->getSubExpr(), Array, Info))
9074 Array.addArray(Info, E, ArrayType);
9084 !Info.Ctx.hasSameType(Field->getType()->getPointeeType(),
9096 Info.Ctx.hasSameType(Field->getType()->getPointeeType(),
9099 if (!HandleLValueArrayAdjustment(Info, E, Array,
9104 } else if (Info.Ctx.hasSameType(Field->getType(), Info.Ctx.getSizeType()))
9104 } else if (Info.Ctx.hasSameType(Field->getType(), Info.Ctx.getSizeType()))
9146 if (!EvaluateInPlace(FieldVal, Info, This, CurFieldInit)) {
9147 if (!Info.keepEvaluatingAfterFailure())
9180 Info.CurrentCall->createTemporary(E, E->getType(), false, Result);
9181 return EvaluateInPlace(Value, Info, Result, E);
9271 if (!EvaluateInteger(SE, IntResult, Info))
9276 if (!EvaluateFloat(SE, FloatResult, Info))
9290 if (!EvalAndBitcastToAPInt(Info, SE, SValInt))
9294 unsigned EltSize = Info.Ctx.getTypeSize(EltTy);
9295 bool BigEndian = Info.Ctx.getTargetInfo().isBigEndian();
9298 const llvm::fltSemantics &Sem = Info.Ctx.getFloatTypeSemantics(EltTy);
9348 if (!EvaluateVector(E->getInit(CountInits), v, Info))
9357 if (!EvaluateInteger(E->getInit(CountInits), sInt, Info))
9360 sInt = Info.Ctx.MakeIntValue(0, EltTy);
9366 if (!EvaluateFloat(E->getInit(CountInits), f, Info))
9369 f = APFloat::getZero(Info.Ctx.getFloatTypeSemantics(EltTy));
9384 ZeroElement = APValue(Info.Ctx.MakeIntValue(0, EltTy));
9387 APValue(APFloat::getZero(Info.Ctx.getFloatTypeSemantics(EltTy)));
9420 Info.Ctx.getAsConstantArrayType(E->getType());
9430 Subobject.addArray(Info, E, CAT);
9432 return EvaluateInPlace(Result.getArrayFiller(), Info, Subobject, &VIE);
9447 expandStringLiteral(Info, E, Result, AllocType);
9486 const ConstantArrayType *CAT = Info.Ctx.getAsConstantArrayType(
9534 Subobject.addArray(Info, E, CAT);
9539 Info, Subobject, Init) ||
9540 !HandleLValueArrayAdjustment(Info, Init, Subobject,
9542 if (!Info.noteFailure())
9554 return EvaluateInPlace(Result.getArrayFiller(), Info, Subobject,
9561 !Evaluate(Info.CurrentCall->createTemporary(
9563 getStorageType(Info.Ctx, E->getCommonExpr()), false,
9565 Info, E->getCommonExpr()->getSourceExpr()))
9574 Subobject.addArray(Info, E, CAT);
9577 for (EvalInfo::ArrayInitLoopIndex Index(Info); Index != Elements; ++Index) {
9579 Info, Subobject, E->getSubExpr()) ||
9580 !HandleLValueArrayAdjustment(Info, E, Subobject,
9582 if (!Info.noteFailure())
9601 if (const ConstantArrayType *CAT = Info.Ctx.getAsConstantArrayType(Type)) {
9617 ArrayElt.addArray(Info, E, CAT);
9621 !HandleLValueArrayAdjustment(Info, E, ArrayElt,
9631 return RecordExprEvaluator(Info, Subobject, *Value)
9656 assert(SI.getBitWidth() == Info.Ctx.getIntWidth(E->getType()) &&
9668 assert(I.getBitWidth() == Info.Ctx.getIntWidth(E->getType()) &&
9682 Result = APValue(Info.Ctx.MakeIntValue(Value, E->getType()));
9750 if (Info.ArrayInitIndex == uint64_t(-1)) {
9753 Info.FFDiag(E);
9756 return Success(Info.ArrayInitIndex, E);
9796 APFixedPoint(I, Info.Ctx.getFixedPointSemantics(E->getType())), E);
9801 APFixedPoint(Value, Info.Ctx.getFixedPointSemantics(E->getType())), E);
9810 assert(V.getWidth() == Info.Ctx.getIntWidth(E->getType()) &&
9860 Info.Ctx, Info.CurrentCall->CurSourceLocExprScope.getDefaultExpr());
9860 Info.Ctx, Info.CurrentCall->CurSourceLocExprScope.getDefaultExpr());
9904 == Info.Ctx.getIntWidth(E->getType()));
9914 Val = Val.extOrTrunc(Info.Ctx.getIntWidth(E->getType()));
10488 llvm::SaveAndRestore<bool> InConstantContext(Info.InConstantContext, true);
10511 E->getArg(1)->EvaluateKnownConstInt(Info.Ctx).getZExtValue();
10515 if (tryEvaluateBuiltinObjectSize(E->getArg(0), Type, Info, Size))
10518 if (E->getArg(0)->HasSideEffects(Info.Ctx))
10523 switch (Info.EvalMode) {
10539 analyze_os_log::computeOSLogBufferLayout(Info.Ctx, E, Layout);
10547 if (!EvaluateInteger(E->getArg(0), Val, Info))
10554 return Success((int)EvaluateBuiltinClassifyType(E, Info.getLangOpts()), E);
10560 if (!EvaluateInteger(E->getArg(0), Val, Info))
10571 if (!EvaluateInteger(E->getArg(0), Val, Info))
10581 if (EvaluateBuiltinConstantP(Info, Arg))
10583 if (Info.InConstantContext || Arg->HasSideEffects(Info.Ctx)) {
10583 if (Info.InConstantContext || Arg->HasSideEffects(Info.Ctx)) {
10589 Info.FFDiag(E, diag::note_invalid_subexpr_in_const_expr);
10594 return Success(Info.InConstantContext, E);
10601 if (!EvaluateInteger(E->getArg(0), Val, Info))
10610 int Operand = E->getArg(0)->EvaluateKnownConstInt(Info.Ctx).getZExtValue();
10611 Operand = Info.Ctx.getTargetInfo().getEHDataRegisterNumber(Operand);
10622 if (!EvaluateInteger(E->getArg(0), Val, Info))
10631 if (!EvaluateFloat(E->getArg(5), Val, Info))
10645 return EvaluateFloat(E->getArg(0), Val, Info) &&
10651 return EvaluateFloat(E->getArg(0), Val, Info) &&
10657 return EvaluateFloat(E->getArg(0), Val, Info) &&
10663 return EvaluateFloat(E->getArg(0), Val, Info) &&
10669 return EvaluateFloat(E->getArg(0), Val, Info) &&
10677 if (!EvaluateInteger(E->getArg(0), Val, Info))
10687 if (!EvaluateInteger(E->getArg(0), Val, Info))
10696 if (Info.getLangOpts().CPlusPlus11)
10697 Info.CCEDiag(E, diag::note_constexpr_invalid_function)
10699 << (std::string("'") + Info.Ctx.BuiltinInfo.getName(BuiltinOp) + "'");
10701 Info.CCEDiag(E, diag::note_invalid_subexpr_in_const_expr);
10708 if (!EvaluatePointer(E->getArg(0), String, Info))
10723 Info.Ctx.hasSameUnqualifiedType(CharTy, Info.Ctx.CharTy)) {
10723 Info.Ctx.hasSameUnqualifiedType(CharTy, Info.Ctx.CharTy)) {
10739 if (!handleLValueToRValueConversion(Info, E, CharTy, String, Char) ||
10744 if (!HandleLValueArrayAdjustment(Info, E, String, CharTy, 1))
10757 if (Info.getLangOpts().CPlusPlus11)
10758 Info.CCEDiag(E, diag::note_constexpr_invalid_function)
10760 << (std::string("'") + Info.Ctx.BuiltinInfo.getName(BuiltinOp) + "'");
10762 Info.CCEDiag(E, diag::note_invalid_subexpr_in_const_expr);
10772 if (!EvaluatePointer(E->getArg(0), String1, Info) ||
10773 !EvaluatePointer(E->getArg(1), String2, Info))
10782 if (!EvaluateInteger(E->getArg(2), N, Info))
10791 if (!String1.checkNullPointerForFoldAccess(Info, E, AK_Read) ||
10792 !String2.checkNullPointerForFoldAccess(Info, E, AK_Read) ||
10796 QualType CharTy1 = String1.Designator.getType(Info.Ctx);
10797 QualType CharTy2 = String2.Designator.getType(Info.Ctx);
10805 (Info.Ctx.hasSameUnqualifiedType(
10807 Info.Ctx.hasSameUnqualifiedType(CharTy1, CharTy2)));
10810 return handleLValueToRValueConversion(Info, E, CharTy1, String1, Char1) &&
10811 handleLValueToRValueConversion(Info, E, CharTy2, String2, Char2) &&
10815 return HandleLValueArrayAdjustment(Info, E, String1, CharTy1, 1) &&
10816 HandleLValueArrayAdjustment(Info, E, String2, CharTy2, 1);
10823 Info.FFDiag(E, diag::note_constexpr_ltor_incomplete_type) << CharTy1;
10827 Info.FFDiag(E, diag::note_constexpr_ltor_incomplete_type) << CharTy2;
10830 uint64_t CharTy1Width{Info.Ctx.getTypeSize(CharTy1)};
10831 CharUnits CharTy1Size = Info.Ctx.toCharUnitsFromBits(CharTy1Width);
10833 if (CharTy1Size != Info.Ctx.getTypeSizeInChars(CharTy2))
10907 if (!EvaluateInteger(E->getArg(0), SizeVal, Info))
10924 Info.Ctx.getTargetInfo().getMaxAtomicInlineWidth();
10925 if (Size <= Info.Ctx.toCharUnitsFromBits(InlineWidthBits)) {
10928 E->getArg(1)->isNullPointerConstant(Info.Ctx,
10937 Info.Ctx.getTypeAlignInChars(PointeeType) >= Size) {
10949 return Success(Info.getLangOpts().OpenMPIsDevice ? 0 : 1, E);
10975 if (!EvaluateInteger(E->getArg(0), LHS, Info) ||
10976 !EvaluateInteger(E->getArg(1), RHS, Info) ||
10977 !EvaluatePointer(E->getArg(2), ResultLValue, Info))
10993 uint64_t ResultSize = Info.Ctx.getTypeSize(ResultType);
11054 APSInt Temp = Result.extOrTrunc(Info.Ctx.getTypeSize(ResultType));
11063 if (!handleAssignment(Info, E, ResultLValue, ResultType, APV))
11743 if (!CheckLiteralType(Info, E))
11751 Info.Ctx.CompCategories.getInfoForType(E->getType());
11757 if (!handleLValueToRValueConversion(Info, E, E->getType(), LV, Result))
11759 return CheckConstantExpression(Info, E->getExprLoc(), E->getType(), Result);
11761 return EvaluateComparisonBinaryOperator(Info, E, OnSuccess, [&]() {
11769 if (!Info.keepEvaluatingAfterFailure() && E->isAssignmentOp())
11772 DelayedNoteFailureRAII MaybeNoteFailureLater(Info, E->isAssignmentOp());
11802 return EvaluateComparisonBinaryOperator(Info, E, OnSuccess, [&]() {
11814 bool LHSOK = EvaluatePointer(E->getLHS(), LHSValue, Info);
11815 if (!LHSOK && !Info.noteFailure())
11818 if (!EvaluatePointer(E->getRHS(), RHSValue, Info) || !LHSOK)
11854 Info.CCEDiag(E, diag::note_constexpr_pointer_subtraction_not_same_array);
11860 if (!HandleSizeof(Info, E->getExprLoc(), ElementType, ElementSize))
11867 Info.FFDiag(E, diag::note_constexpr_pointer_subtraction_zero_size)
11885 APSInt Result = TrueResult.trunc(Info.Ctx.getIntWidth(E->getType()));
11888 !HandleOverflow(Info, E, TrueResult, E->getType()))
11904 return Success(GetAlignOfType(Info, E->getArgumentType(), E->getKind()),
11907 return Success(GetAlignOfExpr(Info, E->getArgumentExpr(), E->getKind()),
11935 if (!HandleSizeof(Info, E->getExprLoc(), SrcTy, Sizeof))
11942 Info.Ctx.toCharUnitsFromBits(
11943 Info.Ctx.getOpenMPDefaultSimdAlign(E->getArgumentType()))
11963 if (!EvaluateInteger(Idx, IdxResult, Info))
11965 const ArrayType *AT = Info.Ctx.getAsArrayType(CurrentType);
11969 CharUnits ElementSize = Info.Ctx.getTypeSizeInChars(CurrentType);
11981 const ASTRecordLayout &RL = Info.Ctx.getASTRecordLayout(RD);
11984 Result += Info.Ctx.toCharUnitsFromBits(RL.getFieldOffset(i));
12003 const ASTRecordLayout &RL = Info.Ctx.getASTRecordLayout(RD);
12039 !HandleOverflow(Info, E, -Value.extend(Value.getBitWidth() + 1),
12052 if (!EvaluateAsBooleanCondition(E->getSubExpr(), bres, Info))
12130 if (!EvaluateAsBooleanCondition(SubExpr, BoolResult, Info))
12139 APFixedPoint Src(Info.Ctx.getFixedPointSemantics(SrcType));
12140 if (!EvaluateFixedPoint(SubExpr, Src, Info))
12144 Info.Ctx.getIntWidth(DestType),
12146 if (Overflowed && !HandleOverflow(Info, E, Result, DestType))
12154 if (!Evaluate(Val, Info, SubExpr))
12170 return Info.Ctx.getTypeSize(DestType) <= Info.Ctx.getTypeSize(SrcType);
12170 return Info.Ctx.getTypeSize(DestType) <= Info.Ctx.getTypeSize(SrcType);
12172 return Info.Ctx.getTypeSize(DestType) == Info.Ctx.getTypeSize(SrcType);
12172 return Info.Ctx.getTypeSize(DestType) == Info.Ctx.getTypeSize(SrcType);
12175 return Success(HandleIntToIntCast(Info, E, DestType, SrcType,
12183 if (!EvaluatePointer(SubExpr, LV, Info))
12191 if (Info.Ctx.getTypeSize(DestType) != Info.Ctx.getTypeSize(SrcType))
12191 if (Info.Ctx.getTypeSize(DestType) != Info.Ctx.getTypeSize(SrcType))
12202 if (!V.toIntegralConstant(AsInt, SrcType, Info.Ctx))
12205 return Success(HandleIntToIntCast(Info, E, DestType, SrcType, AsInt), E);
12210 if (!EvaluateComplex(SubExpr, C, Info))
12217 if (!EvaluateFloat(SubExpr, F, Info))
12221 if (!HandleFloatToIntCast(Info, E, SrcType, F, DestType, Value))
12233 if (!EvaluateComplex(E->getSubExpr(), LV, Info))
12246 if (!EvaluateComplex(E->getSubExpr(), LV, Info))
12285 if (Overflowed && !HandleOverflow(Info, E, Negated, E->getType()))
12291 if (!EvaluateAsBooleanCondition(E->getSubExpr(), bres, Info))
12303 auto DestFXSema = Info.Ctx.getFixedPointSemantics(DestType);
12307 APFixedPoint Src(Info.Ctx.getFixedPointSemantics(SubExpr->getType()));
12308 if (!EvaluateFixedPoint(SubExpr, Src, Info))
12312 if (Overflowed && !HandleOverflow(Info, E, Result, DestType))
12318 if (!EvaluateInteger(SubExpr, Src, Info))
12323 Src, Info.Ctx.getFixedPointSemantics(DestType), &Overflowed);
12325 if (Overflowed && !HandleOverflow(Info, E, IntResult, DestType))
12342 Info.Ctx.getFixedPointSemantics(E->getType());
12344 APFixedPoint LHSFX(Info.Ctx.getFixedPointSemantics(LHS->getType()));
12345 if (!EvaluateFixedPointOrInteger(LHS, LHSFX, Info))
12347 APFixedPoint RHSFX(Info.Ctx.getFixedPointSemantics(RHS->getType()));
12348 if (!EvaluateFixedPointOrInteger(RHS, RHSFX, Info))
12357 !HandleOverflow(Info, E, Result, E->getType()))
12385 Result = APFloat::getZero(Info.Ctx.getFloatTypeSemantics(E->getType()));
12460 Info.Ctx.getFloatTypeSemantics(E->getType());
12469 if (!TryEvaluateBuiltinNaN(Info.Ctx, E->getType(), E->getArg(0),
12480 if (!TryEvaluateBuiltinNaN(Info.Ctx, E->getType(), E->getArg(0),
12489 if (!EvaluateFloat(E->getArg(0), Result, Info))
12505 if (!EvaluateFloat(E->getArg(0), Result, Info) ||
12506 !EvaluateFloat(E->getArg(1), RHS, Info))
12517 if (!EvaluateComplex(E->getSubExpr(), CV, Info))
12529 if (!EvaluateComplex(E->getSubExpr(), CV, Info))
12536 const llvm::fltSemantics &Sem = Info.Ctx.getFloatTypeSemantics(E->getType());
12545 return EvaluateFloat(E->getSubExpr(), Result, Info);
12547 if (!EvaluateFloat(E->getSubExpr(), Result, Info))
12559 bool LHSOK = EvaluateFloat(E->getLHS(), Result, Info);
12560 if (!LHSOK && !Info.noteFailure())
12562 return EvaluateFloat(E->getRHS(), RHS, Info) && LHSOK &&
12563 handleFloatFloatBinOp(Info, E, Result, E->getOpcode(), RHS);
12580 return EvaluateInteger(SubExpr, IntResult, Info) &&
12581 HandleIntToFloatCast(Info, E, SubExpr->getType(), IntResult,
12588 return HandleFloatToFloatCast(Info, E, SubExpr->getType(), E->getType(),
12594 if (!EvaluateComplex(SubExpr, V, Info))
12644 APFloat Zero = APFloat::getZero(Info.Ctx.getFloatTypeSemantics(ElemTy));
12649 APSInt Zero = Info.Ctx.MakeIntValue(0, ElemTy);
12662 if (!EvaluateFloat(SubExpr, Imag, Info))
12673 if (!EvaluateInteger(SubExpr, Imag, Info))
12748 if (!EvaluateFloat(E->getSubExpr(), Real, Info))
12764 return HandleFloatToFloatCast(Info, E, From, To, Result.FloatReal) &&
12765 HandleFloatToFloatCast(Info, E, From, To, Result.FloatImag);
12776 return HandleFloatToIntCast(Info, E, From, Result.FloatReal,
12778 HandleFloatToIntCast(Info, E, From, Result.FloatImag,
12784 if (!EvaluateInteger(E->getSubExpr(), Real, Info))
12800 Result.IntReal = HandleIntToIntCast(Info, E, To, From, Result.IntReal);
12801 Result.IntImag = HandleIntToIntCast(Info, E, To, From, Result.IntImag);
12813 return HandleIntToFloatCast(Info, E, From, Result.IntReal,
12815 HandleIntToFloatCast(Info, E, From, Result.IntImag,
12835 LHSOK = EvaluateFloat(E->getLHS(), Real, Info);
12843 if (!LHSOK && !Info.noteFailure())
12850 if (!EvaluateFloat(E->getRHS(), Real, Info) || !LHSOK)
12854 } else if (!EvaluateComplex(E->getRHS(), RHS, Info) || !LHSOK)
13083 if (!EvaluateFloat(E->getInit(0), Result.FloatReal, Info))
13085 if (!EvaluateFloat(E->getInit(1), Result.FloatImag, Info))
13089 if (!EvaluateInteger(E->getInit(0), Result.IntReal, Info))
13091 if (!EvaluateInteger(E->getInit(1), Result.IntImag, Info))
13123 return This ? EvaluateInPlace(Result, Info, *This, &VIE)
13124 : Evaluate(Result, Info, &VIE);
13132 return This ? EvaluateInPlace(Result, Info, *This, E->getSubExpr())
13133 : Evaluate(Result, Info, E->getSubExpr());
13178 return HandleOperatorDeleteCall(Info, E);
13193 if (Info.SpeculativeEvaluationDepth)
13198 Info.FFDiag(E, diag::note_constexpr_new_non_replaceable)
13206 if (!EvaluatePointer(Arg, Pointer, Info))
13216 if (!Info.getLangOpts().CPlusPlus2a)
13217 Info.CCEDiag(E, diag::note_constexpr_new);
13222 Info, E, Pointer, E->isArrayForm() ? DynAlloc::ArrayNew : DynAlloc::New);
13231 Info.FFDiag(E, diag::note_constexpr_delete_base_nonvirt_dtor)
13242 Info.FFDiag(E, diag::note_constexpr_new_non_replaceable)
13248 if (!HandleDestruction(Info, E->getExprLoc(), Pointer.getLValueBase(),
13252 if (!Info.HeapAllocs.erase(Pointer.Base.dyn_cast<DynamicAllocLValue>())) {
13257 Info.FFDiag(E, diag::note_constexpr_double_delete);