clang 22.0.0git
SemaExpr.cpp File Reference
#include "CheckExprLifetime.h"
#include "TreeTransform.h"
#include "UsedDeclVisitor.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTDiagnostic.h"
#include "clang/AST/ASTLambda.h"
#include "clang/AST/ASTMutationListener.h"
#include "clang/AST/Attrs.inc"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/DynamicRecursiveASTVisitor.h"
#include "clang/AST/EvaluatedExprVisitor.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprObjC.h"
#include "clang/AST/MangleNumberingContext.h"
#include "clang/AST/OperationKinds.h"
#include "clang/AST/Type.h"
#include "clang/AST/TypeLoc.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/DiagnosticSema.h"
#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/Specifiers.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/TypeTraits.h"
#include "clang/Lex/LiteralSupport.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Sema/AnalysisBasedWarnings.h"
#include "clang/Sema/DeclSpec.h"
#include "clang/Sema/DelayedDiagnostic.h"
#include "clang/Sema/Designator.h"
#include "clang/Sema/EnterExpressionEvaluationContext.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/Overload.h"
#include "clang/Sema/ParsedTemplate.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/ScopeInfo.h"
#include "clang/Sema/SemaARM.h"
#include "clang/Sema/SemaCUDA.h"
#include "clang/Sema/SemaFixItUtils.h"
#include "clang/Sema/SemaHLSL.h"
#include "clang/Sema/SemaObjC.h"
#include "clang/Sema/SemaOpenMP.h"
#include "clang/Sema/SemaPseudoObject.h"
#include "clang/Sema/Template.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/SaveAndRestore.h"
#include "llvm/Support/TimeProfiler.h"
#include "llvm/Support/TypeSize.h"
#include <limits>
#include <optional>
#include "clang/AST/DeclNodes.inc"
#include "clang/AST/TypeNodes.inc"
#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/AST/BuiltinTypes.def"

Go to the source code of this file.

Classes

struct  ImmediateCallVisitor
struct  EnsureImmediateInvocationInDefaultArgs

Macros

#define ABSTRACT_DECL(kind)
#define VALUE(type, base)
#define DECL(type, base)
#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_TYPE(Class, Base)
#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 PLACEHOLDER_TYPE(ID, SINGLETON_ID)
#define BUILTIN_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 BUILTIN_TYPE(Id, SingletonId)
#define PLACEHOLDER_TYPE(Id, SingletonId)

Typedefs

typedef ExprResult PerformCastFn(Sema &S, Expr *operand, QualType toType)

Enumerations

enum  NonConstCaptureKind { NCCK_None , NCCK_Block , NCCK_Lambda }
 Is the given expression (which must be 'const') a reference to a variable which was originally non-const, but which has become 'const' due to being captured within a block? More...
enum  {
  ConstFunction , ConstVariable , ConstMember , ConstMethod ,
  NestedConstMember , ConstUnknown
}
enum  OriginalExprKind { OEK_Variable , OEK_Member , OEK_LValue }

Functions

static void DiagnoseUnusedOfDecl (Sema &S, NamedDecl *D, SourceLocation Loc)
static bool hasAnyExplicitStorageClass (const FunctionDecl *D)
 Determine whether a FunctionDecl was ever declared with an explicit storage class.
static void diagnoseUseOfInternalDeclInInlineFunction (Sema &S, const NamedDecl *D, SourceLocation Loc)
 Check whether we're in an extern inline function and referring to a variable or function with internal linkage (C11 6.7.4p3).
static void CheckForNullPointerDereference (Sema &S, Expr *E)
static void DiagnoseDirectIsaAccess (Sema &S, const ObjCIvarRefExpr *OIRE, SourceLocation AssignLoc, const Expr *RHS)
static bool handleComplexIntegerToFloatConversion (Sema &S, ExprResult &IntExpr, ExprResult &ComplexExpr, QualType IntTy, QualType ComplexTy, bool SkipCast)
 Convert complex integers to complex floats and real integers to real floats as required for complex arithmetic.
static QualType handleComplexFloatConversion (Sema &S, ExprResult &Shorter, QualType ShorterType, QualType LongerType, bool PromotePrecision)
static QualType handleComplexConversion (Sema &S, ExprResult &LHS, ExprResult &RHS, QualType LHSType, QualType RHSType, bool IsCompAssign)
 Handle arithmetic conversion with complex types.
static QualType handleIntToFloatConversion (Sema &S, ExprResult &FloatExpr, ExprResult &IntExpr, QualType FloatTy, QualType IntTy, bool ConvertFloat, bool ConvertInt)
 Handle arithmetic conversion from integer to float.
static QualType handleFloatConversion (Sema &S, ExprResult &LHS, ExprResult &RHS, QualType LHSType, QualType RHSType, bool IsCompAssign)
 Handle arithmethic conversion with floating point types.
static bool unsupportedTypeConversion (const Sema &S, QualType LHSType, QualType RHSType)
 Diagnose attempts to convert between __float128, __ibm128 and long double if there is no support for such conversion.
template<PerformCastFn doLHSCast, PerformCastFn doRHSCast>
static QualType handleIntegerConversion (Sema &S, ExprResult &LHS, ExprResult &RHS, QualType LHSType, QualType RHSType, bool IsCompAssign)
 Handle integer arithmetic conversions.
static QualType handleComplexIntConversion (Sema &S, ExprResult &LHS, ExprResult &RHS, QualType LHSType, QualType RHSType, bool IsCompAssign)
 Handle conversions with GCC complex int extension.
static unsigned GetFixedPointRank (QualType Ty)
 Return the rank of a given fixed point or integer type.
static QualType handleFixedPointConversion (Sema &S, QualType LHSTy, QualType RHSTy)
 handleFixedPointConversion - Fixed point operations between fixed point types and integers or other fixed point types do not fall under usual arithmetic conversion since these conversions could result in loss of precsision (N1169 4.1.4).
static void CheckUnicodeArithmeticConversions (Sema &SemaRef, Expr *LHS, Expr *RHS, SourceLocation Loc, ArithConvKind ACK)
static PredefinedIdentKind getPredefinedExprKind (tok::TokenKind Kind)
static DeclgetPredefinedExprDecl (DeclContext *DC)
 getPredefinedExprDecl - Returns Decl of a given DeclContext that can be used to determine the value of a PredefinedExpr.
static SourceLocation getUDSuffixLoc (Sema &S, SourceLocation TokLoc, unsigned Offset)
 getUDSuffixLoc - Create a SourceLocation for a ud-suffix, given the location of the token and the offset of the ud-suffix within it.
static ExprResult BuildCookedLiteralOperatorCall (Sema &S, Scope *Scope, IdentifierInfo *UDSuffix, SourceLocation UDSuffixLoc, ArrayRef< Expr * > Args, SourceLocation LitEndLoc)
 BuildCookedLiteralOperatorCall - A user-defined literal was found.
static bool isCapturingReferenceToHostVarInCUDADeviceLambda (const Sema &S, VarDecl *VD)
static ExprrecoverFromMSUnqualifiedLookup (Sema &S, ASTContext &Context, DeclarationNameInfo &NameInfo, SourceLocation TemplateKWLoc, const TemplateArgumentListInfo *TemplateArgs)
 In Microsoft mode, if we are inside a template class whose parent class has dependent base classes, and we can't resolve an unqualified identifier, then assume the identifier is a member of a dependent base class.
static bool CheckDeclInExpr (Sema &S, SourceLocation Loc, NamedDecl *D, bool AcceptInvalid)
 Diagnoses obvious problems with the use of the given declaration as an expression.
static bool ShouldLookupResultBeMultiVersionOverload (const LookupResult &R)
static void ConvertUTF8ToWideString (unsigned CharByteWidth, StringRef Source, SmallString< 32 > &Target)
static ExprBuildFloatingLiteral (Sema &S, NumericLiteralParser &Literal, QualType Ty, SourceLocation Loc)
static bool CheckVecStepTraitOperandType (Sema &S, QualType T, SourceLocation Loc, SourceRange ArgRange)
static bool CheckVectorElementsTraitOperandType (Sema &S, QualType T, SourceLocation Loc, SourceRange ArgRange)
static bool checkPtrAuthTypeDiscriminatorOperandType (Sema &S, QualType T, SourceLocation Loc, SourceRange ArgRange)
static bool CheckExtensionTraitOperandType (Sema &S, QualType T, SourceLocation Loc, SourceRange ArgRange, UnaryExprOrTypeTrait TraitKind)
static bool CheckObjCTraitOperandConstraints (Sema &S, QualType T, SourceLocation Loc, SourceRange ArgRange, UnaryExprOrTypeTrait TraitKind)
static void warnOnSizeofOnArrayDecay (Sema &S, SourceLocation Loc, QualType T, const Expr *E)
 Check whether E is a pointer from a decayed array type (the decayed pointer type is equal to T) and emit a warning if it is.
static bool CheckAlignOfExpr (Sema &S, Expr *E, UnaryExprOrTypeTrait ExprKind)
static void captureVariablyModifiedType (ASTContext &Context, QualType T, CapturingScopeInfo *CSI)
static QualType CheckRealImagOperand (Sema &S, ExprResult &V, SourceLocation Loc, bool IsReal)
static bool checkArithmeticOnObjCPointer (Sema &S, SourceLocation opLoc, Expr *op)
 Diagnose if arithmetic on the given ObjC pointer is illegal.
static bool isMSPropertySubscriptExpr (Sema &S, Expr *Base)
static QualType getDependentArraySubscriptType (Expr *LHS, Expr *RHS, const ASTContext &Ctx)
static FieldDeclFindFieldDeclInstantiationPattern (const ASTContext &Ctx, FieldDecl *Field)
static TypoCorrection TryTypoCorrectionForCall (Sema &S, Expr *Fn, FunctionDecl *FDecl, ArrayRef< Expr * > Args)
static bool isParenthetizedAndQualifiedAddressOfExpr (Expr *Fn)
static void DiagnoseCalleeStaticArrayParam (Sema &S, ParmVarDecl *PVD)
static ExprResult rebuildUnknownAnyFunction (Sema &S, Expr *fn)
 Given a function expression of unknown-any type, try to rebuild it to have a function type.
static bool isPlaceholderToRemoveAsArg (QualType type)
 Is the given type a placeholder that we need to lower out immediately during argument processing?
static FunctionDeclrewriteBuiltinFunctionDecl (Sema *Sema, ASTContext &Context, FunctionDecl *FDecl, MultiExprArg ArgExprs)
 If a builtin function has a pointer argument with no explicit address space, then it should be able to accept a pointer to any address space as input.
static void checkDirectCallValidity (Sema &S, const Expr *Fn, FunctionDecl *Callee, MultiExprArg ArgExprs)
static bool enclosingClassIsRelatedToClassInWhichMembersWereFound (const UnresolvedMemberExpr *const UME, Sema &S)
static void tryImplicitlyCaptureThisIfImplicitMemberFunctionAccessWithDependentArgs (Sema &S, const UnresolvedMemberExpr *const UME, SourceLocation CallLoc)
static void DiagnosedUnqualifiedCallsToStdFunctions (Sema &S, const CallExpr *Call)
static bool MayBeFunctionType (const ASTContext &Context, const Expr *E)
static bool breakDownVectorType (QualType type, uint64_t &len, QualType &eltType)
static void CheckSufficientAllocSize (Sema &S, QualType DestType, const Expr *E)
 Check that a call to alloc_size function specifies sufficient space for the destination type.
static bool checkCondition (Sema &S, const Expr *Cond, SourceLocation QuestionLoc)
 Return false if the condition expression is valid, true otherwise.
static bool checkConditionalNullPointer (Sema &S, ExprResult &NullExpr, QualType PointerTy)
 Return false if the NullExpr can be promoted to PointerTy, true otherwise.
static QualType checkConditionalPointerCompatibility (Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc)
 Checks compatibility between two pointers and return the resulting type.
static QualType checkConditionalBlockPointerCompatibility (Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc)
 Return the resulting type when the operands are both block pointers.
static QualType checkConditionalObjectPointersCompatibility (Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc)
 Return the resulting type when the operands are both pointers.
