|
clang 24.0.0git
|
#include "ByteCode/Context.h"#include "ByteCode/EvalSettings.h"#include "ByteCode/Frame.h"#include "ByteCode/State.h"#include "ExprConstShared.h"#include "clang/AST/APValue.h"#include "clang/AST/ASTContext.h"#include "clang/AST/ASTLambda.h"#include "clang/AST/Attr.h"#include "clang/AST/CXXInheritance.h"#include "clang/AST/CharUnits.h"#include "clang/AST/ComparisonCategories.h"#include "clang/AST/CurrentSourceLocExprScope.h"#include "clang/AST/Expr.h"#include "clang/AST/InferAlloc.h"#include "clang/AST/OSLog.h"#include "clang/AST/OptionalDiagnostic.h"#include "clang/AST/RecordLayout.h"#include "clang/AST/Reflection.h"#include "clang/AST/SemaProxy.h"#include "clang/AST/StmtVisitor.h"#include "clang/AST/Type.h"#include "clang/AST/TypeLoc.h"#include "clang/Basic/Builtins.h"#include "clang/Basic/DiagnosticSema.h"#include "clang/Basic/TargetBuiltins.h"#include "clang/Basic/TargetInfo.h"#include "llvm/ADT/APFixedPoint.h"#include "llvm/ADT/Sequence.h"#include "llvm/ADT/SmallBitVector.h"#include "llvm/ADT/StringExtras.h"#include "llvm/ADT/bit.h"#include "llvm/Support/CRC.h"#include "llvm/Support/Casting.h"#include "llvm/Support/Debug.h"#include "llvm/Support/MathExtras.h"#include "llvm/Support/SaveAndRestore.h"#include "llvm/Support/SipHash.h"#include "llvm/Support/TimeProfiler.h"#include "llvm/Support/raw_ostream.h"#include <cstring>#include <functional>#include <limits>#include <optional>#include "clang/AST/TypeNodes.inc"#include "clang/AST/BuiltinTypes.def"#include "clang/Basic/OpenCLImageTypes.def"#include "clang/Basic/OpenCLExtensionTypes.def"#include "clang/Basic/AArch64ACLETypes.def"#include "clang/Basic/PPCTypes.def"#include "clang/Basic/RISCVVTypes.def"#include "clang/Basic/WebAssemblyReferenceTypes.def"#include "clang/Basic/AMDGPUTypes.def"#include "clang/Basic/HLSLIntangibleTypes.def"#include "clang/Basic/HLSLPackedTypes.def"#include "clang/Basic/SPIRVTypes.def"#include "clang/AST/StmtNodes.inc"Go to the source code of this file.
Classes | |
| struct | llvm::DenseMapInfo< ObjectUnderConstruction > |
| struct | LValueBaseString |
| struct | DynamicType |
Namespaces | |
| namespace | llvm |
| Diagnostic wrappers for TextAPI types for error reporting. | |
Macros | |
| #define | DEBUG_TYPE "exprconstant" |
| #define | TYPE(Class, Base) |
| #define | ABSTRACT_TYPE(Class, Base) |
| #define | NON_CANONICAL_TYPE(Class, Base) |
| #define | DEPENDENT_TYPE(Class, Base) |
| #define | NON_CANONICAL_UNLESS_DEPENDENT(Class, Base) |
| #define | TYPE(ID, BASE) |
| #define | DEPENDENT_TYPE(ID, BASE) |
| #define | NON_CANONICAL_TYPE(ID, BASE) |
| #define | NON_CANONICAL_UNLESS_DEPENDENT_TYPE(ID, BASE) |
| #define | BUILTIN_TYPE(ID, SINGLETON_ID) |
| #define | SIGNED_TYPE(ID, SINGLETON_ID) |
| #define | FLOATING_TYPE(ID, SINGLETON_ID) |
| #define | PLACEHOLDER_TYPE(ID, SINGLETON_ID) |
| #define | IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) |
| #define | EXT_OPAQUE_TYPE(ExtType, Id, Ext) |
| #define | SVE_TYPE(Name, Id, SingletonId) |
| #define | PPC_VECTOR_TYPE(Name, Id, Size) |
| #define | RVV_TYPE(Name, Id, SingletonId) |
| #define | WASM_TYPE(Name, Id, SingletonId) |
| #define | AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) |
| #define | HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) |
| #define | HLSL_PACKED_TYPE(Name, Id, SingletonId) |
| #define | SPIRV_TYPE(Name, Id, SingletonId) |
| #define | ABSTRACT_STMT(Node) |
| #define | STMT(Node, Base) |
| #define | EXPR(Node, Base) |
Typedefs | |
| using | CheckedTemporaries |
| Materialized temporaries that we've already checked to determine if they're initializsed by a constant expression. | |
Enumerations | |
| enum class | CheckEvaluationResultKind { ConstantExpression , FullyInitialized } |
| enum class | SizeOfType { SizeOf , DataSizeOf } |
Functions | |
| static bool | HandleDestruction (EvalInfo &Info, const Expr *E, const LValue &This, QualType ThisType) |
| Perform a destructor or pseudo-destructor call on the given object, which might in general not be a complete object. | |
| static bool | HandleDestruction (EvalInfo &Info, SourceLocation Loc, APValue::LValueBase LVBase, APValue &Value, QualType T) |
| Destroy and end the lifetime of the given complete object. | |
| static bool | isRead (AccessKinds AK) |
| static bool | isModification (AccessKinds AK) |
| static bool | isAnyAccess (AccessKinds AK) |
| static bool | isFormalAccess (AccessKinds AK) |
| Is this an access per the C++ definition? | |
| static bool | isValidIndeterminateAccess (AccessKinds AK) |
| Is this kind of access valid on an indeterminate object value? | |
| static bool | Evaluate (APValue &Result, EvalInfo &Info, const Expr *E) |
| static bool | EvaluateInPlace (APValue &Result, EvalInfo &Info, const LValue &This, const Expr *E, bool AllowNonLiteralTypes) |
| EvaluateInPlace - Evaluate an expression in-place in an APValue. In some cases, the in-place evaluation is essential, since later initializers for an object can indirectly refer to subobjects which were initialized earlier. | |
| static bool | EvaluateLValue (const Expr *E, LValue &Result, EvalInfo &Info, bool InvalidBaseOK) |
| Evaluate an expression as an lvalue. This can be legitimately called on expressions which are not glvalues, in three cases: | |
| static bool | EvaluatePointer (const Expr *E, LValue &Result, EvalInfo &Info, bool InvalidBaseOK=false) |
| static bool | EvaluateMemberPointer (const Expr *E, MemberPtr &Result, EvalInfo &Info) |
| static bool | EvaluateTemporary (const Expr *E, LValue &Result, EvalInfo &Info) |
| Evaluate an expression of record type as a temporary. | |
| static bool | EvaluateInteger (const Expr *E, APSInt &Result, EvalInfo &Info) |
| static bool | EvaluateIntegerOrLValue (const Expr *E, APValue &Result, EvalInfo &Info) |
| EvaluateIntegerOrLValue - Evaluate an rvalue integral-typed expression, and produce either the integer value or a pointer. | |
| static bool | EvaluateFloat (const Expr *E, APFloat &Result, EvalInfo &Info) |
| static bool | EvaluateComplex (const Expr *E, ComplexValue &Res, EvalInfo &Info) |
| static bool | EvaluateMatrix (const Expr *E, APValue &Result, EvalInfo &Info) |
| static bool | EvaluateAtomic (const Expr *E, const LValue *This, APValue &Result, EvalInfo &Info) |
| static bool | EvaluateAsRValue (EvalInfo &Info, const Expr *E, APValue &Result) |
| EvaluateAsRValue - Try to evaluate this expression, performing an implicit lvalue-to-rvalue cast if it is an lvalue. | |
| static std::optional< uint64_t > | EvaluateBuiltinStrLen (const Expr *E, EvalInfo &Info, std::string *StringResult=nullptr) |
| static bool | EvaluateFixedPointOrInteger (const Expr *E, APFixedPoint &Result, EvalInfo &Info) |
| Evaluate an integer or fixed point expression into an APResult. | |
| static bool | EvaluateFixedPoint (const Expr *E, APFixedPoint &Result, EvalInfo &Info) |
| Evaluate only a fixed point expression into an APResult. | |
| static void | negateAsSigned (APSInt &Int) |
| Negate an APSInt in place, converting it to a signed form if necessary, and preserving its value (by extending by up to one bit as needed). | |
| static bool | EvaluateIgnoredValue (EvalInfo &Info, const Expr *E) |
| Evaluate an expression to see if it had side-effects, and discard its result. | |
| static bool | IsOpaqueConstantCall (const LValue &LVal) |
| static bool | IsGlobalLValue (APValue::LValueBase B) |
| bool | isGlobalLValue (const ValueDecl *D, const Expr *E) |
| static const ValueDecl * | GetLValueBaseDecl (const LValue &LVal) |
| static bool | GetLValueBaseAsString (const EvalInfo &Info, const LValue &LVal, LValueBaseString &AsString) |
| static bool | ArePotentiallyOverlappingStringLiterals (const EvalInfo &Info, const LValue &LHS, const LValue &RHS) |
| static bool | IsWeakLValue (const LValue &Value) |
| static bool | isZeroSized (const LValue &Value) |
| static bool | HasSameBase (const LValue &A, const LValue &B) |
| static void | NoteLValueLocation (EvalInfo &Info, APValue::LValueBase Base) |
| static bool | CheckEvaluationResult (CheckEvaluationResultKind CERK, EvalInfo &Info, SourceLocation DiagLoc, QualType Type, const APValue &Value, ConstantExprKind Kind, const FieldDecl *SubobjectDecl, CheckedTemporaries &CheckedTemps, bool IsCompleteClass=true) |
| static bool | CheckLValueConstantExpression (EvalInfo &Info, SourceLocation Loc, QualType Type, const LValue &LVal, ConstantExprKind Kind, CheckedTemporaries &CheckedTemps) |
| Check that this reference or pointer core constant expression is a valid value for an address or reference constant expression. | |
| static bool | CheckMemberPointerConstantExpression (EvalInfo &Info, SourceLocation Loc, QualType Type, const APValue &Value, ConstantExprKind Kind) |
| Member pointers are constant expressions unless they point to a non-virtual dllimport member function. | |
| static bool | CheckLiteralType (EvalInfo &Info, const Expr *E, const LValue *This=nullptr) |
| Check that this core constant expression is of literal type, and if not, produce an appropriate diagnostic. | |
| static bool | CheckConstantExpression (EvalInfo &Info, SourceLocation DiagLoc, QualType Type, const APValue &Value, ConstantExprKind Kind) |
| Check that this core constant expression value is a valid value for a constant expression. | |
| static bool | CheckFullyInitialized (EvalInfo &Info, SourceLocation DiagLoc, QualType Type, const APValue &Value) |
| Check that this evaluated value is fully-initialized and can be loaded by an lvalue-to-rvalue conversion. | |
| static bool | CheckMemoryLeaks (EvalInfo &Info) |
| Enforce C++2a [expr.const]/4.17, which disallows new-expressions unless "the allocated storage is deallocated within the evaluation". | |
| static bool | EvalPointerValueAsBool (const APValue &Value, bool &Result) |
| static bool | HandleConversionToBool (const APValue &Val, bool &Result) |
| static bool | EvaluateAsBooleanCondition (const Expr *E, bool &Result, EvalInfo &Info) |
| template<typename T> | |
| static bool | HandleOverflow (EvalInfo &Info, const Expr *E, const T &SrcValue, QualType DestType) |
| static bool | HandleFloatToIntCast (EvalInfo &Info, const Expr *E, QualType SrcType, const APFloat &Value, QualType DestType, APSInt &Result) |
| static llvm::RoundingMode | getActiveRoundingMode (EvalInfo &Info, const Expr *E) |
| Get rounding mode to use in evaluation of the specified expression. | |
| static bool | checkFloatingPointResultForConstantFolding (EvalInfo &Info, const Expr *E, APFloat::opStatus St) |
| Check if the given floating-point evaluation result is allowed for compile-time constant folding during translation (as opposed to mandatory constant expression evaluation). | |
| static bool | HandleFloatToFloatCast (EvalInfo &Info, const Expr *E, QualType SrcType, QualType DestType, APFloat &Result) |
| static APSInt | HandleIntToIntCast (EvalInfo &Info, const Expr *E, QualType DestType, QualType SrcType, const APSInt &Value) |
| static bool | HandleIntToFloatCast (EvalInfo &Info, const Expr *E, const FPOptions FPO, QualType SrcType, const APSInt &Value, QualType DestType, APFloat &Result) |
| static bool | truncateBitfieldValue (EvalInfo &Info, const Expr *E, APValue &Value, const FieldDecl *FD) |
| template<typename Operation> | |
| static bool | CheckedIntArithmetic (EvalInfo &Info, const Expr *E, const APSInt &LHS, const APSInt &RHS, unsigned BitWidth, Operation Op, APSInt &Result) |
| Perform the given integer operation, which is known to need at most BitWidth bits, and check for overflow in the original type (if that type was not an unsigned type). | |
| static bool | handleIntIntBinOp (EvalInfo &Info, const BinaryOperator *E, const APSInt &LHS, BinaryOperatorKind Opcode, APSInt RHS, APSInt &Result) |
| Perform the given binary integer operation. | |
| static bool | handleFloatFloatBinOp (EvalInfo &Info, const BinaryOperator *E, APFloat &LHS, BinaryOperatorKind Opcode, const APFloat &RHS) |
| Perform the given binary floating-point operation, in-place, on LHS. | |
| static bool | handleLogicalOpForVector (const APInt &LHSValue, BinaryOperatorKind Opcode, const APInt &RHSValue, APInt &Result) |
| static bool | handleLogicalOpForVector (const APFloat &LHSValue, BinaryOperatorKind Opcode, const APFloat &RHSValue, APInt &Result) |
| static bool | handleLogicalOpForVector (const APValue &LHSValue, BinaryOperatorKind Opcode, const APValue &RHSValue, APInt &Result) |
| template<typename APTy> | |
| static bool | handleCompareOpForVectorHelper (const APTy &LHSValue, BinaryOperatorKind Opcode, const APTy &RHSValue, APInt &Result) |
| static bool | handleCompareOpForVector (const APValue &LHSValue, BinaryOperatorKind Opcode, const APValue &RHSValue, APInt &Result) |
| static bool | handleVectorVectorBinOp (EvalInfo &Info, const BinaryOperator *E, BinaryOperatorKind Opcode, APValue &LHSValue, const APValue &RHSValue) |
| static bool | CastToDerivedClass (EvalInfo &Info, const Expr *E, LValue &Result, const RecordDecl *TruncatedType, unsigned TruncatedElements) |
| Cast an lvalue referring to a base subobject to a derived class, by truncating the lvalue's path to the given length. | |
| static bool | HandleLValueDirectBase (EvalInfo &Info, const Expr *E, LValue &Obj, const CXXRecordDecl *Derived, const CXXRecordDecl *Base, const ASTRecordLayout *RL=nullptr) |
| static bool | HandleLValueDirectVirtualBase (EvalInfo &Info, const Expr *E, LValue &Obj, const CXXRecordDecl *Derived, const CXXRecordDecl *Base, const ASTRecordLayout *RL=nullptr) |
| static bool | HandleLValueBase (EvalInfo &Info, const Expr *E, LValue &Obj, const CXXRecordDecl *DerivedDecl, const CXXBaseSpecifier *Base) |
| static bool | HandleLValueBasePath (EvalInfo &Info, const CastExpr *E, QualType Type, LValue &Result) |
| static bool | CastToBaseClass (EvalInfo &Info, const Expr *E, LValue &Result, const CXXRecordDecl *DerivedRD, const CXXRecordDecl *BaseRD) |
| Cast an lvalue referring to a derived class to a known base subobject. | |
| static bool | HandleLValueMember (EvalInfo &Info, const Expr *E, LValue &LVal, const FieldDecl *FD, const ASTRecordLayout *RL=nullptr) |
| Update LVal to refer to the given field, which must be a member of the type currently described by LVal. | |
| static bool | HandleLValueIndirectMember (EvalInfo &Info, const Expr *E, LValue &LVal, const IndirectFieldDecl *IFD) |
| Update LVal to refer to the given indirect field. | |
| static bool | HandleSizeof (EvalInfo &Info, SourceLocation Loc, QualType Type, CharUnits &Size, SizeOfType SOT=SizeOfType::SizeOf) |
| Get the size of the given type in char units. | |
| static bool | HandleLValueArrayAdjustment (EvalInfo &Info, const Expr *E, LValue &LVal, QualType EltTy, APSInt Adjustment) |
| Update a pointer value to model pointer arithmetic. | |
| static bool | HandleLValueArrayAdjustment (EvalInfo &Info, const Expr *E, LValue &LVal, QualType EltTy, int64_t Adjustment) |
| static bool | HandleLValueComplexElement (EvalInfo &Info, const Expr *E, LValue &LVal, QualType EltTy, bool Imag) |
| Update an lvalue to refer to a component of a complex number. | |
| static bool | HandleLValueVectorElement (EvalInfo &Info, const Expr *E, LValue &LVal, QualType EltTy, uint64_t Size, uint64_t Idx) |
| static bool | evaluateVarDeclInit (EvalInfo &Info, const Expr *E, const VarDecl *VD, CallStackFrame *Frame, unsigned Version, APValue *&Result) |
| Try to evaluate the initializer for a variable declaration. | |
| static unsigned | getBaseIndex (const CXXRecordDecl *Derived, const CXXRecordDecl *Base) |
| Get the base index of the given base class within an APValue representing the given derived class. | |
| static APSInt | extractStringLiteralCharacter (EvalInfo &Info, const Expr *Lit, uint64_t Index) |
| Extract the value of a character from a string literal. | |
| static void | expandStringLiteral (EvalInfo &Info, const StringLiteral *S, APValue &Result, QualType AllocType=QualType()) |
| static void | expandArray (APValue &Array, unsigned Index) |
| static void | expandVector (APValue &Vec, unsigned NumElements) |
| bool | isReadByLvalueToRvalueConversion (const CXXRecordDecl *RD) |
| Determine whether a type would actually be read by an lvalue-to-rvalue conversion. | |
| bool | isReadByLvalueToRvalueConversion (QualType T) |
| static bool | diagnoseMutableFields (EvalInfo &Info, const Expr *E, AccessKinds AK, QualType T) |
| Diagnose an attempt to read from any unreadable field within the specified type, which might be a class type. | |
| static bool | lifetimeStartedInEvaluation (EvalInfo &Info, APValue::LValueBase Base, bool MutableSubobject=false) |
| static bool | CheckArraySize (EvalInfo &Info, const ConstantArrayType *CAT, SourceLocation CallLoc={}) |
| static bool | handleScalarCast (EvalInfo &Info, const FPOptions FPO, const Expr *E, QualType SourceTy, QualType DestTy, APValue const &Original, APValue &Result) |
| static bool | constructAggregate (EvalInfo &Info, const FPOptions FPO, const Expr *E, APValue &Result, QualType ResultType, SmallVectorImpl< APValue > &Elements, SmallVectorImpl< QualType > &ElTypes) |
| static bool | handleElementwiseCast (EvalInfo &Info, const Expr *E, const FPOptions FPO, SmallVectorImpl< APValue > &Elements, SmallVectorImpl< QualType > &SrcTypes, SmallVectorImpl< QualType > &DestTypes, SmallVectorImpl< APValue > &Results) |
| static unsigned | elementwiseSize (EvalInfo &Info, QualType BaseTy) |
| static bool | hlslAggSplatHelper (EvalInfo &Info, const Expr *E, APValue &SrcVal, QualType &SrcTy) |
| static bool | flattenAPValue (EvalInfo &Info, const Expr *E, APValue Value, QualType BaseTy, SmallVectorImpl< APValue > &Elements, SmallVectorImpl< QualType > &Types, unsigned Size) |
| static QualType | getSubobjectType (QualType ObjType, QualType SubobjType, bool IsMutable=false) |
| template<typename SubobjectHandler> | |
| static SubobjectHandler::result_type | findSubobject (EvalInfo &Info, const Expr *E, const CompleteObject &Obj, const SubobjectDesignator &Sub, SubobjectHandler &handler) |
| Find the designated sub-object of an rvalue. | |
| static bool | extractSubobject (EvalInfo &Info, const Expr *E, const CompleteObject &Obj, const SubobjectDesignator &Sub, APValue &Result, AccessKinds AK=AK_Read) |
| Extract the designated sub-object of an rvalue. | |
| static bool | modifySubobject (EvalInfo &Info, const Expr *E, const CompleteObject &Obj, const SubobjectDesignator &Sub, APValue &NewVal) |
| Update the designated sub-object of an rvalue to the given value. | |
| static unsigned | FindDesignatorMismatch (QualType ObjType, const SubobjectDesignator &A, const SubobjectDesignator &B, bool &WasArrayIndex) |
| Find the position where two subobject designators diverge, or equivalently the length of the common initial subsequence. | |
| static bool | AreElementsOfSameArray (QualType ObjType, const SubobjectDesignator &A, const SubobjectDesignator &B) |
| Determine whether the given subobject designators refer to elements of the same array object. | |
| static CompleteObject | findCompleteObject (EvalInfo &Info, const Expr *E, AccessKinds AK, const LValue &LVal, QualType LValType) |
| Find the complete object to which an LValue refers. | |
| static bool | handleLValueToRValueConversion (EvalInfo &Info, const Expr *Conv, QualType Type, const LValue &LVal, APValue &RVal, bool WantObjectRepresentation=false) |
| Perform an lvalue-to-rvalue conversion on the given glvalue. | |
| static bool | hlslElementwiseCastHelper (EvalInfo &Info, const Expr *E, QualType DestTy, SmallVectorImpl< APValue > &SrcVals, SmallVectorImpl< QualType > &SrcTypes) |
| static bool | handleAssignment (EvalInfo &Info, const Expr *E, const LValue &LVal, QualType LValType, APValue &Val) |
| Perform an assignment of Val to LVal. Takes ownership of Val. | |
| static bool | handleCompoundAssignment (EvalInfo &Info, const CompoundAssignOperator *E, const LValue &LVal, QualType LValType, QualType PromotedLValType, BinaryOperatorKind Opcode, const APValue &RVal) |
| Perform a compound assignment of LVal <op>= RVal. | |
| static bool | handleIncDec (EvalInfo &Info, const Expr *E, const LValue &LVal, QualType LValType, bool IsIncrement, APValue *Old) |
| Perform an increment or decrement on LVal. | |
| static bool | EvaluateObjectArgument (EvalInfo &Info, const Expr *Object, LValue &This) |
| Build an lvalue for the object argument of a member function call. | |
| static const ValueDecl * | HandleMemberPointerAccess (EvalInfo &Info, QualType LVType, LValue &LV, const Expr *RHS, bool IncludeMember=true) |
| HandleMemberPointerAccess - Evaluate a member access operation and build an lvalue referring to the result. | |
| static const ValueDecl * | HandleMemberPointerAccess (EvalInfo &Info, const BinaryOperator *BO, LValue &LV, bool IncludeMember=true) |
| static bool | HandleBaseToDerivedCast (EvalInfo &Info, const CastExpr *E, LValue &Result) |
| HandleBaseToDerivedCast - Apply the given base-to-derived cast operation on the provided lvalue, which currently refers to the base object. | |
| static bool | handleDefaultInitValue (QualType T, APValue &Result, bool IsCompleteClass=true) |
| Get the value to use for a default-initialized object of type T. | |
| static bool | EvaluateInitForDeclOfReferenceType (EvalInfo &Info, const ValueDecl *D, const Expr *Init, LValue &Result, APValue &Val) |
| Evaluates the initializer of a reference. | |
| static bool | EvaluateVarDecl (EvalInfo &Info, const VarDecl *VD) |
| static bool | EvaluateDecompositionDeclInit (EvalInfo &Info, const DecompositionDecl *DD) |
| static bool | EvaluateDecl (EvalInfo &Info, const Decl *D, bool EvaluateConditionDecl=false) |
| static bool | MaybeEvaluateDeferredVarDeclInit (EvalInfo &Info, const VarDecl *VD) |
| static bool | EvaluateDependentExpr (const Expr *E, EvalInfo &Info) |
| static bool | EvaluateCond (EvalInfo &Info, const VarDecl *CondDecl, const Expr *Cond, bool &Result) |
| Evaluate a condition (either a variable declaration or an expression). | |
| static EvalStmtResult | EvaluateStmt (StmtResult &Result, EvalInfo &Info, const Stmt *S, const SwitchCase *SC=nullptr) |
| static bool | ShouldPropagateBreakContinue (EvalInfo &Info, const Stmt *LoopOrSwitch, ArrayRef< BlockScopeRAII * > Scopes, EvalStmtResult &ESR) |
| Helper to implement named break/continue. | |
| static EvalStmtResult | EvaluateLoopBody (StmtResult &Result, EvalInfo &Info, const Stmt *Body, const SwitchCase *Case=nullptr) |
| Evaluate the body of a loop, and translate the result as appropriate. | |
| static EvalStmtResult | EvaluateSwitch (StmtResult &Result, EvalInfo &Info, const SwitchStmt *SS) |
| Evaluate a switch statement. | |
| static bool | CheckLocalVariableDeclaration (EvalInfo &Info, const VarDecl *VD) |
| static bool | CheckTrivialDefaultConstructor (EvalInfo &Info, SourceLocation Loc, const CXXConstructorDecl *CD, bool IsValueInitialization) |
| CheckTrivialDefaultConstructor - Check whether a constructor is a trivial default constructor. | |
| static bool | CheckConstexprFunction (EvalInfo &Info, SourceLocation CallLoc, const FunctionDecl *Declaration, const FunctionDecl *Definition, const Stmt *Body) |
| CheckConstexprFunction - Check that a function can be called in a constant expression. | |
| static bool | checkDynamicType (EvalInfo &Info, const Expr *E, const LValue &This, AccessKinds AK, bool Polymorphic) |
| Check that we can access the notional vptr of an object / determine its dynamic type. | |
| static bool | checkNonVirtualMemberCallThisPointer (EvalInfo &Info, const Expr *E, const LValue &This, const CXXMethodDecl *NamedMember) |
| Check that the pointee of the 'this' pointer in a member function call is either within its lifetime or in its period of construction or destruction. | |
| static const CXXRecordDecl * | getBaseClassType (SubobjectDesignator &Designator, unsigned PathLength) |
| static std::optional< DynamicType > | ComputeDynamicType (EvalInfo &Info, const Expr *E, LValue &This, AccessKinds AK) |
| Determine the dynamic type of an object. | |
| static const CXXMethodDecl * | HandleVirtualDispatch (EvalInfo &Info, const Expr *E, LValue &This, const CXXMethodDecl *Found, llvm::SmallVectorImpl< QualType > &CovariantAdjustmentPath) |
| Perform virtual dispatch. | |
| static bool | HandleCovariantReturnAdjustment (EvalInfo &Info, const Expr *E, APValue &Result, ArrayRef< QualType > Path) |
| Perform the adjustment from a value returned by a virtual function to a value of the statically expected type, which may be a pointer or reference to a base class of the returned type. | |
| static bool | isBaseClassPublic (const CXXRecordDecl *Derived, const CXXRecordDecl *Base) |
Determine whether Base, which is known to be a direct base class of Derived, is a public base class. | |
| static bool | HandleDynamicCast (EvalInfo &Info, const ExplicitCastExpr *E, LValue &Ptr) |
| Apply the given dynamic cast operation on the provided lvalue. | |
| static bool | MaybeHandleUnionActiveMemberChange (EvalInfo &Info, const Expr *LHSExpr, const LValue &LHS) |
| Handle a builtin simple-assignment or a call to a trivial assignment operator whose left-hand side might involve a union member access. | |
| static bool | EvaluateCallArg (const ParmVarDecl *PVD, const Expr *Arg, CallRef Call, EvalInfo &Info, bool NonNull=false, APValue **EvaluatedArg=nullptr) |
| static bool | EvaluateArgs (ArrayRef< const Expr * > Args, CallRef Call, EvalInfo &Info, const FunctionDecl *Callee, bool RightToLeft=false, LValue *ObjectArg=nullptr) |
| Evaluate the arguments to a function call. | |
| static bool | handleTrivialCopy (EvalInfo &Info, const ParmVarDecl *Param, const Expr *E, APValue &Result, bool CopyObjectRepresentation) |
| Perform a trivial copy from Param, which is the parameter of a copy or move constructor or assignment operator. | |
| bool | FunctionDefinitionCanBeLazilyInstantiated (const FunctionDecl *FD) |
| Whether we can instantiate FD during constant evaluation. | |
| static void | TryInstantiateFunctionBeforeCall (const FunctionDecl *FD, EvalInfo &Info, SourceLocation Loc) |
| static bool | HandleFunctionCall (SourceLocation CallLoc, const FunctionDecl *Callee, const LValue *ObjectArg, const Expr *E, ArrayRef< const Expr * > Args, CallRef Call, const Stmt *Body, EvalInfo &Info, APValue &Result, const LValue *ResultSlot) |
| Evaluate a function call. | |
| static bool | HandleConstructorCall (const Expr *E, const LValue &This, CallRef Call, const CXXConstructorDecl *Definition, EvalInfo &Info, APValue &Result, bool IsCompleteClass) |
| Evaluate a constructor call. | |
| static bool | HandleConstructorCall (const Expr *E, const LValue &This, ArrayRef< const Expr * > Args, const CXXConstructorDecl *Definition, EvalInfo &Info, APValue &Result, bool IsCompleteClass=true) |
| static bool | HandleDestructionImpl (EvalInfo &Info, SourceRange CallRange, const LValue &This, APValue &Value, QualType T, bool IsCompleteClass=true) |
| static bool | HandleOperatorNewCall (EvalInfo &Info, const CallExpr *E, LValue &Result) |
| Perform a call to 'operator new' or to ‘__builtin_operator_new’. | |
| static bool | hasVirtualDestructor (QualType T) |
| static const FunctionDecl * | getVirtualOperatorDelete (QualType T) |
| static std::optional< DynAlloc * > | CheckDeleteKind (EvalInfo &Info, const Expr *E, const LValue &Pointer, DynAllocKind DeallocKind) |
| Check that the given object is a suitable pointer to a heap allocation that still exists and is of the right kind for the purpose of a deletion. | |
| static bool | HandleOperatorDeleteCall (EvalInfo &Info, const CallExpr *E) |
| static bool | HandleLambdaCapture (EvalInfo &Info, const Expr *E, LValue &Result, const CXXMethodDecl *MD, const FieldDecl *FD, bool LValueToRValueConversion) |
| Get an lvalue to a field of a lambda's closure type. | |
| static bool | getBytesReturnedByAllocSizeCall (const ASTContext &Ctx, const LValue &LVal, llvm::APInt &Result) |
| Convenience function. LVal's base must be a call to an alloc_size function. | |
| static bool | evaluateLValueAsAllocSize (EvalInfo &Info, APValue::LValueBase Base, LValue &Result) |
| Attempts to evaluate the given LValueBase as the result of a call to a function with the alloc_size attribute. If it was possible to do so, this function will return true, make Result's Base point to said function call, and mark Result's Base as invalid. | |
| static bool | IsDeclSourceLocationCurrent (const FunctionDecl *FD) |
| static CharUnits | GetAlignOfType (const ASTContext &Ctx, QualType T, UnaryExprOrTypeTrait ExprKind) |
| unsigned | ConvertBuiltinIDToX86BuiltinID (const ASTContext &Ctx, unsigned BuiltinOp) |
| Convert a builtin ID to the canonical x86 builtin ID the constant evaluators dispatch on in their x86 target-specific cases. | |
| unsigned | ConvertBuiltinIDToX86BuiltinID (const ASTContext &Ctx, const CallExpr *E) |
| CharUnits | GetAlignOfExpr (const ASTContext &Ctx, const Expr *E, UnaryExprOrTypeTrait ExprKind) |
| static CharUnits | getBaseAlignment (EvalInfo &Info, const LValue &Value) |
| static bool | getAlignmentArgument (const Expr *E, QualType ForType, EvalInfo &Info, APSInt &Alignment) |
| Evaluate the value of the alignment argument to __builtin_align_{up,down}, __builtin_is_aligned and __builtin_assume_aligned. | |
| static bool | isOneByteCharacterType (QualType T) |
| static bool | EvaluateArrayNewInitList (EvalInfo &Info, LValue &This, APValue &Result, const InitListExpr *ILE, QualType AllocType) |
| static bool | EvaluateArrayNewConstructExpr (EvalInfo &Info, LValue &This, APValue &Result, const CXXConstructExpr *CCE, QualType AllocType) |
| static bool | EvaluateReflection (const Expr *E, APValue &Result, EvalInfo &Info) |
| static bool | HandleClassZeroInitialization (EvalInfo &Info, const Expr *E, const RecordDecl *RD, const LValue &This, APValue &Result, bool IsCompleteClass=true) |
| Perform zero-initialization on an object of non-union class type. C++11 [dcl.init]p5: To zero-initialize an object or reference of type T means: [...] – if T is a (possibly cv-qualified) non-union class type, each non-static data member and each base-class subobject is zero-initialized. | |
| static bool | EvaluateRecord (const Expr *E, const LValue &This, APValue &Result, EvalInfo &Info) |
| static bool | EvaluateVector (const Expr *E, APValue &Result, EvalInfo &Info) |
| static llvm::APInt | ConvertBoolVectorToInt (const APValue &Val) |
| static std::optional< APValue > | handleVectorUnaryOperator (ASTContext &Ctx, QualType ResultTy, UnaryOperatorKind Op, APValue Elt) |
| static bool | handleVectorElementCast (EvalInfo &Info, const FPOptions FPO, const Expr *E, QualType SourceTy, QualType DestTy, APValue const &Original, APValue &Result) |
| static bool | evalPackBuiltin (const CallExpr *E, EvalInfo &Info, APValue &Result, llvm::function_ref< APInt(const APSInt &)> PackFn) |
| static bool | evalShuffleGeneric (EvalInfo &Info, const CallExpr *Call, APValue &Out, llvm::function_ref< std::pair< unsigned, int >(unsigned, unsigned)> GetSourceIndex) |
| static bool | ConvertDoubleToFloatStrict (EvalInfo &Info, const Expr *E, APFloat OrigVal, APValue &Result) |
| static bool | evalShiftWithCount (EvalInfo &Info, const CallExpr *Call, APValue &Out, llvm::function_ref< APInt(const APInt &, uint64_t)> ShiftOp, llvm::function_ref< APInt(const APInt &, unsigned)> OverflowOp) |
| std::optional< APFloat > | EvalScalarMinMaxFp (const APFloat &A, const APFloat &B, std::optional< APSInt > RoundingMode, bool IsMin) |
| static bool | handleVectorShuffle (EvalInfo &Info, const ShuffleVectorExpr *E, QualType ElemType, APValue const &VecVal1, APValue const &VecVal2, unsigned EltNum, APValue &Result) |
| static bool | EvaluateArray (const Expr *E, const LValue &This, APValue &Result, EvalInfo &Info) |
| static bool | MaybeElementDependentArrayFiller (const Expr *FillerExpr) |
| GCCTypeClass | EvaluateBuiltinClassifyType (QualType T, const LangOptions &LangOpts) |
| EvaluateBuiltinClassifyType - Evaluate __builtin_classify_type the same way as GCC. | |
| static GCCTypeClass | EvaluateBuiltinClassifyType (const CallExpr *E, const LangOptions &LangOpts) |
| EvaluateBuiltinClassifyType - Evaluate __builtin_classify_type the same way as GCC. | |
| static bool | EvaluateBuiltinConstantPForLValue (const APValue &LV) |
| EvaluateBuiltinConstantPForLValue - Determine the result of __builtin_constant_p when applied to the given pointer. | |
| static bool | EvaluateBuiltinConstantP (EvalInfo &Info, const Expr *Arg) |
| EvaluateBuiltinConstantP - Evaluate __builtin_constant_p as similarly to GCC as we can manage. | |
| static QualType | getObjectType (APValue::LValueBase B) |
| Retrieves the "underlying object type" of the given expression, as used by __builtin_object_size. | |
| const Expr * | ignorePointerCastsAndParens (const Expr *E) |
| A more selective version of E->IgnoreParenCasts for tryEvaluateBuiltinObjectSize. This ignores some casts/parens that serve only to change the type of E. Ex. For E = (short*)((char*)(&foo)), returns &foo | |
| static bool | isDesignatorAtObjectEnd (const ASTContext &Ctx, const LValue &LVal) |
| Checks to see if the given LValue's Designator is at the end of the LValue's record layout. e.g. struct { struct { int a, b; } fst, snd; } obj; obj.fst // no obj.snd // yes obj.fst.a // no obj.fst.b // no obj.snd.a // no obj.snd.b // yes. | |
| static bool | refersToCompleteObject (const LValue &LVal) |
| Tests to see if the LValue has a user-specified designator (that isn't necessarily valid). Note that this always returns 'true' if the LValue has an unsized array as its first designator entry, because there's currently no way to tell if the user typed *foo or foo[0]. | |
| static bool | isUserWritingOffTheEnd (const ASTContext &Ctx, const LValue &LVal) |
| Attempts to detect a user writing into a piece of memory that's impossible to figure out the size of by just using types. | |
| static bool | convertUnsignedAPIntToCharUnits (const llvm::APInt &Int, CharUnits &Result) |
| Converts the given APInt to CharUnits, assuming the APInt is unsigned. Fails if the conversion would cause loss of precision. | |
| static void | addFlexibleArrayMemberInitSize (EvalInfo &Info, const QualType &T, const LValue &LV, CharUnits &Size) |
| If we're evaluating the object size of an instance of a struct that contains a flexible array member, add the size of the initializer. | |
| static bool | determineEndOffset (EvalInfo &Info, SourceLocation ExprLoc, unsigned Type, const LValue &LVal, CharUnits &EndOffset) |
| Helper for tryEvaluateBuiltinObjectSize – Given an LValue, this will determine how many bytes exist from the beginning of the object to either the end of the current subobject, or the end of the object itself, depending on what the LValue looks like + the value of Type. | |
| static std::optional< uint64_t > | tryEvaluateBuiltinObjectSize (const Expr *E, unsigned Type, EvalInfo &Info, bool IsDynamic=false) |
Tries to evaluate the __builtin_object_size for E. | |
| static bool | getBuiltinAlignArguments (const CallExpr *E, EvalInfo &Info, APValue &Val, APSInt &Alignment) |
| static bool | EvaluateStdcLoad8 (EvalInfo &Info, const CallExpr *E, bool IsBE, bool IsAligned, APSInt &Result) |
| static bool | isOnePastTheEndOfCompleteObject (const ASTContext &Ctx, const LValue &LV) |
| Determine whether this is a pointer past the end of the complete object referred to by the lvalue. | |
| static void | addOrSubLValueAsInteger (APValue &LVal, const APSInt &Index, bool IsSub) |
| template<class SuccessCB, class AfterCB> | |
| static bool | EvaluateComparisonBinaryOperator (EvalInfo &Info, const BinaryOperator *E, SuccessCB &&Success, AfterCB &&DoAfter) |
| static bool | EvaluateComparisonResult (EvalInfo &Info, const Expr *E, ComparisonCategoryResult CCR, APValue &Result) |
| static bool | TryEvaluateBuiltinNaN (const ASTContext &Context, QualType ResultTy, const Expr *Arg, bool SNaN, llvm::APFloat &Result) |
| uint8_t | GFNIMultiplicativeInverse (uint8_t Byte) |
| uint8_t | GFNIAffine (uint8_t XByte, const APInt &AQword, const APSInt &Imm, bool Inverse) |
| uint8_t | GFNIMul (uint8_t AByte, uint8_t BByte) |
| void | HandleComplexComplexMul (APFloat A, APFloat B, APFloat C, APFloat D, APFloat &ResR, APFloat &ResI) |
| void | HandleComplexComplexDiv (APFloat A, APFloat B, APFloat C, APFloat D, APFloat &ResR, APFloat &ResI) |
| APSInt | NormalizeRotateAmount (const APSInt &Value, const APSInt &Amount) |
| static bool | EvaluateVoid (const Expr *E, EvalInfo &Info) |
| static bool | FastEvaluateAsRValue (const Expr *Exp, APValue &Result, const ASTContext &Ctx, bool &IsConst) |
| static bool | hasUnacceptableSideEffect (Expr::EvalStatus &Result, Expr::SideEffectsKind SEK) |
| static bool | EvaluateAsRValue (const Expr *E, Expr::EvalResult &Result, const ASTContext &Ctx, EvalInfo &Info) |
| static bool | EvaluateAsInt (const Expr *E, Expr::EvalResult &ExprResult, const ASTContext &Ctx, Expr::SideEffectsKind AllowSideEffects, EvalInfo &Info) |
| static bool | EvaluateAsFixedPoint (const Expr *E, Expr::EvalResult &ExprResult, const ASTContext &Ctx, Expr::SideEffectsKind AllowSideEffects, EvalInfo &Info) |
| static bool | doEvaluateAsRValue (const Expr *E, Expr::EvalResult &Result, const ASTContext &Ctx, SemaProxy *SProxy, bool InConstantContext) |
| static bool | EvaluateDestruction (const ASTContext &Ctx, SemaProxy *SProxy, APValue::LValueBase Base, APValue DestroyedValue, QualType Type, SourceLocation Loc, Expr::EvalStatus &EStatus, bool IsConstantDestruction) |
| static bool | doEvaluateConstantExpr (Expr::EvalResult &Result, const ASTContext &Ctx, SemaProxy *SProxy, const Expr *E, ConstantExprKind Kind) |
| static bool | doEvaluateInitializer (const ASTContext &Ctx, SemaProxy *SProxy, const VarDecl *VD, const Expr *E, Expr::EvalResult &EStatus, bool IsConstantInitialization) |
| static bool | doEvaluateDestruction (const VarDecl *VD, SemaProxy *SProxy, bool IsConstantDestruction, SmallVectorImpl< PartialDiagnosticAt > &Notes) |
| static ICEDiag | NoDiag () |
| static ICEDiag | Worst (ICEDiag A, ICEDiag B) |
| static ICEDiag | CheckEvalInICE (const Expr *E, const ASTContext &Ctx) |
| static ICEDiag | CheckICE (const Expr *E, const ASTContext &Ctx) |
| static bool | EvaluateCPlusPlus11IntegralConstantExpr (const ASTContext &Ctx, const Expr *E, llvm::APSInt *Value, bool AllowRelaxedEval=false) |
| Evaluate an expression as a C++11 integral constant expression. | |
| template<typename T> | |
| static bool | EvaluateCharRangeAsStringImpl (const Expr *, T &Result, const Expr *SizeExpression, const Expr *PtrExpression, ASTContext &Ctx, SemaProxy &SProxy, Expr::EvalResult &Status) |
| #define ABSTRACT_STMT | ( | Node | ) |
| #define ABSTRACT_TYPE | ( | Class, | |
| Base ) |
| #define AMDGPU_TYPE | ( | Name, | |
| Id, | |||
| SingletonId, | |||
| Width, | |||
| Align ) |
| #define BUILTIN_TYPE | ( | ID, | |
| SINGLETON_ID ) |
| #define DEBUG_TYPE "exprconstant" |
Definition at line 80 of file ExprConstant.cpp.
| #define DEPENDENT_TYPE | ( | Class, | |
| Base ) |
| #define DEPENDENT_TYPE | ( | ID, | |
| BASE ) |
| #define EXPR | ( | Node, | |
| Base ) |
| #define EXT_OPAQUE_TYPE | ( | ExtType, | |
| Id, | |||
| Ext ) |
| #define FLOATING_TYPE | ( | ID, | |
| SINGLETON_ID ) |
| #define HLSL_INTANGIBLE_TYPE | ( | Name, | |
| Id, | |||
| SingletonId ) |
| #define HLSL_PACKED_TYPE | ( | Name, | |
| Id, | |||
| SingletonId ) |
| #define IMAGE_TYPE | ( | ImgType, | |
| Id, | |||
| SingletonId, | |||
| Access, | |||
| Suffix ) |
| #define NON_CANONICAL_TYPE | ( | Class, | |
| Base ) |
| #define NON_CANONICAL_TYPE | ( | ID, | |
| BASE ) |
| #define NON_CANONICAL_UNLESS_DEPENDENT | ( | Class, | |
| Base ) |
| #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE | ( | ID, | |
| BASE ) |
| #define PLACEHOLDER_TYPE | ( | ID, | |
| SINGLETON_ID ) |
| #define PPC_VECTOR_TYPE | ( | Name, | |
| Id, | |||
| Size ) |
| #define RVV_TYPE | ( | Name, | |
| Id, | |||
| SingletonId ) |
| #define SIGNED_TYPE | ( | ID, | |
| SINGLETON_ID ) |
| #define SPIRV_TYPE | ( | Name, | |
| Id, | |||
| SingletonId ) |
| #define STMT | ( | Node, | |
| Base ) |
| #define SVE_TYPE | ( | Name, | |
| Id, | |||
| SingletonId ) |
| #define TYPE | ( | Class, | |
| Base ) |
| #define TYPE | ( | ID, | |
| BASE ) |
| #define WASM_TYPE | ( | Name, | |
| Id, | |||
| SingletonId ) |
| using CheckedTemporaries |
Materialized temporaries that we've already checked to determine if they're initializsed by a constant expression.
Definition at line 2256 of file ExprConstant.cpp.
|
strong |
| Enumerator | |
|---|---|
| ConstantExpression | |
| FullyInitialized | |
Definition at line 2249 of file ExprConstant.cpp.
|
strong |
| Enumerator | |
|---|---|
| SizeOf | |
| DataSizeOf | |
Definition at line 3379 of file ExprConstant.cpp.
|
static |
If we're evaluating the object size of an instance of a struct that contains a flexible array member, add the size of the initializer.
Definition at line 16943 of file ExprConstant.cpp.
References clang::VarDecl::getFlexibleArrayInitChars(), clang::VarDecl::hasInit(), clang::T, and V.
Referenced by determineEndOffset().
Definition at line 19333 of file ExprConstant.cpp.
References clang::CharUnits::fromQuantity(), clang::APValue::getLValueOffset(), and clang::APValue::hasLValuePath().
|
static |
Determine whether the given subobject designators refer to elements of the same array object.
Definition at line 4697 of file ExprConstant.cpp.
References FindDesignatorMismatch().
|
static |
Definition at line 2144 of file ExprConstant.cpp.
References LValueBaseString::Bytes, and GetLValueBaseAsString().
Referenced by EvaluateComparisonBinaryOperator().
|
static |
Cast an lvalue referring to a derived class to a known base subobject.
Definition at line 3330 of file ExprConstant.cpp.
References clang::CXXBasePaths::front(), HandleLValueBase(), and clang::CXXRecordDecl::isDerivedFrom().
Referenced by HandleCovariantReturnAdjustment().
|
static |
Cast an lvalue referring to a base subobject to a derived class, by truncating the lvalue's path to the given length.
Definition at line 3228 of file ExprConstant.cpp.
References clang::CSK_Derived, clang::ASTRecordLayout::getBaseClassOffset(), clang::ASTRecordLayout::getVBaseClassOffset(), and clang::Decl::isInvalidDecl().
Referenced by HandleBaseToDerivedCast(), HandleDynamicCast(), HandleLValueBase(), HandleMemberPointerAccess(), and HandleVirtualDispatch().
|
static |
Definition at line 3876 of file ExprConstant.cpp.
Referenced by findSubobject(), and HandleDestructionImpl().
|
static |
Check that this core constant expression value is a valid value for a constant expression.
If not, report an appropriate diagnostic. Does not check that the expression is of literal type.
Definition at line 2627 of file ExprConstant.cpp.
References CheckEvaluationResult(), ConstantExpression, and clang::Type::isVoidType().
Referenced by doEvaluateConstantExpr(), doEvaluateInitializer(), EvaluateAsRValue(), and EvaluateComparisonResult().
|
static |
CheckConstexprFunction - Check that a function can be called in a constant expression.
Definition at line 6569 of file ExprConstant.cpp.
References bool, clang::cast(), clang::Declaration, clang::Definition, clang::NamedDecl::getIdentifier(), clang::Decl::getLocation(), clang::NamedDecl::getName(), clang::isa(), clang::FunctionDecl::isConstexpr(), and clang::SourceLocation::isMacroID().
Referenced by HandleDestructionImpl().
|
static |
Check that the given object is a suitable pointer to a heap allocation that still exists and is of the right kind for the purpose of a deletion.
On success, returns the heap allocation to deallocate. On failure, produces a diagnostic and returns std::nullopt.
Definition at line 7930 of file ExprConstant.cpp.
References clang::New, NoteLValueLocation(), and Pointer.
Referenced by HandleOperatorDeleteCall().
|
static |
Check that we can access the notional vptr of an object / determine its dynamic type.
Definition at line 6661 of file ExprConstant.cpp.
References findCompleteObject(), findSubobject(), and clang::APValue::getAsString().
Referenced by checkNonVirtualMemberCallThisPointer(), and ComputeDynamicType().
|
static |
Perform the given integer operation, which is known to need at most BitWidth bits, and check for overflow in the original type (if that type was not an unsigned type).
Definition at line 2886 of file ExprConstant.cpp.
References clang::Expr::getExprLoc(), clang::Stmt::getSourceRange(), clang::Expr::getType(), HandleOverflow(), clang::QualType::isWrapType(), and toString().
Referenced by handleIntIntBinOp().
|
static |
Definition at line 22947 of file ExprConstant.cpp.
References clang::ConstantExpression, EvaluateAsRValue(), clang::interp::Context::evaluateAsRValue(), clang::Stmt::getBeginLoc(), clang::ASTContext::getInterpContext(), clang::ASTContext::getLangOpts(), clang::Expr::EvalStatus::HasSideEffects, clang::interp::EvalSettings::InConstantContext, clang::APValue::isInt(), NoDiag(), and clang::Expr::EvalResult::Val.
Referenced by CheckICE().
|
static |
Definition at line 2508 of file ExprConstant.cpp.
References clang::Type::castAsArrayTypeUnsafe(), clang::Type::castAsRecordDecl(), CheckEvaluationResult(), CheckLValueConstantExpression(), CheckMemberPointerConstantExpression(), ConstantExpression, clang::Type::getAs(), clang::ArrayType::getElementType(), clang::Decl::getLocation(), clang::Value::getType(), clang::APValue::hasValue(), and clang::Value::hasValue().
Referenced by CheckConstantExpression(), CheckEvaluationResult(), CheckFullyInitialized(), and CheckLValueConstantExpression().
|
static |
Check if the given floating-point evaluation result is allowed for compile-time constant folding during translation (as opposed to mandatory constant expression evaluation).
Definition at line 2781 of file ExprConstant.cpp.
References clang::LangOptionsBase::FPE_Ignore, clang::FPOptions::getExceptionMode(), clang::Expr::getFPFeaturesInEffect(), and clang::FPOptions::getRoundingMode().
Referenced by handleFloatFloatBinOp(), HandleFloatToFloatCast(), and HandleIntToFloatCast().
|
static |
Check that this evaluated value is fully-initialized and can be loaded by an lvalue-to-rvalue conversion.
Definition at line 2642 of file ExprConstant.cpp.
References CheckEvaluationResult(), and FullyInitialized.
|
static |
Definition at line 22972 of file ExprConstant.cpp.
References clang::cast(), CheckEvalInICE(), CheckICE(), clang::Expr::EvaluateKnownConstInt(), clang::ASTContext::getAsVariableArrayType(), clang::Stmt::getBeginLoc(), clang::CallExpr::getBuiltinCallee(), clang::BinaryConditionalOperator::getCommon(), clang::ConditionalOperator::getCond(), clang::BinaryConditionalOperator::getFalseExpr(), clang::ConditionalOperator::getFalseExpr(), clang::ASTContext::getIntWidth(), clang::UnaryExprOrTypeTraitExpr::getKind(), clang::ASTContext::getLangOpts(), clang::BinaryOperator::getLHS(), clang::BinaryOperator::getOpcode(), clang::UnaryOperator::getOpcode(), clang::BinaryOperator::getRHS(), clang::VariableArrayType::getSizeExpr(), clang::Stmt::getStmtClass(), clang::UnaryOperator::getSubExpr(), clang::ConditionalOperator::getTrueExpr(), clang::Expr::getType(), clang::ValueDecl::getType(), clang::UnaryExprOrTypeTraitExpr::getTypeOfArgument(), clang::Expr::IgnoreParenCasts(), clang::Expr::IgnoreParenImpCasts(), clang::isa(), clang::VarDecl::isConstexpr(), clang::Type::isIntegralOrEnumerationType(), clang::Expr::isPRValue(), clang::Type::isReferenceType(), clang::Type::isSignedIntegerOrEnumerationType(), clang::VarDecl::isUsableInConstantExpressions(), clang::Expr::isValueDependent(), clang::Type::isVariableArrayType(), NoDiag(), clang::Stmt::NoStmtClass, and Worst().
Referenced by CheckICE(), clang::Expr::isCXX98IntegralConstantExpr(), and clang::Expr::isIntegerConstantExpr().
Check that this core constant expression is of literal type, and if not, produce an appropriate diagnostic.
Definition at line 2474 of file ExprConstant.cpp.
References clang::Expr::getType(), clang::Type::isLiteralType(), and clang::Expr::isPRValue().
Referenced by CheckConstexprDeclStmt(), CheckConstexprParameterTypes(), CheckConstexprReturnType(), EvaluateAsRValue(), and EvaluateInPlace().
Definition at line 5995 of file ExprConstant.cpp.
References clang::Decl::getLocation(), clang::VarDecl::getTSCSpec(), clang::VarDecl::isLocalVarDecl(), clang::VarDecl::isStaticLocal(), clang::VarDecl::isUsableInConstantExpressions(), and clang::TSCS_unspecified.
Referenced by EvaluateStmt().
|
static |
Check that this reference or pointer core constant expression is a valid value for an address or reference constant expression.
Return true if we can fold this expression, whether or not it's a constant expression.
Definition at line 2270 of file ExprConstant.cpp.
References CheckEvaluationResult(), ConstantExpression, clang::FixItHint::CreateInsertion(), getType(), clang::Type::isAnyPointerType(), clang::QualType::isDestructedType(), isForManglingOnly(), IsGlobalLValue(), clang::Type::isReferenceType(), isTemplateArgument(), NoteLValueLocation(), and V.
Referenced by CheckEvaluationResult(), and clang::Expr::EvaluateAsLValue().
|
static |
Member pointers are constant expressions unless they point to a non-virtual dllimport member function.
Definition at line 2454 of file ExprConstant.cpp.
References isForManglingOnly(), and clang::Member.
Referenced by CheckEvaluationResult().
|
static |
Enforce C++2a [expr.const]/4.17, which disallows new-expressions unless "the allocated storage is deallocated within the evaluation".
Definition at line 2652 of file ExprConstant.cpp.
Referenced by doEvaluateConstantExpr(), doEvaluateInitializer(), EvaluateAsRValue(), and EvaluateCharRangeAsStringImpl().
|
static |
Check that the pointee of the 'this' pointer in a member function call is either within its lifetime or in its period of construction or destruction.
Definition at line 6706 of file ExprConstant.cpp.
References clang::AK_Destroy, clang::AK_MemberCall, checkDynamicType(), and clang::isa().
|
static |
CheckTrivialDefaultConstructor - Check whether a constructor is a trivial default constructor.
If so, we'll fold it whether or not it's marked as constexpr. If it is marked as constexpr, we will never implicitly define it, so we need special handling.
Definition at line 6544 of file ExprConstant.cpp.
References clang::Decl::getLocation(), clang::FunctionDecl::isConstexpr(), clang::CXXConstructorDecl::isDefaultConstructor(), and clang::FunctionDecl::isTrivial().
|
static |
Determine the dynamic type of an object.
Definition at line 6731 of file ExprConstant.cpp.
References clang::AK_TypeId, checkDynamicType(), and getBaseClassType().
Referenced by HandleDynamicCast(), and HandleVirtualDispatch().
|
static |
Definition at line 3960 of file ExprConstant.cpp.
References clang::APValue, clang::cast(), clang::Type::castAs(), clang::RecordDecl::fields(), clang::Type::getAsRecordDecl(), clang::RecordDecl::getNumFields(), clang::CXXBaseSpecifier::getType(), handleScalarCast(), Int, int64_t, clang::Type::isConstantArrayType(), clang::Type::isIntegerType(), clang::Type::isRealFloatingType(), clang::Type::isRecordType(), and clang::Type::isVectorType().
|
static |
Definition at line 12196 of file ExprConstant.cpp.
References clang::APValue::getInt(), clang::APValue::getVectorElt(), clang::APValue::getVectorLength(), clang::APValue::isInt(), and clang::APValue::isVector().
| unsigned ConvertBuiltinIDToX86BuiltinID | ( | const ASTContext & | Ctx, |
| const CallExpr * | E ) |
Definition at line 10652 of file ExprConstant.cpp.
References ConvertBuiltinIDToX86BuiltinID(), and clang::CallExpr::getBuiltinCallee().
| unsigned ConvertBuiltinIDToX86BuiltinID | ( | const ASTContext & | Ctx, |
| unsigned | BuiltinID ) |
Convert a builtin ID to the canonical x86 builtin ID the constant evaluators dispatch on in their x86 target-specific cases.
Target-independent builtins are returned unchanged. An x86 target builtin (including an auxiliary-target x86 builtin, whose ID is shifted past the primary target's builtins) is translated to its canonical X86::BI* value. Any other target's builtin returns 0: the constant evaluators only fold x86 target builtins, and target builtin IDs of different targets overlap (each numbers from Builtin::FirstTSBuiltin), so an unrelated target's ID must not be mistaken for an x86 one.
The ID-based overload performs no work beyond a single comparison for target-independent builtins, so it is suitable for hot paths (e.g. the bytecode interpreter's builtin dispatch) where re-deriving the ID from the call expression would be wasteful.
Definition at line 10618 of file ExprConstant.cpp.
References clang::ASTContext::BuiltinInfo, clang::Builtin::FirstTSBuiltin, clang::Builtin::Context::getAuxBuiltinID(), clang::ASTContext::getAuxTargetInfo(), clang::ASTContext::getTargetInfo(), clang::TargetInfo::getTriple(), and clang::Builtin::Context::isAuxBuiltinID().
Referenced by ConvertBuiltinIDToX86BuiltinID(), and clang::interp::Compiler< Emitter >::VisitBuiltinCallExpr().
|
static |
Definition at line 12702 of file ExprConstant.cpp.
References clang::APValue.
Converts the given APInt to CharUnits, assuming the APInt is unsigned. Fails if the conversion would cause loss of precision.
Definition at line 16932 of file ExprConstant.cpp.
References clang::CharUnits::fromQuantity(), and Int.
Referenced by determineEndOffset().
|
static |
Helper for tryEvaluateBuiltinObjectSize – Given an LValue, this will determine how many bytes exist from the beginning of the object to either the end of the current subobject, or the end of the object itself, depending on what the LValue looks like + the value of Type.
If this returns false, the value of Result is undefined.
Definition at line 16959 of file ExprConstant.cpp.
References addFlexibleArrayMemberInitSize(), convertUnsignedAPIntToCharUnits(), getBytesReturnedByAllocSizeCall(), clang::QualType::getNonReferenceType(), getObjectType(), HandleSizeof(), int64_t, clang::Type::isFunctionType(), clang::Type::isIncompleteType(), clang::QualType::isNull(), isUserWritingOffTheEnd(), and refersToCompleteObject().
Referenced by tryEvaluateBuiltinObjectSize().
|
static |
Diagnose an attempt to read from any unreadable field within the specified type, which might be a class type.
Definition at line 3803 of file ExprConstant.cpp.
References clang::CXXRecordDecl::bases(), diagnoseMutableFields(), clang::RecordDecl::fields(), clang::Expr::getType(), clang::CXXRecordDecl::hasMutableFields(), isReadByLvalueToRvalueConversion(), clang::TagDecl::isUnion(), and clang::T.
Referenced by diagnoseMutableFields(), and findSubobject().
|
static |
Definition at line 22349 of file ExprConstant.cpp.
References clang::interp::Context::evaluateAsRValue(), FastEvaluateAsRValue(), clang::ASTContext::getInterpContext(), clang::ASTContext::getLangOpts(), clang::IgnoreSideEffects, clang::interp::EvalSettings::InConstantContext, and clang::Expr::isValueDependent().
|
static |
Definition at line 22541 of file ExprConstant.cpp.
References CheckConstantExpression(), CheckMemoryLeaks(), clang::ConstantExpression, clang::interp::Context::evaluate(), EvaluateDestruction(), EvaluateInPlace(), FastEvaluateAsRValue(), clang::Stmt::getBeginLoc(), clang::Expr::getExprLoc(), clang::ASTContext::getInterpContext(), clang::ASTContext::getLangOpts(), clang::Expr::getType(), clang::IgnoreSideEffects, clang::interp::EvalSettings::InConstantContext, clang::Expr::isValueDependent(), and clang::T.
|
static |
Definition at line 22716 of file ExprConstant.cpp.
References clang::ConstantExpression, clang::ConstantFold, clang::Expr::EvalStatus::Diag, clang::VarDecl::ensureEvaluatedStmt(), EvaluateDestruction(), clang::interp::Context::evaluateDestruction(), clang::Decl::getASTContext(), clang::ASTContext::getBaseElementType(), clang::VarDecl::getEvaluatedValue(), clang::ASTContext::getInterpContext(), clang::ASTContext::getLangOpts(), clang::Decl::getLocation(), clang::ValueDecl::getType(), handleDefaultInitValue(), clang::EvaluatedStmt::HasConstantDestruction, clang::Expr::EvalStatus::HasSideEffects, clang::interp::EvalSettings::InConstantContext, clang::Type::isArrayType(), and clang::Type::isRecordType().
|
static |
Definition at line 22627 of file ExprConstant.cpp.
References CheckConstantExpression(), CheckMemoryLeaks(), clang::ConstantExpression, clang::ConstantFold, clang::CPlusPlus, clang::interp::Context::evaluateAsInitializer(), EvaluateInPlace(), clang::ASTContext::getInterpContext(), clang::ASTContext::getLangOpts(), clang::Decl::getLocation(), clang::ValueDecl::getType(), clang::Expr::EvalStatus::HasSideEffects, clang::interp::EvalSettings::InConstantContext, clang::Expr::isValueDependent(), and clang::Expr::EvalResult::Val.
Definition at line 4083 of file ExprConstant.cpp.
References clang::cast(), clang::Type::castAs(), clang::RecordDecl::fields(), clang::Type::getAsRecordDecl(), clang::CXXBaseSpecifier::getType(), clang::Type::isBooleanType(), clang::Type::isConstantArrayType(), clang::Type::isConstantMatrixType(), clang::Type::isIntegerType(), clang::Type::isRealFloatingType(), clang::Type::isRecordType(), and clang::Type::isVectorType().
Referenced by hlslElementwiseCastHelper().
|
static |
Definition at line 12575 of file ExprConstant.cpp.
References clang::APValue, clang::Type::castAs(), EvaluateAsRValue(), clang::CallExpr::getArg(), clang::VectorType::getElementType(), clang::APValue::getInt(), clang::Expr::getType(), clang::APValue::getVectorElt(), clang::APValue::getVectorLength(), and clang::Type::isUnsignedIntegerType().
Definition at line 2664 of file ExprConstant.cpp.
Referenced by HandleConversionToBool().
| std::optional< APFloat > EvalScalarMinMaxFp | ( | const APFloat & | A, |
| const APFloat & | B, | ||
| std::optional< APSInt > | RoundingMode, | ||
| bool | IsMin ) |
Definition at line 12778 of file ExprConstant.cpp.
Referenced by clang::interp::InterpretBuiltin().
|
static |
Definition at line 12732 of file ExprConstant.cpp.
References clang::APValue, clang::Call, clang::Type::castAs(), EvaluateAsRValue(), clang::APValue::getInt(), clang::APValue::getVectorElt(), clang::Type::isUnsignedIntegerType(), and clang::Type::isVectorType().
|
static |
Definition at line 12615 of file ExprConstant.cpp.
References clang::APValue, clang::Call, EvaluateAsRValue(), EvaluateInteger(), clang::VectorType::getElementType(), clang::VectorType::getNumElements(), clang::APValue::getVectorElt(), clang::Type::isIntegerType(), clang::Type::isRealFloatingType(), clang::Type::isVectorType(), and clang::Zero.
Definition at line 22093 of file ExprConstant.cpp.
References clang::APValue, clang::C, EvaluateArray(), EvaluateAtomic(), EvaluateComplex(), EvaluateFloat(), EvaluateLValue(), EvaluateMatrix(), EvaluateMemberPointer(), EvaluatePointer(), EvaluateRecord(), EvaluateReflection(), EvaluateVector(), EvaluateVoid(), clang::Expr::getType(), clang::Type::isArrayType(), clang::Expr::isGLValue(), clang::Type::isRecordType(), clang::Expr::isValueDependent(), and clang::T.
Referenced by EvaluateAsBooleanCondition(), EvaluateAsRValue(), EvaluateComparisonBinaryOperator(), EvaluateIgnoredValue(), EvaluateInPlace(), EvaluateStmt(), clang::Expr::EvaluateWithSubstitution(), hlslAggSplatHelper(), hlslElementwiseCastHelper(), and clang::Expr::isPotentialConstantExprUnevaluated().
|
static |
Evaluate the arguments to a function call.
Definition at line 7183 of file ExprConstant.cpp.
References clang::Call, EvaluateCallArg(), clang::ParmVarDecl::isExplicitObjectParameter(), clang::APValue::isLValue(), clang::NonNull, and clang::Success.
Referenced by HandleConstructorCall().
|
static |
Definition at line 15787 of file ExprConstant.cpp.
References clang::Expr::getType(), clang::Type::isArrayType(), clang::Expr::isPRValue(), and clang::Expr::isValueDependent().
Referenced by Evaluate(), and EvaluateInPlace().
|
static |
Definition at line 15805 of file ExprConstant.cpp.
References clang::Expr::getType(), clang::Type::isArrayType(), clang::Expr::isPRValue(), and clang::Expr::isValueDependent().
|
static |
Definition at line 15795 of file ExprConstant.cpp.
References clang::Expr::getType(), clang::Type::isArrayType(), clang::Expr::isPRValue(), and clang::Expr::isValueDependent().
Definition at line 2724 of file ExprConstant.cpp.
References Evaluate(), HandleConversionToBool(), clang::Expr::isPRValue(), and clang::Expr::isValueDependent().
Referenced by EvaluateCond(), and EvaluateStmt().
|
static |
Definition at line 22331 of file ExprConstant.cpp.
References EvaluateAsRValue(), clang::Expr::getType(), hasUnacceptableSideEffect(), clang::Type::isFixedPointType(), and clang::Expr::isValueDependent().
|
static |
Definition at line 22315 of file ExprConstant.cpp.
References EvaluateAsRValue(), clang::Expr::getType(), hasUnacceptableSideEffect(), clang::Type::isIntegralOrEnumerationType(), and clang::Expr::isValueDependent().
Referenced by isInLoop().
|
static |
Definition at line 22305 of file ExprConstant.cpp.
References EvaluateAsRValue(), FastEvaluateAsRValue(), and clang::Expr::isValueDependent().
EvaluateAsRValue - Try to evaluate this expression, performing an implicit lvalue-to-rvalue cast if it is an lvalue.
Definition at line 22219 of file ExprConstant.cpp.
References CheckConstantExpression(), CheckLiteralType(), CheckMemoryLeaks(), Evaluate(), clang::Expr::getExprLoc(), clang::Expr::getType(), handleLValueToRValueConversion(), clang::Expr::isGLValue(), clang::QualType::isNull(), and clang::Expr::isValueDependent().
Referenced by CheckEvalInICE(), evalPackBuiltin(), evalShiftWithCount(), evalShuffleGeneric(), clang::Expr::EvaluateAsBooleanCondition(), EvaluateAsFixedPoint(), clang::Expr::EvaluateAsFloat(), EvaluateAsInt(), EvaluateAsRValue(), EvaluateBuiltinConstantP(), clang::Expr::EvaluateKnownConstInt(), clang::Expr::EvaluateKnownConstIntCheckOverflow(), clang::Expr::isCXX11ConstantExpr(), clang::Expr::isEvaluatable(), and tryEvaluateBuiltinObjectSize().
|
static |
Definition at line 21904 of file ExprConstant.cpp.
References clang::Expr::getType(), clang::Type::isAtomicType(), clang::Expr::isPRValue(), and clang::Expr::isValueDependent().
Referenced by Evaluate(), and EvaluateInPlace().
|
static |
EvaluateBuiltinClassifyType - Evaluate __builtin_classify_type the same way as GCC.
Definition at line 16656 of file ExprConstant.cpp.
References EvaluateBuiltinClassifyType(), clang::CallExpr::getArg(), clang::CallExpr::getNumArgs(), clang::Expr::getType(), and None.
| GCCTypeClass EvaluateBuiltinClassifyType | ( | QualType | T, |
| const LangOptions & | LangOpts ) |
EvaluateBuiltinClassifyType - Evaluate __builtin_classify_type the same way as GCC.
Definition at line 16495 of file ExprConstant.cpp.
References BitInt, Bool, clang::cast(), clang::Type::castAs(), ClassOrStruct, Complex, Enum, EvaluateBuiltinClassifyType(), getKind(), clang::Type::getTypeClass(), clang::AtomicType::getValueType(), Integer, clang::Type::isMemberDataPointerType(), clang::Type::isUnionType(), None, Pointer, PointerToDataMember, PointerToMemberFunction, clang::T, Union, Vector, and Void.
Referenced by EvaluateBuiltinClassifyType(), EvaluateBuiltinClassifyType(), and clang::interp::interp__builtin_classify_type().
EvaluateBuiltinConstantP - Evaluate __builtin_constant_p as similarly to GCC as we can manage.
Definition at line 16694 of file ExprConstant.cpp.
References EvaluateAsRValue(), EvaluateBuiltinConstantPForLValue(), clang::Expr::getType(), clang::APValue::LValue, and V.
EvaluateBuiltinConstantPForLValue - Determine the result of __builtin_constant_p when applied to the given pointer.
A pointer is only "constant" if it is null (or a pointer cast to integer) or it points to the first character of a string literal.
Definition at line 16673 of file ExprConstant.cpp.
References clang::APValue::getLValueBase(), clang::APValue::getLValueOffset(), clang::isa(), and clang::CharUnits::isZero().
Referenced by EvaluateBuiltinConstantP().
|
static |
Definition at line 23739 of file ExprConstant.cpp.
References EvaluatePointer(), clang::StringLiteral::findZeroCodeUnit(), clang::StringLiteral::getBytes(), clang::APValue::getInt(), clang::Type::getPointeeType(), clang::Expr::getType(), HandleLValueArrayAdjustment(), handleLValueToRValueConversion(), clang::Type::hasPointerRepresentation(), int64_t, clang::APValue::isInt(), clang::Expr::isPRValue(), clang::Off, and clang::OptionalUnsigned< T >::value_or().
Referenced by clang::Expr::tryEvaluateString(), and clang::Expr::tryEvaluateStrLen().
|
static |
Definition at line 7154 of file ExprConstant.cpp.
References clang::Call, EvaluateInPlace(), clang::Expr::getType(), clang::NonNull, and V.
Referenced by EvaluateArgs(), and clang::Expr::EvaluateWithSubstitution().
|
static |
Definition at line 23802 of file ExprConstant.cpp.
References clang::APValue, clang::C, CheckMemoryLeaks(), clang::ConstantExpression, clang::interp::Context::evaluateCharRange(), EvaluateInteger(), EvaluatePointer(), clang::APValue::getInt(), clang::ASTContext::getInterpContext(), clang::ASTContext::getLangOpts(), clang::Type::getPointeeType(), clang::Expr::getType(), HandleLValueArrayAdjustment(), handleLValueToRValueConversion(), clang::interp::EvalSettings::InConstantContext, and clang::T.
Referenced by clang::Expr::EvaluateCharRangeAsString(), and clang::Expr::EvaluateCharRangeAsString().
|
static |
Definition at line 19498 of file ExprConstant.cpp.
References ArePotentiallyOverlappingStringLiterals(), clang::Equal, clang::Error, Evaluate(), EvaluateComplex(), EvaluateFixedPointOrInteger(), EvaluateFloat(), EvaluateInteger(), EvaluateLValue(), EvaluateMemberPointer(), EvaluatePointer(), FindDesignatorMismatch(), clang::Decl::getAccess(), clang::BinaryOperator::getFPFeaturesInEffect(), clang::BinaryOperator::getLHS(), clang::BinaryOperator::getOpcode(), clang::FieldDecl::getParent(), clang::CharUnits::getQuantity(), clang::BinaryOperator::getRHS(), clang::Expr::getType(), getType(), HasSameBase(), clang::Type::isAnyComplexType(), clang::BinaryOperator::isAssignmentOp(), clang::BinaryOperator::isComparisonOp(), clang::BinaryOperator::isEqualityOp(), clang::Type::isFixedPointType(), clang::FPOptions::isFPConstrained(), clang::Type::isIncompleteType(), clang::Type::isIntegralOrEnumerationType(), clang::Type::isMemberPointerType(), clang::Type::isMetaInfoType(), clang::APValue::LValueBase::isNull(), clang::Type::isNullPtrType(), isOnePastTheEndOfCompleteObject(), IsOpaqueConstantCall(), clang::Type::isPointerType(), clang::Type::isRealFloatingType(), clang::BinaryOperator::isRelationalOp(), clang::TagDecl::isUnion(), clang::Expr::isValueDependent(), IsWeakLValue(), clang::CharUnits::isZero(), isZeroSized(), clang::APValue::Profile(), clang::Reversed, and clang::Success.
|
static |
Definition at line 19871 of file ExprConstant.cpp.
References CheckConstantExpression(), clang::Expr::getExprLoc(), clang::Expr::getType(), clang::ComparisonCategoryInfo::getValueInfo(), handleLValueToRValueConversion(), clang::ComparisonCategoryInfo::makeWeakResult(), and clang::ComparisonCategoryInfo::ValueInfo::VD.
Definition at line 21212 of file ExprConstant.cpp.
References clang::Expr::getType(), clang::Type::isAnyComplexType(), clang::Expr::isPRValue(), and clang::Expr::isValueDependent().
Referenced by Evaluate(), and EvaluateComparisonBinaryOperator().
|
static |
Evaluate a condition (either a variable declaration or an expression).
Definition at line 5815 of file ExprConstant.cpp.
References EvaluateAsBooleanCondition(), EvaluateDecl(), clang::Expr::isValueDependent(), and MaybeEvaluateDeferredVarDeclInit().
Referenced by EvaluateStmt().
|
static |
Evaluate an expression as a C++11 integral constant expression.
Definition at line 23414 of file ExprConstant.cpp.
References clang::Expr::getType(), clang::Expr::isCXX11ConstantExpr(), and clang::Type::isIntegralOrUnscopedEnumerationType().
Referenced by clang::Expr::getIntegerConstantExpr(), and clang::Expr::isIntegerConstantExpr().
Definition at line 5773 of file ExprConstant.cpp.
References EvaluateDecompositionDeclInit(), and EvaluateVarDecl().
Referenced by EvaluateCond(), EvaluateDecompositionDeclInit(), EvaluateStmt(), and EvaluateSwitch().
|
static |
Definition at line 5786 of file ExprConstant.cpp.
References EvaluateDecl(), and clang::DecompositionDecl::flat_bindings().
Referenced by EvaluateDecl(), and MaybeEvaluateDeferredVarDeclInit().
Definition at line 5805 of file ExprConstant.cpp.
References clang::Expr::containsErrors(), and clang::Expr::isValueDependent().
Referenced by EvaluateStmt(), EvaluateSwitch(), and HandleConstructorCall().
|
static |
Definition at line 22516 of file ExprConstant.cpp.
References clang::ConstantExpression, clang::ConstantFold, HandleDestruction(), and clang::Expr::EvalStatus::HasSideEffects.
Referenced by doEvaluateConstantExpr(), and doEvaluateDestruction().
Evaluate only a fixed point expression into an APResult.
Definition at line 16434 of file ExprConstant.cpp.
References clang::APValue::getFixedPoint(), clang::Expr::getType(), clang::APValue::isFixedPoint(), clang::Type::isFixedPointType(), and clang::Expr::isValueDependent().
Referenced by EvaluateFixedPointOrInteger().
Evaluate an integer or fixed point expression into an APResult.
Definition at line 16450 of file ExprConstant.cpp.
References EvaluateFixedPoint(), EvaluateInteger(), clang::Expr::getType(), clang::Type::isFixedPointType(), clang::Type::isIntegerType(), and clang::Expr::isValueDependent().
Referenced by EvaluateComparisonBinaryOperator().
Definition at line 20837 of file ExprConstant.cpp.
References clang::Expr::getType(), clang::Expr::isPRValue(), clang::Type::isRealFloatingType(), and clang::Expr::isValueDependent().
Referenced by Evaluate(), and EvaluateComparisonBinaryOperator().
Evaluate an expression to see if it had side-effects, and discard its result.
true if the caller should keep evaluating. Definition at line 1997 of file ExprConstant.cpp.
References Evaluate(), and clang::Expr::isValueDependent().
Referenced by EvaluateStmt(), HandleOperatorDeleteCall(), and HandleOperatorNewCall().
|
static |
Evaluates the initializer of a reference.
Definition at line 5713 of file ExprConstant.cpp.
References clang::AK_Dereference, EvaluateLValue(), clang::ValueDecl::getType(), clang::Init, and clang::Type::isReferenceType().
Referenced by EvaluateVarDecl(), and HandleConstructorCall().
|
static |
EvaluateInPlace - Evaluate an expression in-place in an APValue. In some cases, the in-place evaluation is essential, since later initializers for an object can indirectly refer to subobjects which were initialized earlier.
Definition at line 22185 of file ExprConstant.cpp.
References CheckLiteralType(), Evaluate(), EvaluateArray(), EvaluateAtomic(), EvaluateRecord(), clang::Expr::getType(), clang::Type::isArrayType(), clang::QualType::isNull(), clang::Expr::isPRValue(), clang::Type::isRecordType(), clang::Expr::isValueDependent(), and clang::T.
Referenced by doEvaluateConstantExpr(), doEvaluateInitializer(), EvaluateCallArg(), EvaluateStmt(), EvaluateVarDecl(), HandleClassZeroInitialization(), and HandleConstructorCall().
Definition at line 16413 of file ExprConstant.cpp.
References EvaluateIntegerOrLValue(), clang::APValue::getInt(), clang::APValue::isInt(), and clang::Expr::isValueDependent().
Referenced by evalShuffleGeneric(), EvaluateCharRangeAsStringImpl(), EvaluateComparisonBinaryOperator(), EvaluateFixedPointOrInteger(), EvaluateSwitch(), getAlignmentArgument(), getBuiltinAlignArguments(), and HandleOperatorNewCall().
EvaluateIntegerOrLValue - Evaluate an rvalue integral-typed expression, and produce either the integer value or a pointer.
GCC has a heinous extension which folds casts between pointer types and pointer-sized integral types. We support this by allowing the evaluation of an integer rvalue to produce a pointer (represented as an lvalue) instead. Some simple arithmetic on such values is supported (they are treated much like char*).
Definition at line 16406 of file ExprConstant.cpp.
References clang::Expr::getType(), clang::Type::isIntegralOrEnumerationType(), clang::Expr::isPRValue(), and clang::Expr::isValueDependent().
Referenced by EvaluateInteger().
|
static |
Evaluate the body of a loop, and translate the result as appropriate.
Definition at line 5896 of file ExprConstant.cpp.
References EvaluateStmt().
Referenced by EvaluateStmt().
Evaluate an expression as an lvalue. This can be legitimately called on expressions which are not glvalues, in three cases:
Definition at line 9703 of file ExprConstant.cpp.
References clang::Expr::getType(), clang::Expr::IgnoreParens(), clang::isa(), clang::Type::isFunctionType(), clang::Expr::isGLValue(), clang::Expr::isValueDependent(), and clang::Type::isVoidType().
Referenced by Evaluate(), clang::Expr::EvaluateAsLValue(), EvaluateComparisonBinaryOperator(), EvaluateInitForDeclOfReferenceType(), and EvaluateObjectArgument().
|
static |
Attempts to evaluate the given LValueBase as the result of a call to a function with the alloc_size attribute. If it was possible to do so, this function will return true, make Result's Base point to said function call, and mark Result's Base as invalid.
Definition at line 10166 of file ExprConstant.cpp.
References clang::Type::castAs(), clang::VarDecl::getAnyInitializer(), getPointeeType(), clang::Expr::getType(), clang::ValueDecl::getType(), clang::Init, clang::QualType::isConstQualified(), and clang::VarDecl::isLocalVarDecl().
Definition at line 15635 of file ExprConstant.cpp.
References clang::Expr::getType(), clang::Type::isConstantMatrixType(), and clang::Expr::isPRValue().
Referenced by Evaluate().
Definition at line 11466 of file ExprConstant.cpp.
References clang::Expr::getType(), clang::Type::isMemberPointerType(), clang::Expr::isPRValue(), and clang::Expr::isValueDependent().
Referenced by Evaluate(), EvaluateComparisonBinaryOperator(), HandleMemberPointerAccess(), and HandleMemberPointerAccess().
Build an lvalue for the object argument of a member function call.
Definition at line 5433 of file ExprConstant.cpp.
References EvaluateLValue(), EvaluatePointer(), and EvaluateTemporary().
Referenced by clang::Expr::EvaluateWithSubstitution(), and HandleMemberPointerAccess().
|
static |
Definition at line 10342 of file ExprConstant.cpp.
References clang::Expr::getType(), clang::Type::hasPointerRepresentation(), clang::Expr::isPRValue(), and clang::Expr::isValueDependent().
Referenced by Evaluate(), EvaluateBuiltinStrLen(), EvaluateCharRangeAsStringImpl(), EvaluateComparisonBinaryOperator(), EvaluateObjectArgument(), EvaluateStdcLoad8(), getBuiltinAlignArguments(), HandleOperatorDeleteCall(), and tryEvaluateBuiltinObjectSize().
|
static |
Definition at line 12085 of file ExprConstant.cpp.
References clang::Expr::getType(), clang::Expr::isPRValue(), clang::Type::isRecordType(), and clang::Expr::isValueDependent().
Referenced by Evaluate(), and EvaluateInPlace().
Definition at line 11430 of file ExprConstant.cpp.
References clang::Expr::getType(), clang::Type::isMetaInfoType(), and clang::Expr::isPRValue().
Referenced by Evaluate().
|
static |
Definition at line 17145 of file ExprConstant.cpp.
References clang::AK_Read, clang::CharUnits::alignmentAtOffset(), EvaluatePointer(), clang::CallExpr::getArg(), getBaseAlignment(), clang::CallExpr::getBuiltinCallee(), clang::APValue::getInt(), clang::CharUnits::getQuantity(), clang::Expr::getType(), HandleLValueArrayAdjustment(), handleLValueToRValueConversion(), and clang::Type::isSignedIntegerType().
|
static |
Definition at line 6010 of file ExprConstant.cpp.
References clang::CompoundStmt::body(), clang::cast(), CheckLocalVariableDeclaration(), clang::DeclStmt::decls(), Evaluate(), EvaluateAsBooleanCondition(), EvaluateCond(), EvaluateDecl(), EvaluateDependentExpr(), EvaluateIgnoredValue(), EvaluateInPlace(), EvaluateLoopBody(), EvaluateStmt(), EvaluateSwitch(), EvaluateVarDecl(), clang::Stmt::getBeginLoc(), clang::CXXForRangeStmt::getBeginStmt(), clang::CXXForRangeStmt::getBody(), clang::DoStmt::getBody(), clang::ForStmt::getBody(), clang::WhileStmt::getBody(), clang::CXXForRangeStmt::getCond(), clang::DoStmt::getCond(), clang::ForStmt::getCond(), clang::IfStmt::getCond(), clang::WhileStmt::getCond(), clang::ForStmt::getConditionVariable(), clang::IfStmt::getConditionVariable(), clang::WhileStmt::getConditionVariable(), clang::IfStmt::getElse(), clang::CXXForRangeStmt::getEndStmt(), clang::CXXForRangeStmt::getInc(), clang::ForStmt::getInc(), clang::CXXForRangeStmt::getInit(), clang::ForStmt::getInit(), clang::IfStmt::getInit(), clang::CXXForRangeStmt::getLoopVarStmt(), clang::CXXForRangeStmt::getRangeStmt(), clang::Stmt::getSourceRange(), clang::Stmt::getStmtClass(), clang::IfStmt::getThen(), clang::hasSpecificAttr(), clang::Init, clang::isa(), clang::IfStmt::isConsteval(), clang::IfStmt::isNonNegatedConsteval(), clang::Expr::isValueDependent(), and ShouldPropagateBreakContinue().
Referenced by EvaluateLoopBody(), EvaluateStmt(), EvaluateSwitch(), HandleConstructorCall(), HandleDestructionImpl(), and HandleFunctionCall().
|
static |
Evaluate a switch statement.
Definition at line 5909 of file ExprConstant.cpp.
References clang::cast(), EvaluateDecl(), EvaluateDependentExpr(), EvaluateInteger(), clang::Expr::EvaluateKnownConstInt(), EvaluateStmt(), clang::Found, clang::SwitchStmt::getBody(), clang::SwitchStmt::getCond(), clang::SwitchStmt::getConditionVariable(), clang::SwitchStmt::getInit(), clang::CaseStmt::getLHS(), clang::SwitchCase::getNextSwitchCase(), clang::CaseStmt::getRHS(), clang::SwitchStmt::getSwitchCaseList(), clang::Init, clang::isa(), clang::Expr::isValueDependent(), MaybeEvaluateDeferredVarDeclInit(), and ShouldPropagateBreakContinue().
Referenced by EvaluateStmt().
Evaluate an expression of record type as a temporary.
Definition at line 12142 of file ExprConstant.cpp.
References clang::Expr::getType(), clang::Expr::isPRValue(), clang::Type::isRecordType(), and clang::Expr::isValueDependent().
Referenced by EvaluateObjectArgument().
Definition at line 5736 of file ExprConstant.cpp.
References clang::APValue, EvaluateInitForDeclOfReferenceType(), EvaluateInPlace(), clang::VarDecl::getInit(), clang::ValueDecl::getType(), handleDefaultInitValue(), clang::VarDecl::hasLocalStorage(), clang::Type::isDependentType(), clang::Decl::isInvalidDecl(), clang::Type::isReferenceType(), and clang::Expr::isValueDependent().
Referenced by EvaluateDecl(), and EvaluateStmt().
|
static |
Try to evaluate the initializer for a variable declaration.
| Info | Information about the ongoing evaluation. |
| E | An expression to be used when printing diagnostics. |
| VD | The variable whose initializer should be obtained. |
| Version | The version of the variable within the frame. |
| Frame | The frame in which the variable was created. Must be null if this variable is not local to the evaluation. |
| Result | Filled in with a pointer to the value of the variable. |
Definition at line 3477 of file ExprConstant.cpp.
References clang::DeclContext::Equals(), clang::VarDecl::evaluateValue(), clang::VarDecl::getAnyInitializer(), clang::Decl::getDeclContext(), clang::VarDecl::getEvaluatedValue(), clang::ValueDecl::getType(), clang::VarDecl::hasConstantInitialization(), clang::VarDecl::hasICEInitializer(), clang::Init, clang::isa(), clang::VarDecl::isInitCapture(), clang::isLambdaCallOperator(), clang::Type::isReferenceType(), clang::Expr::isValueDependent(), clang::ValueDecl::isWeak(), clang::VarDecl::mightBeUsableInConstantExpressions(), and NoteLValueLocation().
Referenced by findCompleteObject().
Definition at line 12190 of file ExprConstant.cpp.
References clang::Expr::getType(), clang::Expr::isPRValue(), and clang::Type::isVectorType().
Referenced by Evaluate().
Definition at line 22083 of file ExprConstant.cpp.
References clang::Expr::getType(), clang::Expr::isPRValue(), clang::Expr::isValueDependent(), and clang::Type::isVoidType().
Referenced by Evaluate().
Definition at line 3744 of file ExprConstant.cpp.
References clang::APValue::getArrayFiller(), clang::APValue::getArrayInitializedElt(), clang::APValue::hasArrayFiller(), and clang::APValue::swap().
Referenced by findSubobject(), and HandleDestructionImpl().
|
static |
Definition at line 3721 of file ExprConstant.cpp.
References clang::APValue, clang::StringLiteral::getCodeUnit(), clang::ArrayType::getElementType(), clang::StringLiteral::getLength(), clang::Expr::getType(), clang::ConstantArrayType::getZExtSize(), clang::Type::isIntegerType(), and clang::Type::isUnsignedIntegerType().
Definition at line 3765 of file ExprConstant.cpp.
References clang::APValue, clang::APValue::IndeterminateValue(), and clang::APValue::isIndeterminate().
Referenced by findSubobject().
Extract the value of a character from a string literal.
Definition at line 3689 of file ExprConstant.cpp.
References clang::cast(), clang::StringLiteral::getCodeUnit(), clang::ArrayType::getElementType(), clang::Expr::getType(), clang::isa(), clang::Type::isIntegerType(), and clang::Type::isUnsignedIntegerType().
Referenced by handleLValueToRValueConversion().
|
static |
Extract the designated sub-object of an rvalue.
Definition at line 4592 of file ExprConstant.cpp.
References clang::AK_Read, clang::AK_ReadObjectRepresentation, and findSubobject().
Referenced by handleLValueToRValueConversion().
|
static |
Definition at line 22246 of file ExprConstant.cpp.
References clang::APValue, FastEvaluateAsRValue(), clang::Expr::getType(), clang::APValue::isLValue(), clang::QualType::isNull(), and clang::ASTContext::MakeIntValue().
Referenced by doEvaluateAsRValue(), doEvaluateConstantExpr(), clang::Expr::EvaluateAsInt(), EvaluateAsRValue(), clang::Expr::EvaluateForOverflow(), clang::Expr::EvaluateKnownConstInt(), clang::Expr::EvaluateKnownConstIntCheckOverflow(), FastEvaluateAsRValue(), and clang::Expr::isCXX11ConstantExpr().
|
static |
Find the complete object to which an LValue refers.
Definition at line 4717 of file ExprConstant.cpp.
References clang::AK_Dereference, clang::APValue::LValueBase::dyn_cast(), evaluateVarDeclInit(), clang::APValue::getAsString(), clang::VarDecl::getDefinition(), clang::APValue::LValueBase::getDynamicAllocType(), clang::Decl::getLocation(), clang::Stmt::getSourceRange(), getType(), clang::APValue::LValueBase::getVersion(), clang::VarDecl::hasDefinition(), clang::isa(), isAnyAccess(), clang::Type::isArrayType(), clang::VarDecl::isConstexpr(), clang::VarDecl::isCXXForRangeImplicitVar(), isFormalAccess(), clang::Decl::isInvalidDecl(), isModification(), clang::QualType::isVolatileQualified(), lifetimeStartedInEvaluation(), NoteLValueLocation(), clang::SD_Static, and V.
Referenced by checkDynamicType(), handleAssignment(), handleCompoundAssignment(), HandleDestruction(), handleIncDec(), handleLValueToRValueConversion(), and MaybeHandleUnionActiveMemberChange().
|
static |
Find the position where two subobject designators diverge, or equivalently the length of the common initial subsequence.
Definition at line 4660 of file ExprConstant.cpp.
References clang::Type::castAs(), clang::Type::castAsArrayTypeUnsafe(), clang::ArrayType::getElementType(), clang::Type::isAnyComplexType(), clang::Type::isArrayType(), and clang::QualType::isNull().
Referenced by AreElementsOfSameArray(), and EvaluateComparisonBinaryOperator().
|
static |
Find the designated sub-object of an rvalue.
Definition at line 4308 of file ExprConstant.cpp.
References clang::AK_Construct, clang::AK_IsWithinLifetime, clang::APValue, clang::Type::castAs(), clang::Type::castAsCanonical(), CheckArraySize(), diagnoseMutableFields(), clang::APValue::LValueBase::dyn_cast(), expandArray(), expandVector(), clang::APValue::getArrayFiller(), clang::APValue::getArrayInitializedElt(), clang::APValue::getArrayInitializedElts(), clang::Type::getAs(), clang::Type::getAsCXXRecordDecl(), getBaseIndex(), clang::FieldDecl::getCanonicalDecl(), clang::APValue::getComplexFloatImag(), clang::APValue::getComplexFloatReal(), clang::APValue::getComplexIntImag(), clang::APValue::getComplexIntReal(), clang::ArrayType::getElementType(), clang::ComplexType::getElementType(), clang::Expr::getExprLoc(), clang::Decl::getLocation(), clang::QualType::getQualifiers(), clang::ConstantArrayType::getSize(), clang::Stmt::getSourceRange(), clang::APValue::getStructBase(), clang::APValue::getStructField(), clang::APValue::getStructNumBases(), clang::APValue::getStructVirtualBase(), getSubobjectType(), clang::APValue::getUnionField(), clang::APValue::getUnionValue(), clang::APValue::getVectorElt(), clang::isa(), clang::APValue::isAbsent(), clang::Type::isAnyComplexType(), clang::Type::isArrayType(), clang::FieldDecl::isBitField(), clang::APValue::isComplexFloat(), clang::APValue::isComplexInt(), clang::QualType::isConstQualified(), isFormalAccess(), clang::APValue::isIndeterminate(), isModification(), isRead(), clang::Type::isRecordType(), clang::TagDecl::isUnion(), isValidIndeterminateAccess(), clang::APValue::isVector(), clang::QualType::isVolatileQualified(), NoteLValueLocation(), clang::QualType::removeLocalConst(), clang::QualType::removeLocalVolatile(), clang::APValue::setUnion(), and truncateBitfieldValue().
Referenced by checkDynamicType(), extractSubobject(), handleCompoundAssignment(), HandleDestruction(), handleIncDec(), MaybeHandleUnionActiveMemberChange(), and modifySubobject().
|
static |
Definition at line 4164 of file ExprConstant.cpp.
References clang::cast(), clang::Type::castAs(), clang::RecordDecl::fields(), clang::Type::getAsRecordDecl(), clang::CXXBaseSpecifier::getType(), int64_t, clang::Type::isConstantArrayType(), clang::Type::isConstantMatrixType(), clang::Type::isRecordType(), and clang::Type::isVectorType().
Referenced by hlslElementwiseCastHelper().
| bool FunctionDefinitionCanBeLazilyInstantiated | ( | const FunctionDecl * | FD | ) |
Whether we can instantiate FD during constant evaluation.
Definition at line 7244 of file ExprConstant.cpp.
References clang::FunctionDecl::getMostRecentDecl(), clang::FunctionDecl::getTemplateInstantiationPattern(), clang::FunctionDecl::isConstexpr(), clang::FunctionDecl::isDefined(), and clang::FunctionDecl::isImplicitlyInstantiable().
Referenced by clang::interp::compileFunction(), and TryInstantiateFunctionBeforeCall().
|
static |
Get rounding mode to use in evaluation of the specified expression.
If rounding mode is unknown at compile time, still try to evaluate the expression. If the result is exact, it does not depend on rounding mode. So return "tonearest" mode instead of "dynamic".
Definition at line 2770 of file ExprConstant.cpp.
References clang::Expr::getFPFeaturesInEffect(), and clang::FPOptions::getRoundingMode().
Referenced by handleFloatFloatBinOp(), HandleFloatToFloatCast(), and HandleIntToFloatCast().
|
static |
Evaluate the value of the alignment argument to __builtin_align_{up,down}, __builtin_is_aligned and __builtin_assume_aligned.
Definition at line 10691 of file ExprConstant.cpp.
References EvaluateInteger().
Referenced by getBuiltinAlignArguments().
| CharUnits GetAlignOfExpr | ( | const ASTContext & | Ctx, |
| const Expr * | E, | ||
| UnaryExprOrTypeTrait | ExprKind ) |
Definition at line 10657 of file ExprConstant.cpp.
References GetAlignOfType(), clang::ASTContext::getDeclAlign(), clang::Expr::getType(), and clang::Expr::IgnoreParens().
Referenced by clang::interp::getBaseAlignment(), and getBaseAlignment().
|
static |
Definition at line 10582 of file ExprConstant.cpp.
References clang::ASTContext::getLangOpts(), clang::ASTContext::getPreferredTypeAlign(), clang::ASTContext::getTypeAlignInChars(), clang::LangOptions::isCompatibleWith(), clang::CharUnits::One(), clang::T, and clang::ASTContext::toCharUnitsFromBits().
Referenced by GetAlignOfExpr(), and getBaseAlignment().
|
static |
Definition at line 10678 of file ExprConstant.cpp.
References clang::GetAlignOfDynamicAlloc(), GetAlignOfExpr(), GetAlignOfType(), clang::DynamicAllocLValue::getAllocKind(), and clang::Value::getType().
Referenced by EvaluateStdcLoad8().
|
static |
Definition at line 6721 of file ExprConstant.cpp.
Referenced by ComputeDynamicType(), HandleDynamicCast(), and HandleVirtualDispatch().
|
static |
Get the base index of the given base class within an APValue representing the given derived class.
Definition at line 3667 of file ExprConstant.cpp.
References clang::CXXRecordDecl::bases(), clang::Type::getAsCXXRecordDecl(), clang::CXXRecordDecl::getCanonicalDecl(), clang::APValue::LValueBase::getType(), and clang::CXXRecordDecl::vbases().
Referenced by findSubobject().
|
static |
Definition at line 17114 of file ExprConstant.cpp.
References clang::APValue, EvaluateInteger(), EvaluatePointer(), getAlignmentArgument(), clang::CallExpr::getArg(), clang::Expr::getType(), clang::APValue::hasValue(), clang::Type::isIntegralOrEnumerationType(), and clang::Type::isPointerType().
|
static |
Convenience function. LVal's base must be a call to an alloc_size function.
Definition at line 10146 of file ExprConstant.cpp.
Referenced by determineEndOffset().
|
static |
Definition at line 2102 of file ExprConstant.cpp.
References LValueBaseString::Bytes, LValueBaseString::CharWidth, clang::APValue::LValueBase::dyn_cast(), and LValueBaseString::ObjCEncodeStorage.
Referenced by ArePotentiallyOverlappingStringLiterals().
|
static |
Definition at line 2090 of file ExprConstant.cpp.
References clang::APValue::LValueBase::dyn_cast().
Referenced by IsWeakLValue(), and isZeroSized().
|
static |
Retrieves the "underlying object type" of the given expression, as used by __builtin_object_size.
Definition at line 16743 of file ExprConstant.cpp.
References clang::APValue::LValueBase::dyn_cast(), clang::APValue::LValueBase::getDynamicAllocType(), clang::Expr::getType(), clang::ValueDecl::getType(), clang::APValue::LValueBase::getTypeInfoType(), clang::APValue::LValueBase::is(), and clang::isa().
Referenced by clang::SemaObjC::checkInitMethod(), determineEndOffset(), clang::ObjCObjectPointerType::getInterfaceDecl(), clang::ObjCObjectPointerType::getNumProtocols(), clang::ObjCObjectPointerType::getProtocol(), clang::ObjCObjectPointerType::getTypeArgs(), clang::ObjCObjectPointerType::getTypeArgsAsWritten(), clang::ObjCObjectPointerType::isKindOfType(), clang::ObjCObjectPointerType::isObjCClassType(), clang::ObjCObjectPointerType::isObjCIdOrClassType(), clang::ObjCObjectPointerType::isObjCIdType(), clang::ObjCObjectPointerType::isObjCQualifiedClassType(), clang::ObjCObjectPointerType::isObjCQualifiedIdType(), clang::ObjCObjectPointerType::isSpecialized(), clang::ObjCObjectPointerType::isSpecializedAsWritten(), clang::ObjCObjectPointerType::isUnspecialized(), clang::ObjCObjectPointerType::qual_begin(), clang::ObjCObjectPointerType::qual_empty(), and clang::ObjCObjectPointerType::qual_end().
Definition at line 4291 of file ExprConstant.cpp.
References clang::QualType::addConst(), clang::QualType::addVolatile(), clang::QualType::isConstQualified(), and clang::QualType::isVolatileQualified().
Referenced by findSubobject().
|
static |
Definition at line 7918 of file ExprConstant.cpp.
References clang::T.
Referenced by clang::interp::Free().
Definition at line 21441 of file ExprConstant.cpp.
References GFNIMultiplicativeInverse(), int32_t, uint32_t, and uint8_t.
Referenced by clang::interp::interp__builtin_ia32_gfni_affine().
Definition at line 21470 of file ExprConstant.cpp.
References int32_t, uint16_t, and uint8_t.
Referenced by clang::interp::interp__builtin_ia32_gfni_mul().
|
static |
Perform an assignment of Val to LVal. Takes ownership of Val.
Definition at line 5119 of file ExprConstant.cpp.
References clang::AK_Assign, findCompleteObject(), and modifySubobject().
Referenced by HandleFunctionCall().
HandleBaseToDerivedCast - Apply the given base-to-derived cast operation on the provided lvalue, which currently refers to the base object.
Definition at line 5585 of file ExprConstant.cpp.
References CastToDerivedClass(), clang::CSK_Derived, clang::Type::getAs(), clang::Type::getAsCXXRecordDecl(), clang::CXXRecordDecl::getCanonicalDecl(), clang::Type::getPointeeType(), clang::Expr::getType(), and clang::CastExpr::path_size().
|
static |
Perform zero-initialization on an object of non-union class type. C++11 [dcl.init]p5: To zero-initialize an object or reference of type T means: [...] – if T is a (possibly cv-qualified) non-union class type, each non-static data member and each base-class subobject is zero-initialized.
Definition at line 11576 of file ExprConstant.cpp.
References clang::APValue, clang::CXXRecordDecl::bases(), EvaluateInPlace(), clang::RecordDecl::fields(), clang::Type::getAsCXXRecordDecl(), clang::RecordDecl::getNumFields(), clang::CXXRecordDecl::getNumVBases(), clang::APValue::LValueBase::getType(), HandleClassZeroInitialization(), HandleLValueDirectBase(), HandleLValueDirectVirtualBase(), HandleLValueMember(), clang::Decl::isInvalidDecl(), clang::TagDecl::isUnion(), and clang::CXXRecordDecl::vbases().
Referenced by HandleClassZeroInitialization().
|
static |
Definition at line 3144 of file ExprConstant.cpp.
References clang::APValue::Float, clang::APValue::getFloat(), clang::APValue::getInt(), clang::APValue::getKind(), handleCompareOpForVectorHelper(), and clang::APValue::Int.
Referenced by handleVectorVectorBinOp().
|
static |
Definition at line 3111 of file ExprConstant.cpp.
Referenced by handleCompareOpForVector().
| void HandleComplexComplexDiv | ( | APFloat | A, |
| APFloat | B, | ||
| APFloat | C, | ||
| APFloat | D, | ||
| APFloat & | ResR, | ||
| APFloat & | ResI ) |
Definition at line 21550 of file ExprConstant.cpp.
References abs(), clang::C, ilogb, and scalbn.
Referenced by clang::interp::Divc().
| void HandleComplexComplexMul | ( | APFloat | A, |
| APFloat | B, | ||
| APFloat | C, | ||
| APFloat | D, | ||
| APFloat & | ResR, | ||
| APFloat & | ResI ) |
Definition at line 21494 of file ExprConstant.cpp.
References clang::C.
Referenced by clang::interp::Mulc().
|
static |
Perform a compound assignment of LVal <op>= RVal.
Definition at line 5264 of file ExprConstant.cpp.
References clang::AK_Assign, findCompleteObject(), and findSubobject().
|
static |
Definition at line 7346 of file ExprConstant.cpp.
References clang::Call, clang::Definition, EvaluateArgs(), and HandleConstructorCall().
|
static |
Evaluate a constructor call.
Definition at line 7362 of file ExprConstant.cpp.
References clang::APValue, clang::C, clang::Call, clang::cast(), clang::declaresSameEntity(), clang::Definition, EvaluateDependentExpr(), EvaluateInitForDeclOfReferenceType(), EvaluateInPlace(), EvaluateStmt(), clang::RecordDecl::field_begin(), clang::RecordDecl::field_end(), clang::Expr::getExprLoc(), clang::FieldDecl::getFieldIndex(), clang::CXXRecordDecl::getNumBases(), clang::RecordDecl::getNumFields(), clang::CXXRecordDecl::getNumVBases(), clang::FieldDecl::getParent(), clang::Stmt::getSourceRange(), clang::ValueDecl::getType(), handleDefaultInitValue(), HandleLValueDirectBase(), HandleLValueDirectVirtualBase(), HandleLValueMember(), handleTrivialCopy(), clang::Value::hasValue(), clang::Init, clang::isa(), clang::FieldDecl::isBitField(), clang::Type::isFunctionReferenceType(), clang::Decl::isInvalidDecl(), isReadByLvalueToRvalueConversion(), clang::Type::isReferenceType(), clang::TagDecl::isUnion(), clang::Success, and truncateBitfieldValue().
Referenced by HandleConstructorCall(), and clang::Expr::isPotentialConstantExpr().
Definition at line 2680 of file ExprConstant.cpp.
References clang::APValue::AddrLabelDiff, clang::APValue::Array, clang::APValue::ComplexFloat, clang::APValue::ComplexInt, EvalPointerValueAsBool(), clang::APValue::FixedPoint, clang::APValue::Float, clang::APValue::getComplexFloatImag(), clang::APValue::getComplexFloatReal(), clang::APValue::getComplexIntImag(), clang::APValue::getComplexIntReal(), clang::APValue::getFixedPoint(), clang::APValue::getFloat(), clang::APValue::getInt(), clang::APValue::getKind(), clang::APValue::getMemberPointerDecl(), clang::APValue::Indeterminate, clang::APValue::Int, clang::ValueDecl::isWeak(), clang::APValue::LValue, clang::APValue::Matrix, clang::APValue::MemberPointer, clang::APValue::None, clang::APValue::Reflection, clang::APValue::Struct, clang::APValue::Union, and clang::APValue::Vector.
Referenced by clang::Expr::EvaluateAsBooleanCondition(), EvaluateAsBooleanCondition(), and handleScalarCast().
|
static |
Perform the adjustment from a value returned by a virtual function to a value of the statically expected type, which may be a pointer or reference to a base class of the returned type.
Definition at line 6854 of file ExprConstant.cpp.
References CastToBaseClass().
Get the value to use for a default-initialized object of type T.
Return false if it encounters something invalid.
Definition at line 5626 of file ExprConstant.cpp.
References clang::APValue, clang::APValue::LValueBase::getType(), handleDefaultInitValue(), clang::APValue::IndeterminateValue(), clang::Success, and clang::T.
Referenced by doEvaluateDestruction(), EvaluateVarDecl(), HandleConstructorCall(), and handleDefaultInitValue().
|
static |
Perform a destructor or pseudo-destructor call on the given object, which might in general not be a complete object.
Definition at line 7827 of file ExprConstant.cpp.
References clang::AK_Destroy, findCompleteObject(), and findSubobject().
Referenced by EvaluateDestruction().
|
static |
Destroy and end the lifetime of the given complete object.
Definition at line 7835 of file ExprConstant.cpp.
References HandleDestructionImpl(), and clang::T.
|
static |
Definition at line 7594 of file ExprConstant.cpp.
References clang::APValue, clang::CXXRecordDecl::bases(), CheckArraySize(), CheckConstexprFunction(), clang::Definition, EvaluateStmt(), expandArray(), clang::RecordDecl::fields(), clang::APValue::getAsString(), clang::SourceRange::getBegin(), clang::FunctionDecl::getBody(), clang::CXXRecordDecl::getDestructor(), clang::ArrayType::getElementType(), clang::CXXRecordDecl::getNumVBases(), clang::ConstantArrayType::getZExtSize(), HandleDestructionImpl(), HandleLValueArrayAdjustment(), HandleLValueDirectBase(), HandleLValueDirectVirtualBase(), HandleLValueMember(), ASTContext::hasLayout(), clang::CXXRecordDecl::hasTrivialDestructor(), clang::RecordDecl::isAnonymousStructOrUnion(), clang::FunctionDecl::isTrivial(), clang::TagDecl::isUnion(), clang::T, TryInstantiateFunctionBeforeCall(), clang::CXXRecordDecl::vbases(), and clang::VK_PRValue.
Referenced by HandleDestruction(), and HandleDestructionImpl().
|
static |
Apply the given dynamic cast operation on the provided lvalue.
This implements the hard case of dynamic_cast, requiring a "runtime check" to find a suitable target subobject.
Definition at line 6903 of file ExprConstant.cpp.
References clang::CXXBasePath::Access, clang::AK_DynamicCast, clang::AS_public, clang::C, CastToDerivedClass(), ComputeDynamicType(), clang::declaresSameEntity(), clang::CXXBasePaths::front(), getBaseClassType(), clang::Type::getPointeeCXXRecordDecl(), clang::Expr::getType(), clang::ExplicitCastExpr::getTypeAsWritten(), clang::QualType::getUnqualifiedType(), HandleLValueBase(), clang::CXXBasePaths::isAmbiguous(), isBaseClassPublic(), clang::Expr::isGLValue(), and clang::Type::isVoidPointerType().
|
static |
Definition at line 4062 of file ExprConstant.cpp.
References handleScalarCast().
|
static |
Perform the given binary floating-point operation, in-place, on LHS.
Definition at line 3029 of file ExprConstant.cpp.
References checkFloatingPointResultForConstantFolding(), and getActiveRoundingMode().
Referenced by handleVectorVectorBinOp().
|
static |
Definition at line 2822 of file ExprConstant.cpp.
References checkFloatingPointResultForConstantFolding(), getActiveRoundingMode(), and clang::isa().
Referenced by handleScalarCast(), and handleVectorElementCast().
|
static |
Definition at line 2745 of file ExprConstant.cpp.
References HandleOverflow(), clang::Type::isBooleanType(), and clang::Type::isSignedIntegerOrEnumerationType().
Referenced by handleScalarCast(), and handleVectorElementCast().
|
static |
Evaluate a function call.
Definition at line 7274 of file ExprConstant.cpp.
References clang::Call, EvaluateStmt(), clang::CXXRecordDecl::getCaptureFields(), clang::CXXMethodDecl::getFunctionObjectParameterReferenceType(), clang::FunctionDecl::getParamDecl(), clang::CXXMethodDecl::getParent(), clang::Stmt::getSourceRange(), handleAssignment(), handleTrivialCopy(), clang::CXXMethodDecl::isCopyAssignmentOperator(), clang::FunctionDecl::isDefaulted(), clang::CXXMethodDecl::isExplicitObjectMemberFunction(), clang::isLambdaCallOperator(), clang::CXXMethodDecl::isMoveAssignmentOperator(), isReadByLvalueToRvalueConversion(), clang::FunctionDecl::isTrivial(), and clang::TagDecl::isUnion().
Referenced by clang::Expr::isPotentialConstantExpr().
|
static |
Perform an increment or decrement on LVal.
Definition at line 5416 of file ExprConstant.cpp.
References clang::AK_Decrement, clang::AK_Increment, clang::cast(), findCompleteObject(), and findSubobject().
|
static |
Perform the given binary integer operation.
Definition at line 2910 of file ExprConstant.cpp.
References CheckedIntArithmetic(), clang::BinaryOperator::getRHS(), clang::Stmt::getSourceRange(), clang::Expr::getType(), and HandleOverflow().
Referenced by handleVectorVectorBinOp().
|
static |
Definition at line 2851 of file ExprConstant.cpp.
References checkFloatingPointResultForConstantFolding(), and getActiveRoundingMode().
Referenced by handleScalarCast(), and handleVectorElementCast().
|
static |
Definition at line 2838 of file ExprConstant.cpp.
References clang::Type::isBooleanType(), and clang::Type::isUnsignedIntegerOrEnumerationType().
Referenced by handleScalarCast(), and handleVectorElementCast().
|
static |
Get an lvalue to a field of a lambda's closure type.
Definition at line 9651 of file ExprConstant.cpp.
References clang::APValue::allowConstexprUnknown(), clang::FunctionDecl::getParamDecl(), clang::ValueDecl::getType(), HandleLValueMember(), handleLValueToRValueConversion(), clang::APValue::hasValue(), clang::CXXMethodDecl::isExplicitObjectMemberFunction(), clang::CXXMethodDecl::isStatic(), and clang::Self.
|
static |
Definition at line 3084 of file ExprConstant.cpp.
|
static |
Definition at line 3072 of file ExprConstant.cpp.
Referenced by handleLogicalOpForVector(), and handleVectorVectorBinOp().
|
static |
Definition at line 3097 of file ExprConstant.cpp.
References clang::APValue::Float, clang::APValue::getFloat(), clang::APValue::getInt(), clang::APValue::getKind(), handleLogicalOpForVector(), and clang::APValue::Int.
|
static |
Update a pointer value to model pointer arithmetic.
| Info | - Information about the ongoing evaluation. |
| E | - The expression being evaluated, for diagnostic purposes. |
| LVal | - The pointer value to be updated. |
| EltTy | - The pointee type represented by LVal. |
| Adjustment | - The adjustment, in objects of type EltTy, to add. |
Definition at line 3419 of file ExprConstant.cpp.
References clang::Expr::getExprLoc(), and HandleSizeof().
Referenced by EvaluateBuiltinStrLen(), EvaluateCharRangeAsStringImpl(), EvaluateStdcLoad8(), HandleDestructionImpl(), and HandleLValueArrayAdjustment().
|
static |
Definition at line 3430 of file ExprConstant.cpp.
References HandleLValueArrayAdjustment(), and int64_t.
|
static |
Definition at line 3287 of file ExprConstant.cpp.
References CastToDerivedClass(), clang::Type::getAsCXXRecordDecl(), clang::QualType::getNonReferenceType(), clang::ASTRecordLayout::getVBaseClassOffset(), HandleLValueDirectBase(), and clang::Decl::isInvalidDecl().
Referenced by CastToBaseClass(), HandleDynamicCast(), and HandleLValueBasePath().
|
static |
Definition at line 3316 of file ExprConstant.cpp.
References clang::Type::getAsCXXRecordDecl(), HandleLValueBase(), clang::CastExpr::path_begin(), and clang::CastExpr::path_end().
|
static |
Update an lvalue to refer to a component of a complex number.
| Info | - Information about the ongoing evaluation. |
| LVal | - The lvalue to be updated. |
| EltTy | - The complex number's component type. |
| Imag | - False for the real component, true for the imaginary. |
Definition at line 3442 of file ExprConstant.cpp.
References clang::Expr::getExprLoc(), and HandleSizeof().
|
static |
Definition at line 3257 of file ExprConstant.cpp.
References clang::Decl::isInvalidDecl().
Referenced by HandleClassZeroInitialization(), HandleConstructorCall(), HandleDestructionImpl(), HandleLValueBase(), and HandleMemberPointerAccess().
|
static |
Definition at line 3271 of file ExprConstant.cpp.
References clang::Decl::isInvalidDecl().
Referenced by HandleClassZeroInitialization(), HandleConstructorCall(), and HandleDestructionImpl().
|
static |
Update LVal to refer to the given indirect field.
Definition at line 3370 of file ExprConstant.cpp.
References clang::C, clang::cast(), clang::IndirectFieldDecl::chain(), and HandleLValueMember().
Referenced by HandleMemberPointerAccess().
|
static |
Update LVal to refer to the given field, which must be a member of the type currently described by LVal.
Definition at line 3346 of file ExprConstant.cpp.
References clang::FieldDecl::getFieldIndex(), clang::FieldDecl::getParent(), clang::TagDecl::isCompleteDefinition(), and clang::Decl::isInvalidDecl().
Referenced by HandleClassZeroInitialization(), HandleConstructorCall(), HandleDestructionImpl(), HandleLambdaCapture(), HandleLValueIndirectMember(), and HandleMemberPointerAccess().
|
static |
Perform an lvalue-to-rvalue conversion on the given glvalue.
This can also be used for 'lvalue-to-lvalue' conversions for looking up the glvalue referred to by an entity of reference type.
| Info | - Information about the ongoing evaluation. |
| Conv | - The expression for which we are performing the conversion. Used for diagnostics. |
| Type | - The type of the glvalue (before stripping cv-qualifiers in the case of a non-class type). |
| LVal | - The glvalue on which we are attempting to perform this action. |
| RVal | - The produced value will be placed here. |
| WantObjectRepresentation | - If true, we're looking for the object representation rather than the value, and in particular, there is no requirement that the result be fully initialized. |
Definition at line 5052 of file ExprConstant.cpp.
References clang::AK_Read, clang::AK_ReadObjectRepresentation, clang::APValue, clang::APValue::LValueBase::dyn_cast(), extractStringLiteralCharacter(), extractSubobject(), findCompleteObject(), and clang::isa().
Referenced by EvaluateAsRValue(), EvaluateBuiltinStrLen(), EvaluateCharRangeAsStringImpl(), EvaluateComparisonResult(), EvaluateStdcLoad8(), HandleLambdaCapture(), handleTrivialCopy(), and hlslElementwiseCastHelper().
|
static |
Definition at line 3455 of file ExprConstant.cpp.
References clang::Expr::getExprLoc(), and HandleSizeof().
|
static |
Definition at line 5565 of file ExprConstant.cpp.
References EvaluateMemberPointer(), EvaluateObjectArgument(), clang::BinaryOperator::getLHS(), clang::BinaryOperator::getOpcode(), clang::BinaryOperator::getRHS(), clang::Expr::getType(), and HandleMemberPointerAccess().
|
static |
HandleMemberPointerAccess - Evaluate a member access operation and build an lvalue referring to the result.
| Info | - Information about the ongoing evaluation. |
| LV | - An lvalue referring to the base of the member pointer. |
| RHS | - The member pointer expression. |
| IncludeMember | - Specifies whether the member itself is included in the resulting LValue subobject designator. This is not possible when creating a bound member function. |
Definition at line 5462 of file ExprConstant.cpp.
References CastToDerivedClass(), EvaluateMemberPointer(), clang::Type::getAs(), clang::Type::getAsCXXRecordDecl(), clang::CXXRecordDecl::getCanonicalDecl(), clang::Type::getPointeeType(), HandleLValueDirectBase(), HandleLValueIndirectMember(), and HandleLValueMember().
Referenced by HandleMemberPointerAccess().
Definition at line 7978 of file ExprConstant.cpp.
References CheckDeleteKind(), EvaluateIgnoredValue(), EvaluatePointer(), clang::CallExpr::getArg(), clang::Expr::getExprLoc(), clang::CallExpr::getNumArgs(), Pointer, and clang::StdAllocator.
Perform a call to 'operator new' or to ‘__builtin_operator_new’.
Definition at line 7849 of file ExprConstant.cpp.
References clang::APValue, clang::cast(), EvaluateIgnoredValue(), EvaluateInteger(), clang::CallExpr::getArg(), clang::CallExpr::getBeginLoc(), clang::Expr::getExprLoc(), clang::CallExpr::getNumArgs(), clang::CharUnits::getQuantity(), clang::Expr::getType(), HandleSizeof(), clang::Type::isFunctionType(), clang::Type::isIncompleteType(), clang::Type::isNothrowT(), and clang::Normal.
|
static |
Definition at line 2735 of file ExprConstant.cpp.
References clang::Type::getAs(), and clang::T.
Referenced by CheckedIntArithmetic(), HandleFloatToIntCast(), and handleIntIntBinOp().
|
static |
Definition at line 3884 of file ExprConstant.cpp.
References clang::APValue, clang::APValue::getFloat(), HandleConversionToBool(), HandleFloatToFloatCast(), HandleFloatToIntCast(), HandleIntToFloatCast(), HandleIntToIntCast(), clang::Type::isBooleanType(), clang::Type::isIntegerType(), and clang::Type::isRealFloatingType().
Referenced by constructAggregate(), and handleElementwiseCast().
|
static |
Get the size of the given type in char units.
Definition at line 3385 of file ExprConstant.cpp.
References clang::Type::isConstantSizeType(), clang::Type::isDependentType(), clang::Type::isFunctionType(), clang::Type::isVoidType(), clang::CharUnits::One(), and SizeOf.
Referenced by determineEndOffset(), HandleLValueArrayAdjustment(), HandleLValueComplexElement(), HandleLValueVectorElement(), and HandleOperatorNewCall().
|
static |
Perform a trivial copy from Param, which is the parameter of a copy or move constructor or assignment operator.
Definition at line 7225 of file ExprConstant.cpp.
References clang::QualType::getNonReferenceType(), clang::Expr::getType(), and handleLValueToRValueConversion().
Referenced by HandleConstructorCall(), and HandleFunctionCall().
|
static |
Definition at line 12542 of file ExprConstant.cpp.
References clang::APValue, HandleFloatToFloatCast(), HandleFloatToIntCast(), HandleIntToFloatCast(), HandleIntToIntCast(), clang::Type::isIntegerType(), and clang::Type::isRealFloatingType().
|
static |
Definition at line 15544 of file ExprConstant.cpp.
References clang::ShuffleVectorExpr::getShuffleMaskIdx(), clang::APValue::getVectorElt(), clang::APValue::getVectorLength(), and int64_t.
|
static |
Definition at line 12456 of file ExprConstant.cpp.
References clang::APValue::Float, clang::APValue::getFloat(), clang::APValue::getInt(), clang::ASTContext::getIntWidth(), clang::APValue::getKind(), clang::APValue::Int, and clang::Type::isUnsignedIntegerType().
|
static |
Definition at line 3157 of file ExprConstant.cpp.
References clang::APValue, clang::Type::castAs(), clang::APValue::Float, clang::APValue::getFloat(), clang::APValue::getInt(), clang::APValue::getKind(), clang::VectorType::getNumElements(), clang::Expr::getType(), clang::APValue::getVectorElt(), clang::APValue::getVectorLength(), handleCompareOpForVector(), handleFloatFloatBinOp(), handleIntIntBinOp(), handleLogicalOpForVector(), clang::BinaryOperator::isComparisonOp(), clang::Type::isFloatingType(), clang::Type::isIntegerType(), clang::BinaryOperator::isLogicalOp(), clang::APValue::isLValue(), clang::Type::isUnsignedIntegerType(), clang::APValue::isVector(), and clang::Success.
|
static |
Perform virtual dispatch.
Definition at line 6789 of file ExprConstant.cpp.
References clang::AK_Destroy, clang::AK_MemberCall, CastToDerivedClass(), ComputeDynamicType(), clang::Found, getBaseClassType(), clang::isa(), and Next.
|
static |
Definition at line 2202 of file ExprConstant.cpp.
Referenced by EvaluateComparisonBinaryOperator().
|
static |
Definition at line 22299 of file ExprConstant.cpp.
References clang::Expr::SE_AllowSideEffects, and clang::Expr::SE_AllowUndefinedBehavior.
Referenced by clang::Expr::EvaluateAsFixedPoint(), EvaluateAsFixedPoint(), clang::Expr::EvaluateAsFloat(), clang::Expr::EvaluateAsInt(), EvaluateAsInt(), and clang::Expr::isEvaluatable().
Definition at line 7911 of file ExprConstant.cpp.
References clang::T.
|
static |
Definition at line 4140 of file ExprConstant.cpp.
References clang::Type::castAs(), Evaluate(), clang::APValue::getMatrixElt(), clang::Expr::getType(), clang::APValue::getVectorElt(), clang::APValue::getVectorLength(), clang::Type::isConstantMatrixType(), clang::APValue::isFloat(), clang::APValue::isInt(), clang::APValue::isMatrix(), clang::APValue::isVector(), and clang::Type::isVectorType().
|
static |
Definition at line 5094 of file ExprConstant.cpp.
References elementwiseSize(), Evaluate(), flattenAPValue(), clang::Expr::getType(), handleLValueToRValueConversion(), and clang::APValue::isLValue().
A more selective version of E->IgnoreParenCasts for tryEvaluateBuiltinObjectSize. This ignores some casts/parens that serve only to change the type of E. Ex. For E = (short*)((char*)(&foo)), returns &foo
Always returns an RValue with a pointer representation.
Definition at line 16765 of file ExprConstant.cpp.
References clang::Expr::getType(), clang::Type::hasPointerRepresentation(), clang::Expr::IgnoreParens(), ignorePointerCastsAndParens(), and clang::Expr::isPRValue().
Referenced by ignorePointerCastsAndParens(), tryEvaluateBuiltinObjectSize(), and clang::interp::Compiler< Emitter >::VisitBuiltinCallExpr().
|
static |
Definition at line 1328 of file ExprConstant.cpp.
References isModification(), and isRead().
Referenced by findCompleteObject(), and isFormalAccess().
|
static |
Determine whether Base, which is known to be a direct base class of Derived, is a public base class.
Definition at line 6881 of file ExprConstant.cpp.
References clang::AS_public, clang::CXXRecordDecl::bases(), clang::declaresSameEntity(), and clang::CXXRecordDecl::vbases().
Referenced by HandleDynamicCast().
|
static |
Definition at line 10392 of file ExprConstant.cpp.
References clang::NamedDecl::getIdentifier(), clang::DeclContext::getParent(), clang::Decl::isInStdNamespace(), and clang::IdentifierInfo::isStr().
|
static |
Checks to see if the given LValue's Designator is at the end of the LValue's record layout. e.g. struct { struct { int a, b; } fst, snd; } obj; obj.fst // no obj.snd // yes obj.fst.a // no obj.fst.b // no obj.snd.a // no obj.snd.b // yes.
Please note: this function is specialized for how __builtin_object_size views "objects".
If this encounters an invalid RecordDecl or otherwise cannot determine the correct result, it will always return true.
Definition at line 16801 of file ExprConstant.cpp.
References clang::cast(), clang::Type::castAs(), clang::ASTContext::getAsArrayType(), clang::ASTContext::getASTRecordLayout(), clang::ArrayType::getElementType(), clang::ASTRecordLayout::getFieldCount(), clang::CXXMethodDecl::getParent(), getPointeeType(), clang::ValueDecl::getType(), getType(), clang::ConstantArrayType::getZExtSize(), clang::Decl::isInvalidDecl(), and clang::TagDecl::isUnion().
Referenced by isUserWritingOffTheEnd().
|
static |
Is this an access per the C++ definition?
Definition at line 1333 of file ExprConstant.cpp.
References clang::AK_Construct, clang::AK_Dereference, clang::AK_Destroy, clang::AK_IsWithinLifetime, and isAnyAccess().
Referenced by findCompleteObject(), and findSubobject().
|
static |
Definition at line 2012 of file ExprConstant.cpp.
References clang::APValue::LValueBase::dyn_cast(), clang::APValue::LValueBase::is(), and isGlobalLValue().
Referenced by CheckLValueConstantExpression(), and clang::Expr::EvalResult::isGlobalLValue().
Definition at line 2020 of file ExprConstant.cpp.
References clang::cast(), clang::Stmt::getStmtClass(), clang::isa(), clang::CompoundLiteralExpr::isFileScope(), clang::Expr::isLValue(), isOpaqueConstantCall(), and clang::SD_Static.
Referenced by IsGlobalLValue().
|
static |
Definition at line 1308 of file ExprConstant.cpp.
References clang::AK_Assign, clang::AK_Construct, clang::AK_Decrement, clang::AK_Dereference, clang::AK_Destroy, clang::AK_DynamicCast, clang::AK_Increment, clang::AK_IsWithinLifetime, clang::AK_MemberCall, clang::AK_Read, clang::AK_ReadObjectRepresentation, and clang::AK_TypeId.
Definition at line 10739 of file ExprConstant.cpp.
References clang::T.
Referenced by clang::interp::interp__builtin_memchr().
|
static |
Determine whether this is a pointer past the end of the complete object referred to by the lvalue.
Definition at line 19146 of file ExprConstant.cpp.
References getType(), clang::ASTContext::getTypeSizeInChars(), and clang::Type::isIncompleteType().
Referenced by EvaluateComparisonBinaryOperator().
|
static |
Definition at line 2006 of file ExprConstant.cpp.
References clang::APValue::LValueBase::dyn_cast(), and isOpaqueConstantCall().
Referenced by EvaluateComparisonBinaryOperator().
|
static |
Definition at line 1303 of file ExprConstant.cpp.
References clang::AK_Dereference, clang::AK_IsWithinLifetime, clang::AK_Read, and clang::AK_ReadObjectRepresentation.
Referenced by findSubobject(), and isAnyAccess().
| bool isReadByLvalueToRvalueConversion | ( | const CXXRecordDecl * | RD | ) |
Determine whether a type would actually be read by an lvalue-to-rvalue conversion.
If it's of class type, we may assume that the copy operation is trivial. Note that this is never true for a union type with fields (because the copy always "reads" the active member) and always true for a non-class type.
Definition at line 3781 of file ExprConstant.cpp.
References clang::CXXRecordDecl::bases(), clang::RecordDecl::field_empty(), clang::RecordDecl::fields(), clang::CXXRecordDecl::isEmpty(), isReadByLvalueToRvalueConversion(), and clang::TagDecl::isUnion().
Referenced by diagnoseMutableFields(), HandleConstructorCall(), HandleFunctionCall(), isReadByLvalueToRvalueConversion(), isReadByLvalueToRvalueConversion(), and isTrivialMemoryOperation().
Definition at line 3777 of file ExprConstant.cpp.
References isReadByLvalueToRvalueConversion(), and clang::T.
|
static |
Attempts to detect a user writing into a piece of memory that's impossible to figure out the size of by just using types.
Definition at line 16889 of file ExprConstant.cpp.
References clang::ASTContext::getLangOpts(), and isDesignatorAtObjectEnd().
|
static |
Is this kind of access valid on an indeterminate object value?
Definition at line 1339 of file ExprConstant.cpp.
References clang::AK_Assign, clang::AK_Construct, clang::AK_Decrement, clang::AK_Dereference, clang::AK_Destroy, clang::AK_DynamicCast, clang::AK_Increment, clang::AK_IsWithinLifetime, clang::AK_MemberCall, clang::AK_Read, clang::AK_ReadObjectRepresentation, and clang::AK_TypeId.
Referenced by findSubobject().
|
static |
Definition at line 2186 of file ExprConstant.cpp.
References GetLValueBaseDecl().
Referenced by EvaluateComparisonBinaryOperator().
|
static |
Definition at line 2191 of file ExprConstant.cpp.
References clang::Decl::getASTContext(), GetLValueBaseDecl(), clang::ASTContext::getTypeSize(), clang::Type::isArrayType(), and clang::Type::isIncompleteType().
Referenced by EvaluateComparisonBinaryOperator().
|
static |
Definition at line 3836 of file ExprConstant.cpp.
References getType(), and clang::T.
Referenced by findCompleteObject().
Definition at line 15817 of file ExprConstant.cpp.
References clang::InitListExpr::getNumInits(), clang::isa(), and MaybeElementDependentArrayFiller().
Referenced by MaybeElementDependentArrayFiller().
Definition at line 5796 of file ExprConstant.cpp.
References EvaluateDecompositionDeclInit().
Referenced by EvaluateCond(), and EvaluateSwitch().
|
static |
Handle a builtin simple-assignment or a call to a trivial assignment operator whose left-hand side might involve a union member access.
If it does, implicitly start the lifetime of any accessed union elements per C++20 [class.union]5.
Definition at line 7051 of file ExprConstant.cpp.
References clang::AK_Assign, clang::declaresSameEntity(), findCompleteObject(), findSubobject(), clang::UnaryOperator::getSubExpr(), and clang::Expr::getType().
|
static |
Update the designated sub-object of an rvalue to the given value.
Definition at line 4650 of file ExprConstant.cpp.
References findSubobject().
Referenced by handleAssignment().
|
static |
Negate an APSInt in place, converting it to a signed form if necessary, and preserving its value (by extending by up to one bit as needed).
Definition at line 1776 of file ExprConstant.cpp.
References Int.
|
static |
Definition at line 22943 of file ExprConstant.cpp.
Referenced by CheckEvalInICE(), CheckICE(), and ParseDirective().
Definition at line 21592 of file ExprConstant.cpp.
Referenced by clang::interp::InterpretBuiltin().
|
static |
Definition at line 2216 of file ExprConstant.cpp.
References clang::Expr::getExprLoc(), clang::ParmVarDecl::getFunctionScopeIndex(), and clang::Decl::getLocation().
Referenced by CheckDeleteKind(), CheckLValueConstantExpression(), evaluateVarDeclInit(), findCompleteObject(), and findSubobject().
|
static |
Tests to see if the LValue has a user-specified designator (that isn't necessarily valid). Note that this always returns 'true' if the LValue has an unsized array as its first designator entry, because there's currently no way to tell if the user typed *foo or foo[0].
Definition at line 16871 of file ExprConstant.cpp.
References clang::APValue::LValueBase::dyn_cast(), and clang::isa().
Referenced by determineEndOffset().
|
static |
Helper to implement named break/continue.
Returns 'true' if the evaluation result should be propagated up. Otherwise, it sets the evaluation result to either Continue to continue the current loop, or Succeeded to break it.
Definition at line 5860 of file ExprConstant.cpp.
References clang::isa().
Referenced by EvaluateStmt(), and EvaluateSwitch().
|
static |
Definition at line 2861 of file ExprConstant.cpp.
References clang::FieldDecl::getBitWidthValue(), Int, and clang::FieldDecl::isBitField().
Referenced by findSubobject(), and HandleConstructorCall().
|
static |
Definition at line 20843 of file ExprConstant.cpp.
References clang::StringLiteral::getString(), clang::Expr::IgnoreParenCasts(), and clang::StringLiteral::isOrdinary().
|
static |
Tries to evaluate the __builtin_object_size for E.
If IsDynamic is true (i.e. we're evaluating __builtin_dynamic_object_size) and the operand designates a flexible array member annotated with 'counted_by', we refuse to fold so that IR generation can emit the count-based runtime size computation.
Definition at line 17051 of file ExprConstant.cpp.
References determineEndOffset(), EvaluateAsRValue(), EvaluatePointer(), clang::findStructFieldAccess(), clang::Expr::getExprLoc(), clang::CharUnits::getQuantity(), clang::ValueDecl::getType(), ignorePointerCastsAndParens(), clang::Type::isCountAttributedType(), and clang::Expr::isGLValue().
Referenced by clang::Expr::tryEvaluateObjectSize().
|
static |
Definition at line 7258 of file ExprConstant.cpp.
References FunctionDefinitionCanBeLazilyInstantiated(), and clang::SemaProxy::instantiateFunctionDefinition().
Referenced by HandleDestructionImpl().
|
static |
Definition at line 22945 of file ExprConstant.cpp.
Referenced by CheckICE().