static bool checkPointerIntegerMismatch (Sema &S, ExprResult &Int, Expr *PointerExpr, SourceLocation Loc, bool IsIntFirstExpr)
 Return false if the first expression is not an integer and the second expression is not a pointer, true otherwise.
static QualType OpenCLArithmeticConversions (Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
 Simple conversion between integer and floating point types.
static QualType OpenCLConvertScalarsToVectors (Sema &S, ExprResult &LHS, ExprResult &RHS, QualType CondTy, SourceLocation QuestionLoc)
 Convert scalar operands to a vector that matches the condition in length.
static bool checkOpenCLConditionVector (Sema &S, Expr *Cond, SourceLocation QuestionLoc)
 Return false if this is a valid OpenCL condition vector.
static bool checkVectorResult (Sema &S, QualType CondTy, QualType VecResTy, SourceLocation QuestionLoc)
 Return false if the vector condition type and the vector result type are compatible.
static QualType OpenCLCheckVectorConditional (Sema &S, ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
 Return the resulting type for the conditional operator in OpenCL (aka "ternary selection operator", OpenCL v1.1 s6.3.i) when the condition is a vector type.
static bool checkBlockType (Sema &S, const Expr *E)
 Return true if the Expr is block type.
static void SuggestParentheses (Sema &Self, SourceLocation Loc, const PartialDiagnostic &Note, SourceRange ParenRange)
 SuggestParentheses - Emit a note with a fixit hint that wraps ParenRange in parentheses.
static bool IsArithmeticOp (BinaryOperatorKind Opc)
static bool IsArithmeticBinaryExpr (const Expr *E, BinaryOperatorKind *Opcode, const Expr **RHSExprs)
 IsArithmeticBinaryExpr - Returns true if E is an arithmetic binary expression, either using a built-in or overloaded operator, and sets *OpCode to the opcode and *RHSExprs to the right-hand side expression.
static bool ExprLooksBoolean (const Expr *E)
 ExprLooksBoolean - Returns true if E looks boolean, i.e.
static void DiagnoseConditionalPrecedence (Sema &Self, SourceLocation OpLoc, Expr *Condition, const Expr *LHSExpr, const Expr *RHSExpr)
 DiagnoseConditionalPrecedence - Emit a warning when a conditional operator and binary operator are mixed in a way that suggests the programmer assumed the conditional operator has higher precedence, for example: "int x = a + someBinaryCondition ? 1 : 2".
static QualType computeConditionalNullability (QualType ResTy, bool IsBin, QualType LHSTy, QualType RHSTy, ASTContext &Ctx)
 Compute the nullability of a conditional expression.
static bool IsInvalidCmseNSCallConversion (Sema &S, QualType FromType, QualType ToType)
static AssignConvertType checkPointerTypesForAssignment (Sema &S, QualType LHSType, QualType RHSType, SourceLocation Loc)
static AssignConvertType checkBlockPointerTypesForAssignment (Sema &S, QualType LHSType, QualType RHSType)
 checkBlockPointerTypesForAssignment - This routine determines whether two block pointer types are compatible or whether a block and normal pointer are compatible.
static AssignConvertType checkObjCPointerTypesForAssignment (Sema &S, QualType LHSType, QualType RHSType)
 checkObjCPointerTypesForAssignment - Compares two objective-c pointer types for assignment compatibility.
static bool isVector (QualType QT, QualType ElementType)
 This helper function returns true if QT is a vector type that has element type ElementType.
static void ConstructTransparentUnion (Sema &S, ASTContext &C, ExprResult &EResult, QualType UnionType, FieldDecl *Field)
 Constructs a transparent union from an expression that is used to initialize the transparent union.
static bool tryVectorConvertAndSplat (Sema &S, ExprResult *scalar, QualType scalarTy, QualType vectorEltTy, QualType vectorTy, unsigned &DiagID)
 Try to convert a value of non-vector type to a vector type by converting the type to the element type of the vector and then performing a splat.
static ExprResult convertVector (Expr *E, QualType ElementType, Sema &S)
 Convert vector E to a vector with the same number of elements but different element type.
static bool canConvertIntToOtherIntTy (Sema &S, ExprResult *Int, QualType OtherIntTy)
 Test if a (constant) integer Int can be casted to another integer type IntTy without losing precision.
static bool canConvertIntTyToFloatTy (Sema &S, ExprResult *Int, QualType FloatTy)
 Test if a (constant) integer Int can be casted to floating point type FloatTy without losing precision.
static bool tryGCCVectorConvertAndSplat (Sema &S, ExprResult *Scalar, ExprResult *Vector)
 Attempt to convert and splat Scalar into a vector whose types matches Vector following GCC conversion rules.
static void checkArithmeticNull (Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompare)
static void DetectPrecisionLossInComplexDivision (Sema &S, QualType DivisorTy, SourceLocation OpLoc)
static void DiagnoseDivisionSizeofPointerOrArray (Sema &S, Expr *LHS, Expr *RHS, SourceLocation Loc)
static void DiagnoseBadDivideOrRemainderValues (Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsDiv)
static void diagnoseScopedEnums (Sema &S, const SourceLocation Loc, const ExprResult &LHS, const ExprResult &RHS, BinaryOperatorKind Opc)
static void diagnoseArithmeticOnTwoVoidPointers (Sema &S, SourceLocation Loc, Expr *LHSExpr, Expr *RHSExpr)
 Diagnose invalid arithmetic on two void pointers.
static void diagnoseArithmeticOnVoidPointer (Sema &S, SourceLocation Loc, Expr *Pointer)
 Diagnose invalid arithmetic on a void pointer.
static void diagnoseArithmeticOnNullPointer (Sema &S, SourceLocation Loc, Expr *Pointer, bool IsGNUIdiom)
 Diagnose invalid arithmetic on a null pointer.
static void diagnoseSubtractionOnNullPointer (Sema &S, SourceLocation Loc, Expr *Pointer, bool BothNull)
 Diagnose invalid subraction on a null pointer.
static void diagnoseArithmeticOnTwoFunctionPointers (Sema &S, SourceLocation Loc, Expr *LHS, Expr *RHS)
 Diagnose invalid arithmetic on two function pointers.
static void diagnoseArithmeticOnFunctionPointer (Sema &S, SourceLocation Loc, Expr *Pointer)
 Diagnose invalid arithmetic on a function pointer.
static bool checkArithmeticIncompletePointerType (Sema &S, SourceLocation Loc, Expr *Operand)
 Emit error if Operand is incomplete pointer type.
static bool checkArithmeticOpPointerOperand (Sema &S, SourceLocation Loc, Expr *Operand)
 Check the validity of an arithmetic pointer operand.
static bool checkArithmeticBinOpPointerOperands (Sema &S, SourceLocation Loc, Expr *LHSExpr, Expr *RHSExpr)
 Check the validity of a binary arithmetic operation w.r.t.
static void diagnoseStringPlusInt (Sema &Self, SourceLocation OpLoc, Expr *LHSExpr, Expr *RHSExpr)
 diagnoseStringPlusInt - Emit a warning when adding an integer to a string literal.
static void diagnoseStringPlusChar (Sema &Self, SourceLocation OpLoc, Expr *LHSExpr, Expr *RHSExpr)
 Emit a warning when adding a char literal to a string.
static void diagnosePointerIncompatibility (Sema &S, SourceLocation Loc, Expr *LHSExpr, Expr *RHSExpr)
 Emit error when two pointers are incompatible.
static bool isScopedEnumerationType (QualType T)
static void DiagnoseBadShiftValues (Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc, QualType LHSType)
static QualType checkVectorShift (Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign)
 Return the resulting type when a vector is shifted by a scalar or vector shift amount.
static QualType checkSizelessVectorShift (Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign)
static void diagnoseDistinctPointerComparison (Sema &S, SourceLocation Loc, ExprResult &LHS, ExprResult &RHS, bool IsError)
 Diagnose bad pointer comparisons.
static bool convertPointersToCompositeType (Sema &S, SourceLocation Loc, ExprResult &LHS, ExprResult &RHS)
 Returns false if the pointers are converted to a composite type, true otherwise.
static void diagnoseFunctionPointerToVoidComparison (Sema &S, SourceLocation Loc, ExprResult &LHS, ExprResult &RHS, bool IsError)
static bool isObjCObjectLiteral (ExprResult &E)
static bool hasIsEqualMethod (Sema &S, const Expr *LHS, const Expr *RHS)
static void diagnoseObjCLiteralComparison (Sema &S, SourceLocation Loc, ExprResult &LHS, ExprResult &RHS, BinaryOperator::Opcode Opc)
static void diagnoseLogicalNotOnLHSofCheck (Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
 Warns on !x < y, !x & y where !(x < y), !(x & y) was probably intended.
static bool checkForArray (const Expr *E)
static std::optional< boolisTautologicalBoundsCheck (Sema &S, const Expr *LHS, const Expr *RHS, BinaryOperatorKind Opc)
 Detect patterns ptr + size >= ptr and ptr + size < ptr, where ptr is a pointer and size is an unsigned integer.
static void diagnoseTautologicalComparison (Sema &S, SourceLocation Loc, Expr *LHS, Expr *RHS, BinaryOperatorKind Opc)
 Diagnose some forms of syntactically-obvious tautological comparison.
static ImplicitConversionKind castKindToImplicitConversionKind (CastKind CK)
static bool checkThreeWayNarrowingConversion (Sema &S, QualType ToType, Expr *E, QualType FromType, SourceLocation Loc)
static QualType checkArithmeticOrEnumeralThreeWayCompare (Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc)
static QualType checkArithmeticOrEnumeralCompare (Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
static void diagnoseXorMisusedAsPow (Sema &S, const ExprResult &XorLHS, const ExprResult &XorRHS, const SourceLocation Loc)
static bool isLegalBoolVectorBinaryOp (BinaryOperatorKind Opc)
static bool IsReadonlyMessage (Expr *E, Sema &S)
static NonConstCaptureKind isReferenceToNonConstCapture (Sema &S, Expr *E)
static bool IsTypeModifiable (QualType Ty, bool IsDereference)
static void DiagnoseConstAssignment (Sema &S, const Expr *E, SourceLocation Loc)
 Emit the "read-only variable not assignable" error and print notes to give more information about why the variable is not assignable, such as pointing to the declaration of a const variable, showing that a method is const, or that the function is returning a const reference.
static void DiagnoseRecursiveConstFields (Sema &S, const ValueDecl *VD, const RecordType *Ty, SourceLocation Loc, SourceRange Range, OriginalExprKind OEK, bool &DiagnosticEmitted)
static void DiagnoseRecursiveConstFields (Sema &S, const Expr *E, SourceLocation Loc)
 Emit an error for the case where a record we are trying to assign to has a const-qualified field somewhere in its hierarchy.
static bool CheckForModifiableLvalue (Expr *E, SourceLocation Loc, Sema &S)
 CheckForModifiableLvalue - Verify that E is a modifiable lvalue.
static void CheckIdentityFieldAssignment (Expr *LHSExpr, Expr *RHSExpr, SourceLocation Loc, Sema &Sema)
static bool IgnoreCommaOperand (const Expr *E, const ASTContext &Context)
static QualType CheckCommaOperands (Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc)
static QualType CheckIncrementDecrementOperand (Sema &S, Expr *Op, ExprValueKind &VK, ExprObjectKind &OK, SourceLocation OpLoc, bool IsInc, bool IsPrefix)
 CheckIncrementDecrementOperand - unlike most "Check" methods, this routine doesn't need to call UsualUnaryConversions or UsualArithmeticConversions.
static ValueDeclgetPrimaryDecl (Expr *E)
 getPrimaryDecl - Helper function for CheckAddressOfOperand().
static void diagnoseAddressOfInvalidType (Sema &S, SourceLocation Loc, Expr *E, unsigned Type)
 Diagnose invalid operand for address of operations.
static void RecordModifiableNonNullParam (Sema &S, const Expr *Exp)
static QualType CheckIndirectionOperand (Sema &S, Expr *Op, ExprValueKind &VK, SourceLocation OpLoc, bool IsAfterAmp=false)
 CheckIndirectionOperand - Type check unary indirection (prefix '*').
static UnaryOperatorKind ConvertTokenKindToUnaryOpcode (tok::TokenKind Kind)
static void DiagnoseSelfAssignment (Sema &S, Expr *LHSExpr, Expr *RHSExpr, SourceLocation OpLoc, bool IsBuiltin)
 DiagnoseSelfAssignment - Emits a warning if a value is assigned to itself.
static void checkObjCPointerIntrospection (Sema &S, ExprResult &L, ExprResult &R, SourceLocation OpLoc)
 Check if a bitwise-& is performed on an Objective-C pointer.
static ExprResult convertHalfVecBinOp (Sema &S, ExprResult LHS, ExprResult RHS, BinaryOperatorKind Opc, QualType ResultTy, ExprValueKind VK, ExprObjectKind OK, bool IsCompAssign, SourceLocation OpLoc, FPOptionsOverride FPFeatures)
static bool needsConversionOfHalfVec (bool OpRequiresConversion, ASTContext &Ctx, Expr *E0, Expr *E1=nullptr)
 Returns true if conversion between vectors of halfs and vectors of floats is needed.
static void DiagnoseBitwisePrecedence (Sema &Self, BinaryOperatorKind Opc, SourceLocation OpLoc, Expr *LHSExpr, Expr *RHSExpr)
 DiagnoseBitwisePrecedence - Emit a warning when bitwise and comparison operators are mixed in a way that suggests that the programmer forgot that comparison operators have higher precedence.
static void EmitDiagnosticForLogicalAndInLogicalOr (Sema &Self, SourceLocation OpLoc, BinaryOperator *Bop)
 It accepts a '&&' expr that is inside a '||' one.
static void DiagnoseLogicalAndInLogicalOrLHS (Sema &S, SourceLocation OpLoc, Expr *LHSExpr, Expr *RHSExpr)
 Look for '&&' in the left hand of a '||' expr.
static void DiagnoseLogicalAndInLogicalOrRHS (Sema &S, SourceLocation OpLoc, Expr *LHSExpr, Expr *RHSExpr)
 Look for '&&' in the right hand of a '||' expr.
static void DiagnoseBitwiseOpInBitwiseOp (Sema &S, BinaryOperatorKind Opc, SourceLocation OpLoc, Expr *SubExpr)
 Look for bitwise op in the left or right hand of a bitwise op with lower precedence and emit a diagnostic together with a fixit hint that wraps the '&' expression in parentheses.
static void DiagnoseAdditionInShift (Sema &S, SourceLocation OpLoc, Expr *SubExpr, StringRef Shift)
static void DiagnoseShiftCompare (Sema &S, SourceLocation OpLoc, Expr *LHSExpr, Expr *RHSExpr)
static void DiagnoseBinOpPrecedence (Sema &Self, BinaryOperatorKind Opc, SourceLocation OpLoc, Expr *LHSExpr, Expr *RHSExpr)
 DiagnoseBinOpPrecedence - Emit warnings for expressions with tricky precedence.
static ExprResult BuildOverloadedBinOp (Sema &S, Scope *Sc, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHS, Expr *RHS)
 Build an overloaded binary operator expression in the given scope.
static bool isOverflowingIntegerType (ASTContext &Ctx, QualType T)
static CXXRecordDeclLookupStdSourceLocationImpl (Sema &S, SourceLocation Loc)
static bool maybeDiagnoseAssignmentToFunction (Sema &S, QualType DstType, const Expr *SrcExpr)
static void EvaluateAndDiagnoseImmediateInvocation (Sema &SemaRef, Sema::ImmediateInvocationCandidate Candidate)
static void RemoveNestedImmediateInvocation (Sema &SemaRef, Sema::ExpressionEvaluationContextRecord &Rec, SmallVector< Sema::ImmediateInvocationCandidate, 4 >::reverse_iterator It)
static void HandleImmediateInvocations (Sema &SemaRef, Sema::ExpressionEvaluationContextRecord &Rec)
static bool isPotentiallyConstantEvaluatedContext (Sema &SemaRef)
 Are we in a context that is potentially constant evaluated per C++20 [expr.const]p12?
static bool funcHasParameterSizeMangling (Sema &S, FunctionDecl *FD)
 Return true if this function has a calling convention that requires mangling in the size of the parameter pack.
static void CheckCompleteParameterTypesForMangler (Sema &S, FunctionDecl *FD, SourceLocation Loc)
 Require that all of the parameter types of function be complete.
static OdrUseContext isOdrUseContext (Sema &SemaRef)
 Are we within a context in which references to resolved functions or to variables result in odr-use?
static bool isImplicitlyDefinableConstexprFunction (FunctionDecl *Func)
static void MarkVarDeclODRUsed (ValueDecl *V, SourceLocation Loc, Sema &SemaRef, const unsigned *const FunctionScopeIndexToStopAt=nullptr)
 Directly mark a variable odr-used.
static void diagnoseUncapturableValueReferenceOrBinding (Sema &S, SourceLocation loc, ValueDecl *var)
static bool isVariableAlreadyCapturedInScopeInfo (CapturingScopeInfo *CSI, ValueDecl *Var, bool &SubCapturesAreNested, QualType &CaptureType, QualType &DeclRefType)
static DeclContextgetParentOfCapturingContextOrNull (DeclContext *DC, ValueDecl *Var, SourceLocation Loc, const bool Diagnose, Sema &S)
static bool isVariableCapturable (CapturingScopeInfo *CSI, ValueDecl *Var, SourceLocation Loc, const bool Diagnose, Sema &S)
static bool captureInBlock (BlockScopeInfo *BSI, ValueDecl *Var, SourceLocation Loc, const bool BuildAndDiagnose, QualType &CaptureType, QualType &DeclRefType, const bool Nested, Sema &S, bool Invalid)
static bool captureInCapturedRegion (CapturedRegionScopeInfo *RSI, ValueDecl *Var, SourceLocation Loc, const bool BuildAndDiagnose, QualType &CaptureType, QualType &DeclRefType, const bool RefersToCapturedVariable, TryCaptureKind Kind, bool IsTopScope, Sema &S, bool Invalid)
 Capture the given variable in the captured region.
static bool captureInLambda (LambdaScopeInfo *LSI, ValueDecl *Var, SourceLocation Loc, const bool BuildAndDiagnose, QualType &CaptureType, QualType &DeclRefType, const bool RefersToCapturedVariable, const TryCaptureKind Kind, SourceLocation EllipsisLoc, const bool IsTopScope, Sema &S, bool Invalid)
 Capture the given variable in the lambda.
static bool canCaptureVariableByCopy (ValueDecl *Var, const ASTContext &Context)
static void buildLambdaCaptureFixit (Sema &Sema, LambdaScopeInfo *LSI, ValueDecl *Var)
 Create up to 4 fix-its for explicit reference and value capture of Var or default capture.
static ExprResult rebuildPotentialResultsAsNonOdrUsed (Sema &S, Expr *E, NonOdrUseReason NOUR)
 Walk the set of potential results of an expression and mark them all as non-odr-uses if they satisfy the side-conditions of the NonOdrUseReason.
static void DoMarkPotentialCapture (Sema &SemaRef, SourceLocation Loc, ValueDecl *Var, Expr *E)
static void DoMarkVarDeclReferenced (Sema &SemaRef, SourceLocation Loc, VarDecl *Var, Expr *E, llvm::DenseMap< const VarDecl *, int > &RefsMinusAssignments)
static void DoMarkBindingDeclReferenced (Sema &SemaRef, SourceLocation Loc, BindingDecl *BD, Expr *E)
static void FixDependencyOfIdExpressionsInLambdaWithDependentObjectParameter (Sema &SemaRef, ValueDecl *D, Expr *E)
static void MarkExprReferenced (Sema &SemaRef, SourceLocation Loc, Decl *D, Expr *E, bool MightBeOdrUse, llvm::DenseMap< const VarDecl *, int > &RefsMinusAssignments)
static ExprResult diagnoseUnknownAnyExpr (Sema &S, Expr *E)

Macro Definition Documentation

◆ ABSTRACT_DECL

#define ABSTRACT_DECL ( kind)

◆ ABSTRACT_TYPE

#define ABSTRACT_TYPE ( Class,
Base )

◆ AMDGPU_TYPE [1/2]

#define AMDGPU_TYPE ( Name,
Id,
SingletonId,
Width,
Align )
Value:
case BuiltinType::Id:

◆ AMDGPU_TYPE [2/2]

#define AMDGPU_TYPE ( Name,
Id,
SingletonId,
Width,
Align )
Value:
case BuiltinType::Id:

◆ BUILTIN_TYPE [1/2]

#define BUILTIN_TYPE ( ID,
SINGLETON_ID )
Value:
case BuiltinType::ID:

◆ BUILTIN_TYPE [2/2]

#define BUILTIN_TYPE ( Id,
SingletonId )
Value:
case BuiltinType::Id:

◆ DECL

#define DECL ( type,
base )
Value:
case Decl::type:

◆ DEPENDENT_TYPE

#define DEPENDENT_TYPE ( Class,
Base )
Value:
case Type::Class:

◆ EXT_OPAQUE_TYPE [1/2]

#define EXT_OPAQUE_TYPE ( ExtType,
Id,
Ext )
Value:
case BuiltinType::Id:

◆ EXT_OPAQUE_TYPE [2/2]

#define EXT_OPAQUE_TYPE ( ExtType,
Id,
Ext )
Value:
case BuiltinType::Id:

◆ HLSL_INTANGIBLE_TYPE [1/2]

#define HLSL_INTANGIBLE_TYPE ( Name,
Id,
SingletonId )
Value:
case BuiltinType::Id:

◆ HLSL_INTANGIBLE_TYPE [2/2]

#define HLSL_INTANGIBLE_TYPE ( Name,
Id,
SingletonId )
Value:
case BuiltinType::Id:

◆ IMAGE_TYPE [1/2]

#define IMAGE_TYPE ( ImgType,
Id,
SingletonId,
Access,
Suffix )
Value:
case BuiltinType::Id:

◆ IMAGE_TYPE [2/2]

#define IMAGE_TYPE ( ImgType,
Id,
SingletonId,
Access,
Suffix )
Value:
case BuiltinType::Id:

◆ NON_CANONICAL_TYPE

#define NON_CANONICAL_TYPE ( Class,
Base )

◆ NON_CANONICAL_UNLESS_DEPENDENT_TYPE

#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE ( Class,
Base )

◆ PLACEHOLDER_TYPE [1/2]

#define PLACEHOLDER_TYPE ( ID,
SINGLETON_ID )

◆ PLACEHOLDER_TYPE [2/2]

#define PLACEHOLDER_TYPE ( Id,
SingletonId )

◆ PPC_VECTOR_TYPE [1/2]

#define PPC_VECTOR_TYPE ( Name,
Id,
Size )
Value:
case BuiltinType::Id:

◆ PPC_VECTOR_TYPE [2/2]

#define PPC_VECTOR_TYPE ( Name,
Id,
Size )
Value:
case BuiltinType::Id:

◆ RVV_TYPE [1/2]

#define RVV_TYPE ( Name,
Id,
SingletonId )
Value:
case BuiltinType::Id:

◆ RVV_TYPE [2/2]

#define RVV_TYPE ( Name,
Id,
SingletonId )
Value:
case BuiltinType::Id:

◆ SVE_TYPE [1/2]

#define SVE_TYPE ( Name,
Id,
SingletonId )
Value:
case BuiltinType::Id:

◆ SVE_TYPE [2/2]

#define SVE_TYPE ( Name,
Id,
SingletonId )
Value:
case BuiltinType::Id:

◆ TYPE

#define TYPE ( Class,
Base )

◆ VALUE

#define VALUE ( type,
base )

◆ WASM_TYPE [1/2]

#define WASM_TYPE ( Name,
Id,
SingletonId )
Value:
case BuiltinType::Id:

◆ WASM_TYPE [2/2]

#define WASM_TYPE ( Name,
Id,
SingletonId )
Value:
case BuiltinType::Id:

Typedef Documentation

◆ PerformCastFn

typedef ExprResult PerformCastFn(Sema &S, Expr *operand, QualType toType)

Definition at line 1302 of file SemaExpr.cpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
ConstFunction 
ConstVariable 
ConstMember 
ConstMethod 
NestedConstMember 
ConstUnknown 

Definition at line 13678 of file SemaExpr.cpp.

◆ NonConstCaptureKind

Is the given expression (which must be 'const') a reference to a variable which was originally non-const, but which has become 'const' due to being captured within a block?

Enumerator
NCCK_None 
NCCK_Block 
NCCK_Lambda 

Definition at line 13617 of file SemaExpr.cpp.

◆ OriginalExprKind

Enumerator
OEK_Variable 
OEK_Member 
OEK_LValue 

Definition at line 13810 of file SemaExpr.cpp.

Function Documentation

◆ breakDownVectorType()

bool breakDownVectorType ( QualType type,
uint64_t & len,
QualType & eltType )
static

◆ BuildCookedLiteralOperatorCall()

ExprResult BuildCookedLiteralOperatorCall ( Sema & S,
Scope * Scope,
IdentifierInfo * UDSuffix,
SourceLocation UDSuffixLoc,
ArrayRef< Expr * > Args,
SourceLocation LitEndLoc )
static

◆ BuildFloatingLiteral()

◆ buildLambdaCaptureFixit()

◆ BuildOverloadedBinOp()

ExprResult BuildOverloadedBinOp ( Sema & S,
Scope * Sc,
SourceLocation OpLoc,
BinaryOperatorKind Opc,
Expr * LHS,
Expr * RHS )
static

Build an overloaded binary operator expression in the given scope.

Definition at line 15592 of file SemaExpr.cpp.

References CheckIdentityFieldAssignment(), clang::Sema::CreateOverloadedBinOp(), DiagnoseSelfAssignment(), and clang::Sema::LookupBinOp().

Referenced by clang::Sema::BuildBinOp().

◆ canCaptureVariableByCopy()

bool canCaptureVariableByCopy ( ValueDecl * Var,
const ASTContext & Context )
static

◆ canConvertIntToOtherIntTy()

bool canConvertIntToOtherIntTy ( Sema & S,
ExprResult * Int,
QualType OtherIntTy )
static

Test if a (constant) integer Int can be casted to another integer type IntTy without losing precision.

Definition at line 10150 of file SemaExpr.cpp.

References clang::Sema::Context, clang::APValue::getInt(), clang::ASTContext::getIntegerTypeOrder(), clang::ASTContext::getIntWidth(), clang::Type::hasSignedIntegerRepresentation(), and clang::Expr::EvalResult::Val.

Referenced by tryGCCVectorConvertAndSplat().

◆ canConvertIntTyToFloatTy()

bool canConvertIntTyToFloatTy ( Sema & S,
ExprResult * Int,
QualType FloatTy )
static

◆ captureInBlock()

◆ captureInCapturedRegion()

◆ captureInLambda()

◆ captureVariablyModifiedType()

◆ castKindToImplicitConversionKind()

◆ CheckAlignOfExpr()

◆ checkArithmeticBinOpPointerOperands()

bool checkArithmeticBinOpPointerOperands ( Sema & S,
SourceLocation Loc,
Expr * LHSExpr,
Expr * RHSExpr )
static

Check the validity of a binary arithmetic operation w.r.t.

pointer operands.

This routine will diagnose any invalid arithmetic on pointer operands much like

See also
checkArithmeticOpPointerOperand. However, it has special logic for emitting a single diagnostic even for operations where both LHS and RHS are (potentially problematic) pointers.
Returns
True when the operand is valid to use (even if as an extension).

Definition at line 11097 of file SemaExpr.cpp.

References checkArithmeticIncompletePointerType(), clang::SemaBase::Diag(), diagnoseArithmeticOnFunctionPointer(), diagnoseArithmeticOnTwoFunctionPointers(), diagnoseArithmeticOnTwoVoidPointers(), diagnoseArithmeticOnVoidPointer(), clang::Sema::getASTContext(), clang::Sema::getLangOpts(), clang::Type::getPointeeType(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::QualType::isAddressSpaceOverlapping(), clang::Type::isAnyPointerType(), clang::Type::isFunctionType(), and clang::Type::isVoidType().

Referenced by clang::Sema::CheckSubtractionOperands().

◆ checkArithmeticIncompletePointerType()

bool checkArithmeticIncompletePointerType ( Sema & S,
SourceLocation Loc,
Expr * Operand )
static

Emit error if Operand is incomplete pointer type.

Returns
True if pointer has incomplete type

Definition at line 11043 of file SemaExpr.cpp.

References clang::Type::getAs(), clang::Type::getPointeeType(), clang::Type::isAnyPointerType(), and clang::Sema::RequireCompleteSizedType().

Referenced by checkArithmeticBinOpPointerOperands(), checkArithmeticOpPointerOperand(), and CheckIncrementDecrementOperand().

◆ checkArithmeticNull()

◆ checkArithmeticOnObjCPointer()

◆ checkArithmeticOpPointerOperand()

bool checkArithmeticOpPointerOperand ( Sema & S,
SourceLocation Loc,
Expr * Operand )
static

Check the validity of an arithmetic pointer operand.

If the operand has pointer type, this code will check for pointer types which are invalid in arithmetic operations. These will be diagnosed appropriately, including whether or not the use is supported as an extension.

Returns
True when the operand is valid to use (even if as an extension).

Definition at line 11065 of file SemaExpr.cpp.

References checkArithmeticIncompletePointerType(), diagnoseArithmeticOnFunctionPointer(), diagnoseArithmeticOnVoidPointer(), clang::Type::getAs(), clang::Sema::getLangOpts(), clang::Type::getPointeeType(), clang::Type::isAnyPointerType(), clang::Type::isFunctionType(), and clang::Type::isVoidType().

Referenced by clang::Sema::CheckAdditionOperands(), CheckIncrementDecrementOperand(), and clang::Sema::CheckSubtractionOperands().

◆ checkArithmeticOrEnumeralCompare()

◆ checkArithmeticOrEnumeralThreeWayCompare()

◆ checkBlockPointerTypesForAssignment()

AssignConvertType checkBlockPointerTypesForAssignment ( Sema & S,
QualType LHSType,
QualType RHSType )
static

checkBlockPointerTypesForAssignment - This routine determines whether two block pointer types are compatible or whether a block and normal pointer are compatible.

It is more restrict than comparing two function pointer

Definition at line 9209 of file SemaExpr.cpp.

References clang::cast(), clang::Compatible, clang::CompatiblePointerDiscardsQualifiers, clang::Sema::Context, clang::Sema::getLangOpts(), clang::QualType::getLocalQualifiers(), clang::ASTContext::getQualifiedType(), clang::QualType::getUnqualifiedType(), clang::IncompatibleBlockPointer, clang::QualType::isCanonical(), clang::Qualifiers::removeAddressSpace(), and clang::ASTContext::typesAreBlockPointerCompatible().

Referenced by clang::Sema::CheckAssignmentConstraints().

◆ checkBlockType()

bool checkBlockType ( Sema & S,
const Expr * E )
static

◆ CheckCommaOperands()

◆ CheckCompleteParameterTypesForMangler()

void CheckCompleteParameterTypesForMangler ( Sema & S,
FunctionDecl * FD,
SourceLocation Loc )
static

Require that all of the parameter types of function be complete.

Normally, parameter types are only required to be complete when a function is called or defined, but to mangle functions with certain calling conventions, the mangler needs to know the size of the parameter list. In this situation, MSVC doesn't emit an error or instantiate templates. Instead, MSVC mangles the function as _foo@0, i.e. zero bytes of parameters, which will usually result in a linker error. Clang doesn't implement this behavior, and instead attempts to error at compile time.

Definition at line 18337 of file SemaExpr.cpp.

References clang::Type::castAs(), clang::CC_X86FastCall, clang::CC_X86StdCall, clang::CC_X86VectorCall, clang::SemaBase::Diag(), clang::NamedDecl::getDeclName(), clang::ValueDecl::getType(), clang::FunctionDecl::parameters(), clang::Sema::RequireCompleteType(), and clang::T.

Referenced by clang::Sema::MarkFunctionReferenced().

◆ checkCondition()

bool checkCondition ( Sema & S,
const Expr * Cond,
SourceLocation QuestionLoc )
static

Return false if the condition expression is valid, true otherwise.

Definition at line 8092 of file SemaExpr.cpp.

References clang::Cond, clang::SemaBase::Diag(), clang::Sema::getLangOpts(), clang::Type::isFloatingType(), and clang::Type::isScalarType().

Referenced by clang::Sema::CheckConditionalOperands().

◆ checkConditionalBlockPointerCompatibility()

◆ checkConditionalNullPointer()

bool checkConditionalNullPointer ( Sema & S,
ExprResult & NullExpr,
QualType PointerTy )
static

◆ checkConditionalObjectPointersCompatibility()

◆ checkConditionalPointerCompatibility()

◆ CheckDeclInExpr()

bool CheckDeclInExpr ( Sema & S,
SourceLocation Loc,
NamedDecl * D,
bool AcceptInvalid )
static

Diagnoses obvious problems with the use of the given declaration as an expression.

This is only actually called for lookups that were not overloaded, and it doesn't promise that the declaration will in fact be used.

Definition at line 3198 of file SemaExpr.cpp.

References clang::SemaBase::Diag(), clang::NamedDecl::getDeclName(), clang::isa(), and clang::Decl::isInvalidDecl().

Referenced by clang::Sema::BuildDeclarationNameExpr(), and clang::Sema::BuildDeclarationNameExpr().

◆ checkDirectCallValidity()

void checkDirectCallValidity ( Sema & S,
const Expr * Fn,
FunctionDecl * Callee,
MultiExprArg ArgExprs )
static

◆ CheckExtensionTraitOperandType()

◆ checkForArray()

bool checkForArray ( const Expr * E)
static

◆ CheckForModifiableLvalue()

bool CheckForModifiableLvalue ( Expr * E,
SourceLocation Loc,
Sema & S )
static

CheckForModifiableLvalue - Verify that E is a modifiable lvalue.

If not, emit an error and return true. If so, return false.

Definition at line 13882 of file SemaExpr.cpp.

References clang::cast(), clang::Sema::CheckShadowingDeclModification(), clang::Sema::Context, clang::SemaBase::Diag(), DiagnoseConstAssignment(), DiagnoseRecursiveConstFields(), clang::Sema::getCurMethodDecl(), clang::DeclRefExpr::getDecl(), clang::Sema::getLangOpts(), clang::ObjCMethodDecl::getSelfDecl(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Expr::hasPlaceholderType(), clang::Expr::IgnoreParenCasts(), clang::isa(), clang::ObjCMethodDecl::isClassMethod(), clang::Expr::isModifiableLvalue(), IsReadonlyMessage(), isReferenceToNonConstCapture(), clang::Expr::MLV_ArrayTemporary, clang::Expr::MLV_ArrayType, clang::Expr::MLV_ClassTemporary, clang::Expr::MLV_ConstAddrSpace, clang::Expr::MLV_ConstQualified, clang::Expr::MLV_ConstQualifiedField, clang::Expr::MLV_DuplicateVectorComponents, clang::Expr::MLV_IncompleteType, clang::Expr::MLV_IncompleteVoidType, clang::Expr::MLV_InvalidExpression, clang::Expr::MLV_InvalidMessageExpression, clang::Expr::MLV_LValueCast, clang::Expr::MLV_MemberFunction, clang::Expr::MLV_NoSetterProperty, clang::Expr::MLV_NotObjectType, clang::Expr::MLV_SubObjCPropertySetting, clang::Expr::MLV_Valid, NCCK_Block, and clang::Sema::RequireCompleteType().

Referenced by clang::Sema::BuildVAArgExpr(), clang::Sema::CheckAssignmentOperands(), and CheckIncrementDecrementOperand().

◆ CheckForNullPointerDereference()

◆ CheckIdentityFieldAssignment()

◆ CheckIncrementDecrementOperand()

◆ CheckIndirectionOperand()

◆ checkObjCPointerIntrospection()

void checkObjCPointerIntrospection ( Sema & S,
ExprResult & L,
ExprResult & R,
SourceLocation OpLoc )
static

Check if a bitwise-& is performed on an Objective-C pointer.

This is usually indicative of introspection within the Objective-C pointer.

Definition at line 14986 of file SemaExpr.cpp.

References clang::SemaBase::Diag(), Diag(), clang::ActionResult< PtrTy, Compress >::get(), clang::Sema::getLangOpts(), clang::Selector::getNameForSlot(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Expr::IgnoreParenCasts(), clang::isa(), and clang::Type::isObjCObjectPointerType().

Referenced by clang::Sema::CreateBuiltinBinOp().

◆ checkObjCPointerTypesForAssignment()

◆ CheckObjCTraitOperandConstraints()

◆ checkOpenCLConditionVector()

bool checkOpenCLConditionVector ( Sema & S,
Expr * Cond,
SourceLocation QuestionLoc )
static

Return false if this is a valid OpenCL condition vector.

Definition at line 8448 of file SemaExpr.cpp.

References clang::Cond, clang::SemaBase::Diag(), clang::VectorType::getElementType(), and clang::Type::isIntegerType().

Referenced by OpenCLCheckVectorConditional().

◆ checkPointerIntegerMismatch()

bool checkPointerIntegerMismatch ( Sema & S,
ExprResult & Int,
Expr * PointerExpr,
SourceLocation Loc,
bool IsIntFirstExpr )
static

Return false if the first expression is not an integer and the second expression is not a pointer, true otherwise.

Definition at line 8329 of file SemaExpr.cpp.

References clang::SemaBase::Diag(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Sema::ImpCastExprToType(), and clang::Type::isPointerType().

Referenced by clang::Sema::CheckConditionalOperands().

◆ checkPointerTypesForAssignment()

AssignConvertType checkPointerTypesForAssignment ( Sema & S,
QualType LHSType,
QualType RHSType,
SourceLocation Loc )
static

Definition at line 9040 of file SemaExpr.cpp.

References clang::cast(), clang::Compatible, clang::CompatiblePointerDiscardsQualifiers, clang::CompatibleVoidPtrToNonVoidPtr, clang::Qualifiers::compatiblyIncludes(), clang::Qualifiers::compatiblyIncludesObjCLifetime(), clang::Sema::Context, clang::Sema::Diags, clang::FunctionVoidPointer, clang::Qualifiers::getAddressSpace(), clang::Sema::getASTContext(), clang::ASTContext::getCorrespondingUnsignedType(), clang::Sema::getLangOpts(), clang::Qualifiers::getObjCLifetime(), clang::Qualifiers::getPointerAuth(), clang::Type::hasSignedIntegerRepresentation(), clang::IncompatibleFunctionPointer, clang::IncompatibleFunctionPointerStrict, clang::IncompatibleNestedPointerQualifiers, clang::IncompatiblePointer, clang::IncompatiblePointerDiscardsQualifiers, clang::IncompatiblePointerSign, clang::isa(), clang::Qualifiers::isAddressSpaceSupersetOf(), clang::Sema::IsAssignConvertCompatible(), clang::QualType::isCanonical(), clang::Type::isCharType(), clang::PointerAuthQualifier::isEquivalent(), clang::Sema::IsFunctionConversion(), clang::Type::isFunctionPointerType(), clang::Type::isFunctionType(), clang::DiagnosticsEngine::isIgnored(), clang::Type::isIncompleteOrObjectType(), IsInvalidCmseNSCallConversion(), clang::Sema::IsInvalidSMECallConversion(), clang::Type::isVoidType(), clang::Qualifiers::removeObjCLifetime(), clang::Sema::TryFunctionConversion(), clang::ASTContext::typesAreCompatible(), clang::ASTContext::UnsignedCharTy, clang::Qualifiers::withoutObjCGCAttr(), and clang::Qualifiers::withoutObjCLifetime().

Referenced by clang::Sema::CheckAssignmentConstraints(), and clang::Sema::CheckSingleAssignmentConstraints().

◆ checkPtrAuthTypeDiscriminatorOperandType()

bool checkPtrAuthTypeDiscriminatorOperandType ( Sema & S,
QualType T,
SourceLocation Loc,
SourceRange ArgRange )
static

◆ CheckRealImagOperand()

◆ checkSizelessVectorShift()

◆ CheckSufficientAllocSize()

◆ checkThreeWayNarrowingConversion()

◆ CheckUnicodeArithmeticConversions()

◆ CheckVecStepTraitOperandType()

bool CheckVecStepTraitOperandType ( Sema & S,
QualType T,
SourceLocation Loc,
SourceRange ArgRange )
static

◆ CheckVectorElementsTraitOperandType()

bool CheckVectorElementsTraitOperandType ( Sema & S,
QualType T,
SourceLocation Loc,
SourceRange ArgRange )
static

◆ checkVectorResult()

bool checkVectorResult ( Sema & S,
QualType CondTy,
QualType VecResTy,
SourceLocation QuestionLoc )
static

Return false if the vector condition type and the vector result type are compatible.

OpenCL v1.1 s6.11.6 requires that both vector types have the same number of elements, and their element types have the same number of bits.

Definition at line 8468 of file SemaExpr.cpp.

References clang::Sema::Context, clang::SemaBase::Diag(), clang::Type::getAs(), clang::VectorType::getElementType(), clang::VectorType::getNumElements(), clang::ASTContext::getTypeSize(), clang::Type::isBooleanType(), and clang::Sema::LangOpts.

Referenced by OpenCLCheckVectorConditional().

◆ checkVectorShift()

◆ computeConditionalNullability()

QualType computeConditionalNullability ( QualType ResTy,
bool IsBin,
QualType LHSTy,
QualType RHSTy,
ASTContext & Ctx )
static

◆ ConstructTransparentUnion()

void ConstructTransparentUnion ( Sema & S,
ASTContext & C,
ExprResult & EResult,
QualType UnionType,
FieldDecl * Field )
static

Constructs a transparent union from an expression that is used to initialize the transparent union.

Definition at line 9709 of file SemaExpr.cpp.

References clang::C, clang::ActionResult< PtrTy, Compress >::get(), clang::Initializer, and clang::VK_PRValue.

Referenced by clang::Sema::CheckTransparentUnionArgumentConstraints().

◆ convertHalfVecBinOp()

◆ convertPointersToCompositeType()

◆ ConvertTokenKindToUnaryOpcode()

UnaryOperatorKind ConvertTokenKindToUnaryOpcode ( tok::TokenKind Kind)
inlinestatic

Definition at line 14888 of file SemaExpr.cpp.

Referenced by clang::Sema::ActOnUnaryOp().

◆ ConvertUTF8ToWideString()

void ConvertUTF8ToWideString ( unsigned CharByteWidth,
StringRef Source,
SmallString< 32 > & Target )
static

Definition at line 3511 of file SemaExpr.cpp.

Referenced by clang::Sema::BuildPredefinedExpr().

◆ convertVector()

ExprResult convertVector ( Expr * E,
QualType ElementType,
Sema & S )
static

◆ DetectPrecisionLossInComplexDivision()

◆ DiagnoseAdditionInShift()

void DiagnoseAdditionInShift ( Sema & S,
SourceLocation OpLoc,
Expr * SubExpr,
StringRef Shift )
static

◆ diagnoseAddressOfInvalidType()

void diagnoseAddressOfInvalidType ( Sema & S,
SourceLocation Loc,
Expr * E,
unsigned Type )
static

Diagnose invalid operand for address of operations.

Parameters
TypeThe type of operand which cannot have its address taken.

Definition at line 14481 of file SemaExpr.cpp.

References clang::SemaBase::Diag(), and clang::Stmt::getSourceRange().

Referenced by clang::Sema::CheckAddressOfOperand().

◆ diagnoseArithmeticOnFunctionPointer()

void diagnoseArithmeticOnFunctionPointer ( Sema & S,
SourceLocation Loc,
Expr * Pointer )
static

Diagnose invalid arithmetic on a function pointer.

Definition at line 11029 of file SemaExpr.cpp.

References clang::SemaBase::Diag(), clang::Sema::getLangOpts(), and Pointer.

Referenced by checkArithmeticBinOpPointerOperands(), and checkArithmeticOpPointerOperand().

◆ diagnoseArithmeticOnNullPointer()

void diagnoseArithmeticOnNullPointer ( Sema & S,
SourceLocation Loc,
Expr * Pointer,
bool IsGNUIdiom )
static

Diagnose invalid arithmetic on a null pointer.

If IsGNUIdiom is true, the operation is using the 'p = (i8*)nullptr + n' idiom, which we recognize as a GNU extension.

Definition at line 10984 of file SemaExpr.cpp.

References clang::SemaBase::Diag(), clang::Sema::getLangOpts(), and Pointer.

Referenced by clang::Sema::CheckAdditionOperands(), and clang::Sema::CheckSubtractionOperands().

◆ diagnoseArithmeticOnTwoFunctionPointers()

void diagnoseArithmeticOnTwoFunctionPointers ( Sema & S,
SourceLocation Loc,
Expr * LHS,
Expr * RHS )
static

◆ diagnoseArithmeticOnTwoVoidPointers()

void diagnoseArithmeticOnTwoVoidPointers ( Sema & S,
SourceLocation Loc,
Expr * LHSExpr,
Expr * RHSExpr )
static

Diagnose invalid arithmetic on two void pointers.

Definition at line 10961 of file SemaExpr.cpp.

References clang::SemaBase::Diag(), clang::Sema::getLangOpts(), and clang::Stmt::getSourceRange().

Referenced by checkArithmeticBinOpPointerOperands().

◆ diagnoseArithmeticOnVoidPointer()

void diagnoseArithmeticOnVoidPointer ( Sema & S,
SourceLocation Loc,
Expr * Pointer )
static

Diagnose invalid arithmetic on a void pointer.

Definition at line 10971 of file SemaExpr.cpp.

References clang::SemaBase::Diag(), clang::Sema::getLangOpts(), and Pointer.

Referenced by checkArithmeticBinOpPointerOperands(), and checkArithmeticOpPointerOperand().

◆ DiagnoseBadDivideOrRemainderValues()

◆ DiagnoseBadShiftValues()

◆ DiagnoseBinOpPrecedence()

◆ DiagnoseBitwiseOpInBitwiseOp()

void DiagnoseBitwiseOpInBitwiseOp ( Sema & S,
BinaryOperatorKind Opc,
SourceLocation OpLoc,
Expr * SubExpr )
static

Look for bitwise op in the left or right hand of a bitwise op with lower precedence and emit a diagnostic together with a fixit hint that wraps the '&' expression in parentheses.

Definition at line 15467 of file SemaExpr.cpp.

References clang::SemaBase::Diag(), clang::BinaryOperator::getOpcodeStr(), clang::SemaBase::PDiag(), and SuggestParentheses().

Referenced by DiagnoseBinOpPrecedence().

◆ DiagnoseBitwisePrecedence()

void DiagnoseBitwisePrecedence ( Sema & Self,
BinaryOperatorKind Opc,
SourceLocation OpLoc,
Expr * LHSExpr,
Expr * RHSExpr )
static

DiagnoseBitwisePrecedence - Emit a warning when bitwise and comparison operators are mixed in a way that suggests that the programmer forgot that comparison operators have higher precedence.

The most typical example of such code is "flags & 0x0020 != 0", which is equivalent to "flags & 1".

Definition at line 15376 of file SemaExpr.cpp.

References clang::Stmt::getBeginLoc(), clang::Stmt::getEndLoc(), clang::BinaryOperator::getLHS(), clang::BinaryOperator::getOpcodeStr(), clang::BinaryOperator::getOpcodeStr(), clang::BinaryOperator::getRHS(), clang::BinaryOperator::isBitwiseOp(), clang::BinaryOperator::isComparisonOp(), clang::Self, and SuggestParentheses().

Referenced by DiagnoseBinOpPrecedence().

◆ DiagnoseCalleeStaticArrayParam()

◆ DiagnoseConditionalPrecedence()

void DiagnoseConditionalPrecedence ( Sema & Self,
SourceLocation OpLoc,
Expr * Condition,
const Expr * LHSExpr,
const Expr * RHSExpr )
static

DiagnoseConditionalPrecedence - Emit a warning when a conditional operator and binary operator are mixed in a way that suggests the programmer assumed the conditional operator has higher precedence, for example: "int x = a + someBinaryCondition ? 1 : 2".

Definition at line 8839 of file SemaExpr.cpp.

References clang::Condition, ExprLooksBoolean(), clang::Stmt::getBeginLoc(), clang::Stmt::getEndLoc(), clang::BinaryOperator::getOpcodeStr(), clang::BinaryOperator::getOpcodeStr(), IsArithmeticBinaryExpr(), clang::BinaryOperator::isBitwiseOp(), clang::Self, and SuggestParentheses().

Referenced by clang::Sema::ActOnConditionalOp().

◆ DiagnoseConstAssignment()

void DiagnoseConstAssignment ( Sema & S,
const Expr * E,
SourceLocation Loc )
static

Emit the "read-only variable not assignable" error and print notes to give more information about why the variable is not assignable, such as pointing to the declaration of a const variable, showing that a method is const, or that the function is returning a const reference.

Definition at line 13691 of file SemaExpr.cpp.

References ConstFunction, ConstMember, ConstMethod, ConstUnknown, ConstVariable, clang::SemaBase::Diag(), clang::SourceRange::getBegin(), clang::Sema::getFunctionLevelDeclContext(), clang::Decl::getLocation(), clang::FunctionDecl::getReturnType(), clang::FunctionDecl::getReturnTypeSourceRange(), clang::Stmt::getSourceRange(), clang::Expr::IgnoreImplicit(), clang::Expr::IgnoreParenImpCasts(), clang::isa(), and IsTypeModifiable().

Referenced by CheckForModifiableLvalue(), and DiagnoseRecursiveConstFields().

◆ DiagnoseDirectIsaAccess()

◆ diagnoseDistinctPointerComparison()

void diagnoseDistinctPointerComparison ( Sema & S,
SourceLocation Loc,
ExprResult & LHS,
ExprResult & RHS,
bool IsError )
static

◆ DiagnoseDivisionSizeofPointerOrArray()

◆ DiagnosedUnqualifiedCallsToStdFunctions()

◆ diagnoseFunctionPointerToVoidComparison()

void diagnoseFunctionPointerToVoidComparison ( Sema & S,
SourceLocation Loc,
ExprResult & LHS,
ExprResult & RHS,
bool IsError )
static

◆ DiagnoseLogicalAndInLogicalOrLHS()

void DiagnoseLogicalAndInLogicalOrLHS ( Sema & S,
SourceLocation OpLoc,
Expr * LHSExpr,
Expr * RHSExpr )
static

Look for '&&' in the left hand of a '||' expr.

Definition at line 15431 of file SemaExpr.cpp.

References EmitDiagnosticForLogicalAndInLogicalOr(), and clang::isa().

Referenced by DiagnoseBinOpPrecedence().

◆ DiagnoseLogicalAndInLogicalOrRHS()

void DiagnoseLogicalAndInLogicalOrRHS ( Sema & S,
SourceLocation OpLoc,
Expr * LHSExpr,
Expr * RHSExpr )
static

Look for '&&' in the right hand of a '||' expr.

Definition at line 15452 of file SemaExpr.cpp.

References EmitDiagnosticForLogicalAndInLogicalOr(), and clang::isa().

Referenced by DiagnoseBinOpPrecedence().

◆ diagnoseLogicalNotOnLHSofCheck()

◆ diagnoseObjCLiteralComparison()

◆ diagnosePointerIncompatibility()

void diagnosePointerIncompatibility ( Sema & S,
SourceLocation Loc,
Expr * LHSExpr,
Expr * RHSExpr )
static

Emit error when two pointers are incompatible.

Definition at line 11232 of file SemaExpr.cpp.

References clang::SemaBase::Diag(), clang::Stmt::getSourceRange(), clang::Expr::getType(), and clang::Type::isAnyPointerType().

Referenced by clang::Sema::CheckSubtractionOperands().

◆ DiagnoseRecursiveConstFields() [1/2]

void DiagnoseRecursiveConstFields ( Sema & S,
const Expr * E,
SourceLocation Loc )
static

Emit an error for the case where a record we are trying to assign to has a const-qualified field somewhere in its hierarchy.

Definition at line 13859 of file SemaExpr.cpp.

References DiagnoseConstAssignment(), DiagnoseRecursiveConstFields(), clang::Type::getAsCanonical(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Type::isRecordType(), OEK_LValue, OEK_Member, and OEK_Variable.

◆ DiagnoseRecursiveConstFields() [2/2]

void DiagnoseRecursiveConstFields ( Sema & S,
const ValueDecl * VD,
const RecordType * Ty,
SourceLocation Loc,
SourceRange Range,
OriginalExprKind OEK,
bool & DiagnosticEmitted )
static

◆ diagnoseScopedEnums()

◆ DiagnoseSelfAssignment()

◆ DiagnoseShiftCompare()

◆ diagnoseStringPlusChar()

◆ diagnoseStringPlusInt()

void diagnoseStringPlusInt ( Sema & Self,
SourceLocation OpLoc,
Expr * LHSExpr,
Expr * RHSExpr )
static

◆ diagnoseSubtractionOnNullPointer()

void diagnoseSubtractionOnNullPointer ( Sema & S,
SourceLocation Loc,
Expr * Pointer,
bool BothNull )
static

◆ diagnoseTautologicalComparison()

◆ diagnoseUncapturableValueReferenceOrBinding()

◆ diagnoseUnknownAnyExpr()

◆ DiagnoseUnusedOfDecl()

◆ diagnoseUseOfInternalDeclInInlineFunction()

void diagnoseUseOfInternalDeclInInlineFunction ( Sema & S,
const NamedDecl * D,
SourceLocation Loc )
static

Check whether we're in an extern inline function and referring to a variable or function with internal linkage (C11 6.7.4p3).

This is only a warning because we used to silently accept this code, but in many cases it will not behave correctly. This is not enabled in C++ mode because the restriction language is a bit weaker (C++11 [basic.def.odr]p6) and so while there may still be user mistakes, most of the time we can't prove that there are errors.

Definition at line 163 of file SemaExpr.cpp.

References clang::SemaBase::Diag(), clang::Decl::getCanonicalDecl(), clang::Sema::getCurFunctionDecl(), clang::NamedDecl::getFormalLinkage(), clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::Sema::getSourceManager(), clang::Decl::hasAttr(), clang::Internal, clang::NamedDecl::isExternallyVisible(), clang::FunctionDecl::isInlined(), clang::SourceManager::isInMainFile(), and clang::Sema::MaybeSuggestAddingStaticToDecl().

Referenced by clang::Sema::DiagnoseUseOfDecl().

◆ diagnoseXorMisusedAsPow()

◆ DoMarkBindingDeclReferenced()

◆ DoMarkPotentialCapture()

◆ DoMarkVarDeclReferenced()

◆ EmitDiagnosticForLogicalAndInLogicalOr()

void EmitDiagnosticForLogicalAndInLogicalOr ( Sema & Self,
SourceLocation OpLoc,
BinaryOperator * Bop )
static

It accepts a '&&' expr that is inside a '||' one.

Emit a diagnostic together with a fixit hint that wraps the '&&' expression in parentheses.

Definition at line 15419 of file SemaExpr.cpp.

References clang::BinaryOperator::getOpcode(), clang::BinaryOperator::getOpcodeStr(), clang::BinaryOperator::getOperatorLoc(), clang::Stmt::getSourceRange(), clang::Self, and SuggestParentheses().

Referenced by DiagnoseLogicalAndInLogicalOrLHS(), and DiagnoseLogicalAndInLogicalOrRHS().

◆ enclosingClassIsRelatedToClassInWhichMembersWereFound()

◆ EvaluateAndDiagnoseImmediateInvocation()

◆ ExprLooksBoolean()

bool ExprLooksBoolean ( const Expr * E)
static

ExprLooksBoolean - Returns true if E looks boolean, i.e.

it has boolean type or is a logical expression such as (x==y) which has int type, but is commonly interpreted as boolean.

Definition at line 8818 of file SemaExpr.cpp.

References clang::Expr::getType(), clang::Expr::IgnoreParenImpCasts(), clang::Type::isBooleanType(), and clang::Type::isPointerType().

Referenced by DiagnoseConditionalPrecedence().

◆ FindFieldDeclInstantiationPattern()

◆ FixDependencyOfIdExpressionsInLambdaWithDependentObjectParameter()

void FixDependencyOfIdExpressionsInLambdaWithDependentObjectParameter ( Sema & SemaRef,
ValueDecl * D,
Expr * E )
static

◆ funcHasParameterSizeMangling()

bool funcHasParameterSizeMangling ( Sema & S,
FunctionDecl * FD )
static

◆ getDependentArraySubscriptType()

◆ GetFixedPointRank()

unsigned GetFixedPointRank ( QualType Ty)
static

Return the rank of a given fixed point or integer type.

The value itself doesn't matter, but the values must be increasing with proper increasing rank as described in N1169 4.1.1.

Definition at line 1416 of file SemaExpr.cpp.

References clang::Type::getAs().

Referenced by handleFixedPointConversion().

◆ getParentOfCapturingContextOrNull()

◆ getPredefinedExprDecl()

Decl * getPredefinedExprDecl ( DeclContext * DC)
static

getPredefinedExprDecl - Returns Decl of a given DeclContext that can be used to determine the value of a PredefinedExpr.

This can be either a block, lambda, captured statement, function, otherwise a nullptr.

Definition at line 2020 of file SemaExpr.cpp.

References clang::DeclContext::getParent(), and clang::isa().

Referenced by clang::Sema::BuildPredefinedExpr(), and clang::Sema::ExpandFunctionLocalPredefinedMacros().

◆ getPredefinedExprKind()

◆ getPrimaryDecl()

ValueDecl * getPrimaryDecl ( Expr * E)
static

getPrimaryDecl - Helper function for CheckAddressOfOperand().

This routine allows us to typecheck complex/recursive expressions where the declaration is needed for type checking. We only need to handle cases when the expression references a function designator or is an lvalue. Here are some examples:

  • &(x) => x
  • &*****f => f for f a function designator.
  • &s.xx => s
  • &s.zz[1].yy -> s, if zz is an array
  • *(x + 1) -> x, if x is an array
  • &"123"[2] -> 0
  • & real x -> x

FIXME: We don't recurse to the RHS of a comma, nor handle pointers to members.

Definition at line 14421 of file SemaExpr.cpp.

References clang::cast(), clang::UnaryOperator::getOpcode(), getPrimaryDecl(), clang::Stmt::getStmtClass(), and clang::UnaryOperator::getSubExpr().

Referenced by clang::Sema::CheckAddressOfOperand(), and getPrimaryDecl().

◆ getUDSuffixLoc()

SourceLocation getUDSuffixLoc ( Sema & S,
SourceLocation TokLoc,
unsigned Offset )
static

getUDSuffixLoc - Create a SourceLocation for a ud-suffix, given the location of the token and the offset of the ud-suffix within it.

Definition at line 2028 of file SemaExpr.cpp.

References clang::Lexer::AdvanceToTokenCharacter(), clang::Sema::getLangOpts(), and clang::Sema::getSourceManager().

Referenced by clang::Sema::ActOnCharacterConstant(), clang::Sema::ActOnNumericConstant(), clang::Sema::ActOnStringLiteral(), and clang::Sema::ActOnUnevaluatedStringLiteral().

◆ handleComplexConversion()

QualType handleComplexConversion ( Sema & S,
ExprResult & LHS,
ExprResult & RHS,
QualType LHSType,
QualType RHSType,
bool IsCompAssign )
static

Handle arithmetic conversion with complex types.

Helper function of UsualArithmeticConversions()

Definition at line 1172 of file SemaExpr.cpp.

References clang::Sema::Context, clang::ASTContext::getFloatingTypeOrder(), handleComplexFloatConversion(), and handleComplexIntegerToFloatConversion().

Referenced by clang::Sema::UsualArithmeticConversions().

◆ handleComplexFloatConversion()

◆ handleComplexIntConversion()

QualType handleComplexIntConversion ( Sema & S,
ExprResult & LHS,
ExprResult & RHS,
QualType LHSType,
QualType RHSType,
bool IsCompAssign )
static

◆ handleComplexIntegerToFloatConversion()

bool handleComplexIntegerToFloatConversion ( Sema & S,
ExprResult & IntExpr,
ExprResult & ComplexExpr,
QualType IntTy,
QualType ComplexTy,
bool SkipCast )
static

Convert complex integers to complex floats and real integers to real floats as required for complex arithmetic.

Helper function of UsualArithmeticConversions()

Returns
false if the integer expression is an integer type and is successfully converted to the (complex) float type.

Definition at line 1121 of file SemaExpr.cpp.

References clang::Type::castAs(), clang::ActionResult< PtrTy, Compress >::get(), clang::Sema::ImpCastExprToType(), clang::Type::isComplexIntegerType(), clang::Type::isComplexType(), clang::Type::isIntegerType(), and clang::Type::isRealFloatingType().

Referenced by handleComplexConversion().

◆ handleFixedPointConversion()

QualType handleFixedPointConversion ( Sema & S,
QualType LHSTy,
QualType RHSTy )
static

handleFixedPointConversion - Fixed point operations between fixed point types and integers or other fixed point types do not fall under usual arithmetic conversion since these conversions could result in loss of precsision (N1169 4.1.4).

These operations should be calculated with the full precision of their result type (N1169 4.1.6.2.1).

Definition at line 1463 of file SemaExpr.cpp.

References clang::Sema::Context, clang::ASTContext::getCorrespondingSaturatedType(), clang::ASTContext::getCorrespondingSignedFixedPointType(), GetFixedPointRank(), clang::Type::isFixedPointOrIntegerType(), clang::Type::isFixedPointType(), clang::Type::isSaturatedFixedPointType(), clang::Type::isSignedFixedPointType(), and clang::Type::isUnsignedFixedPointType().

Referenced by clang::Sema::UsualArithmeticConversions().

◆ handleFloatConversion()

◆ HandleImmediateInvocations()

void HandleImmediateInvocations ( Sema & SemaRef,
Sema::ExpressionEvaluationContextRecord & Rec )
static

When we have more than 1 ImmediateInvocationCandidates or previously failed immediate invocations, we need to check for nested ImmediateInvocationCandidates in order to avoid duplicate diagnostics. Otherwise we only need to remove ReferenceToConsteval in the immediate invocation.

Prevent sema calls during the tree transform from adding pointers that are already in the sets.

Prevent diagnostic during tree transfrom as they are duplicates

Definition at line 18071 of file SemaExpr.cpp.

References clang::cast(), clang::Sema::Context, clang::Sema::ExpressionEvaluationContextRecord::Context, clang::SemaBase::Diag(), clang::Sema::DiagnoseImmediateEscalatingReason(), clang::Sema::ExpressionEvaluationContextRecord::EK_VariableInit, EvaluateAndDiagnoseImmediateInvocation(), clang::Sema::ExpressionEvaluationContextRecord::ExprContext, clang::Sema::FailedImmediateInvocations, clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::Sema::ExpressionEvaluationContextRecord::ImmediateInvocationCandidates, clang::Sema::ExpressionEvaluationContextRecord::InImmediateEscalatingFunctionContext, clang::Sema::InnermostDeclarationWithDelayedImmediateInvocations(), clang::Sema::inTemplateInstantiation(), clang::Sema::ExpressionEvaluationContextRecord::isImmediateFunctionContext(), clang::isLambdaCallOperator(), clang::Sema::ExpressionEvaluationContextRecord::ManglingContextDecl, clang::Sema::MarkExpressionAsImmediateEscalating(), clang::Sema::PotentiallyEvaluated, clang::Sema::PotentiallyEvaluatedIfUsed, clang::Sema::RebuildingImmediateInvocation, clang::Sema::ExpressionEvaluationContextRecord::ReferenceToConsteval, RemoveNestedImmediateInvocation(), and clang::SemaBase::SemaRef.

Referenced by clang::Sema::PopExpressionEvaluationContext().

◆ handleIntegerConversion()

template<PerformCastFn doLHSCast, PerformCastFn doRHSCast>
QualType handleIntegerConversion ( Sema & S,
ExprResult & LHS,
ExprResult & RHS,
QualType LHSType,
QualType RHSType,
bool IsCompAssign )
static

◆ handleIntToFloatConversion()

QualType handleIntToFloatConversion ( Sema & S,
ExprResult & FloatExpr,
ExprResult & IntExpr,
QualType FloatTy,
QualType IntTy,
bool ConvertFloat,
bool ConvertInt )
static

Handle arithmetic conversion from integer to float.

Helper function of UsualArithmeticConversions()

Definition at line 1196 of file SemaExpr.cpp.

References clang::Sema::Context, clang::ActionResult< PtrTy, Compress >::get(), clang::ASTContext::getComplexType(), clang::Sema::ImpCastExprToType(), clang::Type::isComplexIntegerType(), and clang::Type::isIntegerType().

Referenced by handleFloatConversion().

◆ hasAnyExplicitStorageClass()

bool hasAnyExplicitStorageClass ( const FunctionDecl * D)
static

Determine whether a FunctionDecl was ever declared with an explicit storage class.

Definition at line 147 of file SemaExpr.cpp.

References clang::FunctionDecl::redecls(), and clang::SC_None.

Referenced by clang::Sema::MaybeSuggestAddingStaticToDecl().

◆ hasIsEqualMethod()

◆ IgnoreCommaOperand()

bool IgnoreCommaOperand ( const Expr * E,
const ASTContext & Context )
static

◆ IsArithmeticBinaryExpr()

bool IsArithmeticBinaryExpr ( const Expr * E,
BinaryOperatorKind * Opcode,
const Expr ** RHSExprs )
static

IsArithmeticBinaryExpr - Returns true if E is an arithmetic binary expression, either using a built-in or overloaded operator, and sets *OpCode to the opcode and *RHSExprs to the right-hand side expression.

Definition at line 8773 of file SemaExpr.cpp.

References clang::Call, clang::BinaryOperator::getOverloadedOpcode(), clang::Expr::IgnoreConversionOperatorSingleStep(), clang::Expr::IgnoreImpCasts(), and IsArithmeticOp().

Referenced by DiagnoseConditionalPrecedence().

◆ IsArithmeticOp()

◆ isCapturingReferenceToHostVarInCUDADeviceLambda()

◆ isImplicitlyDefinableConstexprFunction()

bool isImplicitlyDefinableConstexprFunction ( FunctionDecl * Func)
static

◆ IsInvalidCmseNSCallConversion()

bool IsInvalidCmseNSCallConversion ( Sema & S,
QualType FromType,
QualType ToType )
static

◆ isLegalBoolVectorBinaryOp()

bool isLegalBoolVectorBinaryOp ( BinaryOperatorKind Opc)
static

Definition at line 13404 of file SemaExpr.cpp.

Referenced by clang::Sema::CheckBitwiseOperands().

◆ isMSPropertySubscriptExpr()

bool isMSPropertySubscriptExpr ( Sema & S,
Expr * Base )
static

Definition at line 4866 of file SemaExpr.cpp.

References clang::isa().

Referenced by clang::Sema::ActOnArraySubscriptExpr().

◆ isObjCObjectLiteral()

◆ isOdrUseContext()

OdrUseContext isOdrUseContext ( Sema & SemaRef)
static

◆ isOverflowingIntegerType()

◆ isParenthetizedAndQualifiedAddressOfExpr()

bool isParenthetizedAndQualifiedAddressOfExpr ( Expr * Fn)
static

Definition at line 5872 of file SemaExpr.cpp.

References bool, and clang::isa().

Referenced by clang::Sema::ConvertArgumentsForCall().

◆ isPlaceholderToRemoveAsArg()

bool isPlaceholderToRemoveAsArg ( QualType type)
static

Is the given type a placeholder that we need to lower out immediately during argument processing?

Definition at line 6209 of file SemaExpr.cpp.

References clang::BuiltinType::getKind(), and clang::ast_matchers::type.

Referenced by clang::Sema::CheckArgsForPlaceholders().

◆ isPotentiallyConstantEvaluatedContext()

◆ IsReadonlyMessage()

◆ isReferenceToNonConstCapture()

◆ isScopedEnumerationType()

bool isScopedEnumerationType ( QualType T)
static

Definition at line 11521 of file SemaExpr.cpp.

References clang::T.

Referenced by clang::Sema::CreateBuiltinUnaryOp().

◆ isTautologicalBoundsCheck()

std::optional< bool > isTautologicalBoundsCheck ( Sema & S,
const Expr * LHS,
const Expr * RHS,
BinaryOperatorKind Opc )
static

Detect patterns ptr + size >= ptr and ptr + size < ptr, where ptr is a pointer and size is an unsigned integer.

Return whether the result is always true/false.

Definition at line 12097 of file SemaExpr.cpp.

References clang::Sema::getLangOpts(), clang::Expr::getType(), clang::Type::isPointerType(), clang::Expr::isSameComparisonOperand(), and clang::Other.

Referenced by diagnoseTautologicalComparison().

◆ IsTypeModifiable()

◆ isVariableAlreadyCapturedInScopeInfo()

◆ isVariableCapturable()

◆ isVector()

bool isVector ( QualType QT,
QualType ElementType )
static

This helper function returns true if QT is a vector type that has element type ElementType.

Definition at line 9310 of file SemaExpr.cpp.

References clang::Type::getAs().

Referenced by convertHalfVecBinOp(), clang::Sema::CreateBuiltinBinOp(), clang::APValue::getVectorElt(), and clang::APValue::getVectorLength().

◆ LookupStdSourceLocationImpl()

◆ MarkExprReferenced()

◆ MarkVarDeclODRUsed()

void MarkVarDeclODRUsed ( ValueDecl * V,
SourceLocation Loc,
Sema & SemaRef,
const unsigned *const FunctionScopeIndexToStopAt = nullptr )
static

Directly mark a variable odr-used.

Given a choice, prefer to use MarkVariableReferenced since it does additional checks and then calls MarkVarDeclODRUsed. If the variable must be captured:

  • if FunctionScopeIndexToStopAt is null, capture it in the CurContext
  • else capture it in the DeclContext that maps to the *FunctionScopeIndexToStopAt on the FunctionScopeInfo stack.

Definition at line 18708 of file SemaExpr.cpp.

References clang::Sema::Context, clang::Sema::CUDA(), clang::ASTContext::CUDADeviceVarODRUsedByHost, clang::ASTContext::CUDAExternalDeviceDeclODRUsedByHost, clang::Sema::CurContext, clang::SemaCUDA::CVT_Device, clang::SemaCUDA::CVT_Host, clang::VarDecl::DeclarationOnly, clang::Device, clang::Sema::getASTContext(), clang::VarDecl::getCanonicalDecl(), clang::ASTContext::GetGVALinkageForFunction(), clang::Decl::getLocation(), clang::ValueDecl::getType(), clang::Global, clang::GVA_StrongExternal, clang::Decl::hasAttr(), clang::VarDecl::hasDefinition(), clang::VarDecl::hasExternalStorage(), clang::VarDecl::hasGlobalStorage(), clang::VarDecl::hasInit(), clang::Host, clang::HostDevice, clang::SemaCUDA::IdentifyTarget(), clang::Implicit, clang::QualType::isConstQualified(), clang::NamedDecl::isExternallyVisible(), clang::Sema::isExternalWithNoLinkageType(), clang::VarDecl::isInline(), clang::SourceLocation::isInvalid(), clang::VarDecl::isStaticDataMember(), clang::Sema::LangOpts, clang::Sema::OpenMP(), clang::SemaBase::SemaRef, clang::Sema::targetDiag(), clang::SemaOpenMP::tryCaptureOpenMPLambdas(), clang::Sema::tryCaptureVariable(), clang::Sema::UndefinedButUsed, and V.

Referenced by clang::Sema::CleanupVarDeclMarking(), DoMarkVarDeclReferenced(), and clang::Sema::MarkCaptureUsedInEnclosingContext().

◆ maybeDiagnoseAssignmentToFunction()

◆ MayBeFunctionType()

bool MayBeFunctionType ( const ASTContext & Context,
const Expr * E )
static

Definition at line 6564 of file SemaExpr.cpp.

References clang::Expr::getType(), clang::isa(), and clang::T.

Referenced by clang::Sema::BuildCallExpr().

◆ needsConversionOfHalfVec()

bool needsConversionOfHalfVec ( bool OpRequiresConversion,
ASTContext & Ctx,
Expr * E0,
Expr * E1 = nullptr )
static

◆ OpenCLArithmeticConversions()

QualType OpenCLArithmeticConversions ( Sema & S,
ExprResult & LHS,
ExprResult & RHS,
SourceLocation QuestionLoc )
static

Simple conversion between integer and floating point types.

Used when handling the OpenCL conditional operator where the condition is a vector while the other operands are scalar.

OpenCL v1.1 s6.3.i and s6.11.6 together require that the scalar types are either integer or floating type. Between the two operands, the type with the higher rank is defined as the "result type". The other operand needs to be promoted to the same type. No other type promotion is allowed. We cannot use UsualArithmeticConversions() for this purpose, since it always promotes promotable types.

Definition at line 8359 of file SemaExpr.cpp.

References clang::Sema::Context, clang::Sema::DefaultFunctionArrayLvalueConversion(), clang::SemaBase::Diag(), clang::ActionResult< PtrTy, Compress >::get(), clang::ASTContext::getCanonicalType(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::CanQual< T >::getUnqualifiedType(), handleFloatConversion(), handleIntegerConversion(), clang::Type::isIntegerType(), clang::ActionResult< PtrTy, Compress >::isInvalid(), and clang::Type::isRealFloatingType().

Referenced by OpenCLConvertScalarsToVectors().

◆ OpenCLCheckVectorConditional()

QualType OpenCLCheckVectorConditional ( Sema & S,
ExprResult & Cond,
ExprResult & LHS,
ExprResult & RHS,
SourceLocation QuestionLoc )
static

◆ OpenCLConvertScalarsToVectors()

QualType OpenCLConvertScalarsToVectors ( Sema & S,
ExprResult & LHS,
ExprResult & RHS,
QualType CondTy,
SourceLocation QuestionLoc )
static

Convert scalar operands to a vector that matches the condition in length.

Used when handling the OpenCL conditional operator where the condition is a vector while the other operands are scalar.

We first compute the "result type" for the scalar operands according to OpenCL v1.1 s6.3.i. Both operands are then converted into a vector of that type where the length matches the condition vector type. s6.11.6 requires that the element types of the result and the condition must have the same number of bits.

Definition at line 8414 of file SemaExpr.cpp.

References clang::Sema::Context, clang::SemaBase::Diag(), clang::ActionResult< PtrTy, Compress >::get(), clang::Type::getAs(), clang::QualType::getAsString(), clang::VectorType::getElementType(), clang::ASTContext::getExtVectorType(), clang::VectorType::getNumElements(), clang::ASTContext::getTypeSize(), clang::QualType::getUnqualifiedType(), clang::Sema::ImpCastExprToType(), clang::QualType::isNull(), and OpenCLArithmeticConversions().

Referenced by OpenCLCheckVectorConditional().

◆ rebuildPotentialResultsAsNonOdrUsed()

◆ rebuildUnknownAnyFunction()

ExprResult rebuildUnknownAnyFunction ( Sema & S,
Expr * fn )
static

Given a function expression of unknown-any type, try to rebuild it to have a function type.

Definition at line 20904 of file SemaExpr.cpp.

References clang::Sema::DefaultFunctionArrayConversion(), and clang::ExprError().

Referenced by clang::Sema::BuildCallExpr(), and clang::Sema::BuildResolvedCallExpr().

◆ RecordModifiableNonNullParam()

void RecordModifiableNonNullParam ( Sema & S,
const Expr * Exp )
static

◆ recoverFromMSUnqualifiedLookup()

Expr * recoverFromMSUnqualifiedLookup ( Sema & S,
ASTContext & Context,
DeclarationNameInfo & NameInfo,
SourceLocation TemplateKWLoc,
const TemplateArgumentListInfo * TemplateArgs )
static

In Microsoft mode, if we are inside a template class whose parent class has dependent base classes, and we can't resolve an unqualified identifier, then assume the identifier is a member of a dependent base class.

We can only recover successfully in static methods, instance methods, and other contexts where 'this' is available. This doesn't precisely match MSVC's instantiation model, but it's close enough.

Definition at line 2680 of file SemaExpr.cpp.

References clang::CXXDependentScopeMemberExpr::Create(), clang::DependentScopeDeclRefExpr::Create(), clang::FixItHint::CreateInsertion(), clang::Sema::CurContext, clang::SemaBase::Diag(), clang::Type::getAsCXXRecordDecl(), clang::Sema::getCurrentThisType(), clang::DeclarationNameInfo::getLoc(), clang::DeclarationNameInfo::getName(), clang::DeclContext::getParent(), clang::Type::getPointeeType(), clang::CXXScopeSpec::getWithLocInContext(), clang::CXXRecordDecl::hasAnyDependentBases(), clang::CXXRecordDecl::hasDefinition(), clang::QualType::isNull(), and clang::CXXScopeSpec::MakeTrivial().

Referenced by clang::Sema::ActOnIdExpression().

◆ RemoveNestedImmediateInvocation()

void RemoveNestedImmediateInvocation ( Sema & SemaRef,
Sema::ExpressionEvaluationContextRecord & Rec,
SmallVector< Sema::ImmediateInvocationCandidate, 4 >::reverse_iterator It )
static

Base::TransfromCXXOperatorCallExpr doesn't traverse the callee so we need to remove its DeclRefExpr from the DRSet.

Base::TransformUserDefinedLiteral doesn't preserve the UserDefinedLiteral node.

Base::TransformInitializer skips ConstantExpr so we need to visit them here.

ConstantExprs are the first layer of implicit node to be removed so if Init isn't a ConstantExpr, no ConstantExpr will be skipped.

CXXConstructExpr with a single argument are getting skipped by TreeTransform in some situtation because they could be implicit. This can only occur for the top-level CXXConstructExpr because it is used nowhere in the expression being transformed therefore will not be rebuilt. Setting AllowSkippingFirstCXXConstructExpr to false will prevent from skipping the first CXXConstructExpr.

Definition at line 17963 of file SemaExpr.cpp.

References clang::cast(), clang::Sema::FailedImmediateInvocations, clang::ActionResult< PtrTy, Compress >::get(), clang::CallExpr::getCallee(), clang::FullExpr::getSubExpr(), clang::Expr::IgnoreImplicit(), clang::Sema::ExpressionEvaluationContextRecord::ImmediateInvocationCandidates, clang::Init, clang::isa(), clang::ConstantExpr::isImmediateInvocation(), clang::ActionResult< PtrTy, Compress >::isUsable(), clang::Sema::MaybeCreateExprWithCleanups(), clang::Sema::ExpressionEvaluationContextRecord::ReferenceToConsteval, and clang::SemaBase::SemaRef.

Referenced by HandleImmediateInvocations().

◆ rewriteBuiltinFunctionDecl()

FunctionDecl * rewriteBuiltinFunctionDecl ( Sema * Sema,
ASTContext & Context,
FunctionDecl * FDecl,
MultiExprArg ArgExprs )
static

If a builtin function has a pointer argument with no explicit address space, then it should be able to accept a pointer to any address space as input.

In order to do this, we need to replace the standard builtin declaration with one that uses the same address space as the call.

Returns
nullptr If this builtin is not a candidate for a rewrite i.e. it does not contain any pointer arguments without an address space qualifer. Otherwise the rewritten FunctionDecl is returned. TODO: Handle pointer return types.

Definition at line 6301 of file SemaExpr.cpp.

References clang::Decl::addAttr(), clang::cast(), clang::FunctionDecl::Create(), clang::ParmVarDecl::Create(), clang::Sema::DefaultFunctionArrayLvalueConversion(), clang::ActionResult< PtrTy, Compress >::get(), clang::FunctionDecl::getBuiltinID(), clang::Sema::getCurFPFeatures(), clang::NamedDecl::getIdentifier(), clang::Decl::getLocation(), clang::FunctionProtoType::getNumParams(), clang::FunctionProtoType::getParamType(), clang::DeclContext::getParent(), clang::Type::getPointeeType(), clang::FunctionType::getReturnType(), clang::Expr::getType(), clang::ValueDecl::getType(), clang::Decl::hasAttr(), clang::FPOptions::isFPConstrained(), clang::ActionResult< PtrTy, Compress >::isInvalid(), clang::isPtrSizeAddressSpace(), clang::FunctionProtoType::isVariadic(), clang::Sema::LangOpts, clang::Sema::mergeDeclAttributes(), clang::FunctionProtoType::param_types(), clang::SC_Extern, clang::SC_None, clang::ParmVarDecl::setScopeInfo(), clang::Sema::Unevaluated, clang::Unevaluated, and clang::FunctionProtoType::ExtProtoInfo::Variadic.

Referenced by clang::Sema::BuildCallExpr().

◆ ShouldLookupResultBeMultiVersionOverload()

bool ShouldLookupResultBeMultiVersionOverload ( const LookupResult & R)
static

◆ SuggestParentheses()

◆ tryGCCVectorConvertAndSplat()

◆ tryImplicitlyCaptureThisIfImplicitMemberFunctionAccessWithDependentArgs()

◆ TryTypoCorrectionForCall()

◆ tryVectorConvertAndSplat()

bool tryVectorConvertAndSplat ( Sema & S,
ExprResult * scalar,
QualType scalarTy,
QualType vectorEltTy,
QualType vectorTy,
unsigned & DiagID )
static

Try to convert a value of non-vector type to a vector type by converting the type to the element type of the vector and then performing a splat.

If the language is OpenCL, we only use conversions that promote scalar rank; for C, Obj-C, and C++ we allow any real scalar conversion except for float->int.

OpenCL V2.0 6.2.6.p2: An error shall occur if any scalar operand type has greater rank than the type of the vector element.

Parameters
scalar- if non-null, actually perform the conversions
Returns
true if the operation fails (but without diagnosing the failure)

Definition at line 10080 of file SemaExpr.cpp.

References clang::Sema::Context, clang::ActionResult< PtrTy, Compress >::get(), clang::ASTContext::getFloatingTypeOrder(), clang::ASTContext::getIntegerTypeOrder(), clang::Sema::getLangOpts(), clang::Sema::ImpCastExprToType(), clang::Type::isBooleanType(), clang::Type::isIntegerType(), clang::Type::isIntegralType(), and clang::Type::isRealFloatingType().

Referenced by clang::Sema::CheckVectorOperands().

◆ unsupportedTypeConversion()

bool unsupportedTypeConversion ( const Sema & S,
QualType LHSType,
QualType RHSType )
static

Diagnose attempts to convert between __float128, __ibm128 and long double if there is no support for such conversion.

Helper function of UsualArithmeticConversions().

Definition at line 1277 of file SemaExpr.cpp.

References clang::Sema::Context, clang::Type::getAs(), clang::ComplexType::getElementType(), clang::ASTContext::getFloatTypeSemantics(), and clang::Type::isFloatingType().

Referenced by clang::Sema::CheckAssignmentConstraints(), clang::Sema::CheckConditionalOperands(), and clang::Sema::UsualArithmeticConversions().

◆ warnOnSizeofOnArrayDecay()

void warnOnSizeofOnArrayDecay ( Sema & S,
SourceLocation Loc,
QualType T,
const Expr * E )
static

Check whether E is a pointer from a decayed array type (the decayed pointer type is equal to T) and emit a warning if it is.

Definition at line 4256 of file SemaExpr.cpp.

References clang::SemaBase::Diag(), clang::Expr::getType(), and clang::T.

Referenced by clang::Sema::CheckUnaryExprOrTypeTraitOperand().