clang 20.0.0git
|
#include "CheckExprLifetime.h"
#include "TreeTransform.h"
#include "UsedDeclVisitor.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTLambda.h"
#include "clang/AST/ASTMutationListener.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/EvaluatedExprVisitor.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprObjC.h"
#include "clang/AST/ExprOpenMP.h"
#include "clang/AST/MangleNumberingContext.h"
#include "clang/AST/OperationKinds.h"
#include "clang/AST/ParentMapContext.h"
#include "clang/AST/RecursiveASTVisitor.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/SemaCUDA.h"
#include "clang/Sema/SemaFixItUtils.h"
#include "clang/Sema/SemaInternal.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/STLForwardCompat.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/SaveAndRestore.h"
#include "llvm/Support/TypeSize.h"
#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/AArch64SVEACLETypes.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) case Decl::type: |
#define | TYPE(Class, Base) |
#define | ABSTRACT_TYPE(Class, Base) |
#define | NON_CANONICAL_TYPE(Class, Base) |
#define | DEPENDENT_TYPE(Class, Base) case Type::Class: |
#define | NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) |
#define | IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) case BuiltinType::Id: |
#define | EXT_OPAQUE_TYPE(ExtType, Id, Ext) case BuiltinType::Id: |
#define | SVE_TYPE(Name, Id, SingletonId) case BuiltinType::Id: |
#define | PPC_VECTOR_TYPE(Name, Id, Size) case BuiltinType::Id: |
#define | RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id: |
#define | WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id: |
#define | AMDGPU_TYPE(Name, Id, SingletonId) case BuiltinType::Id: |
#define | HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case BuiltinType::Id: |
#define | PLACEHOLDER_TYPE(ID, SINGLETON_ID) |
#define | BUILTIN_TYPE(ID, SINGLETON_ID) case BuiltinType::ID: |
#define | IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) case BuiltinType::Id: |
#define | EXT_OPAQUE_TYPE(ExtType, Id, Ext) case BuiltinType::Id: |
#define | SVE_TYPE(Name, Id, SingletonId) case BuiltinType::Id: |
#define | PPC_VECTOR_TYPE(Name, Id, Size) case BuiltinType::Id: |
#define | RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id: |
#define | WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id: |
#define | AMDGPU_TYPE(Name, Id, SingletonId) case BuiltinType::Id: |
#define | HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case BuiltinType::Id: |
#define | BUILTIN_TYPE(Id, SingletonId) case BuiltinType::Id: |
#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 | checkEnumArithmeticConversions (Sema &S, Expr *LHS, Expr *RHS, SourceLocation Loc, Sema::ArithConvKind ACK) |
Check that the usual arithmetic conversions can be performed on this pair of expressions that might be of enumeration type. | |
static PredefinedIdentKind | getPredefinedExprKind (tok::TokenKind Kind) |
static Decl * | getPredefinedExprDecl (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 void | emitEmptyLookupTypoDiagnostic (const TypoCorrection &TC, Sema &SemaRef, const CXXScopeSpec &SS, DeclarationName Typo, SourceLocation TypoLoc, ArrayRef< Expr * > Args, unsigned DiagnosticID, unsigned DiagnosticSuggestID) |
static Expr * | recoverFromMSUnqualifiedLookup (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 | diagnoseUncapturableValueReferenceOrBinding (Sema &S, SourceLocation loc, ValueDecl *var) |
static void | ConvertUTF8ToWideString (unsigned CharByteWidth, StringRef Source, SmallString< 32 > &Target) |
static Expr * | BuildFloatingLiteral (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 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 FunctionDecl * | rewriteBuiltinFunctionDecl (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 | breakDownVectorType (QualType type, uint64_t &len, QualType &eltType) |
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 Sema::AssignConvertType | checkPointerTypesForAssignment (Sema &S, QualType LHSType, QualType RHSType, SourceLocation Loc) |
static Sema::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 Sema::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 | DiagnoseDivisionSizeofPointerOrArray (Sema &S, Expr *LHS, Expr *RHS, SourceLocation Loc) |
static void | DiagnoseBadDivideOrRemainderValues (Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsDiv) |
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 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 ValueDecl * | getPrimaryDecl (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 NamedDecl * | getDeclFromExpr (Expr *E) |
static ExprResult | convertHalfVecBinOp (Sema &S, ExprResult LHS, ExprResult RHS, BinaryOperatorKind Opc, QualType ResultTy, ExprValueKind VK, ExprObjectKind OK, bool IsCompAssign, SourceLocation OpLoc, FPOptionsOverride FPFeatures) |
static std::pair< ExprResult, ExprResult > | CorrectDelayedTyposInBinOp (Sema &S, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr) |
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 CXXRecordDecl * | LookupStdSourceLocationImpl (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 bool | isVariableAlreadyCapturedInScopeInfo (CapturingScopeInfo *CSI, ValueDecl *Var, bool &SubCapturesAreNested, QualType &CaptureType, QualType &DeclRefType) |
static DeclContext * | getParentOfCapturingContextOrNull (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, Sema::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 Sema::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) |
#define ABSTRACT_DECL | ( | kind | ) |
#define ABSTRACT_TYPE | ( | Class, | |
Base | |||
) |
#define AMDGPU_TYPE | ( | Name, | |
Id, | |||
SingletonId | |||
) | case BuiltinType::Id: |
#define AMDGPU_TYPE | ( | Name, | |
Id, | |||
SingletonId | |||
) | case BuiltinType::Id: |
#define BUILTIN_TYPE | ( | ID, | |
SINGLETON_ID | |||
) | case BuiltinType::ID: |
#define BUILTIN_TYPE | ( | Id, | |
SingletonId | |||
) | case BuiltinType::Id: |
#define DECL | ( | type, | |
base | |||
) | case Decl::type: |
#define DEPENDENT_TYPE | ( | Class, | |
Base | |||
) | case Type::Class: |
#define EXT_OPAQUE_TYPE | ( | ExtType, | |
Id, | |||
Ext | |||
) | case BuiltinType::Id: |
#define EXT_OPAQUE_TYPE | ( | ExtType, | |
Id, | |||
Ext | |||
) | case BuiltinType::Id: |
#define HLSL_INTANGIBLE_TYPE | ( | Name, | |
Id, | |||
SingletonId | |||
) | case BuiltinType::Id: |
#define HLSL_INTANGIBLE_TYPE | ( | Name, | |
Id, | |||
SingletonId | |||
) | case BuiltinType::Id: |
#define IMAGE_TYPE | ( | ImgType, | |
Id, | |||
SingletonId, | |||
Access, | |||
Suffix | |||
) | case BuiltinType::Id: |
#define IMAGE_TYPE | ( | ImgType, | |
Id, | |||
SingletonId, | |||
Access, | |||
Suffix | |||
) | case BuiltinType::Id: |
#define NON_CANONICAL_TYPE | ( | Class, | |
Base | |||
) |
#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE | ( | Class, | |
Base | |||
) |
#define PLACEHOLDER_TYPE | ( | ID, | |
SINGLETON_ID | |||
) |
#define PLACEHOLDER_TYPE | ( | Id, | |
SingletonId | |||
) |
#define PPC_VECTOR_TYPE | ( | Name, | |
Id, | |||
Size | |||
) | case BuiltinType::Id: |
#define PPC_VECTOR_TYPE | ( | Name, | |
Id, | |||
Size | |||
) | case BuiltinType::Id: |
#define RVV_TYPE | ( | Name, | |
Id, | |||
SingletonId | |||
) | case BuiltinType::Id: |
#define RVV_TYPE | ( | Name, | |
Id, | |||
SingletonId | |||
) | case BuiltinType::Id: |
#define SVE_TYPE | ( | Name, | |
Id, | |||
SingletonId | |||
) | case BuiltinType::Id: |
#define SVE_TYPE | ( | Name, | |
Id, | |||
SingletonId | |||
) | case BuiltinType::Id: |
#define TYPE | ( | Class, | |
Base | |||
) |
#define VALUE | ( | type, | |
base | |||
) |
#define WASM_TYPE | ( | Name, | |
Id, | |||
SingletonId | |||
) | case BuiltinType::Id: |
#define WASM_TYPE | ( | Name, | |
Id, | |||
SingletonId | |||
) | case BuiltinType::Id: |
typedef ExprResult PerformCastFn(Sema &S, Expr *operand, QualType toType) |
Definition at line 1286 of file SemaExpr.cpp.
anonymous enum |
Enumerator | |
---|---|
ConstFunction | |
ConstVariable | |
ConstMember | |
ConstMethod | |
NestedConstMember | |
ConstUnknown |
Definition at line 13174 of file SemaExpr.cpp.
enum 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 13128 of file SemaExpr.cpp.
enum OriginalExprKind |
Enumerator | |
---|---|
OEK_Variable | |
OEK_Member | |
OEK_LValue |
Definition at line 13306 of file SemaExpr.cpp.
Definition at line 7426 of file SemaExpr.cpp.
References clang::Type::isScalarType(), and clang::ast_matchers::type.
Referenced by clang::Sema::areVectorTypesSameSize().
|
static |
BuildCookedLiteralOperatorCall - A user-defined literal was found.
Look up the corresponding cooked (non-raw) literal operator, and build a call to it.
Definition at line 1934 of file SemaExpr.cpp.
References clang::Sema::BuildLiteralOperatorCall(), clang::Sema::Context, clang::ASTContext::DeclarationNames, clang::ExprError(), clang::ASTContext::getArrayDecayedType(), clang::DeclarationNameTable::getCXXLiteralOperatorName(), clang::Sema::LOLR_Error, clang::Sema::LookupLiteralOperator(), clang::Sema::LookupOrdinaryName, and clang::DeclarationNameInfo::setCXXLiteralOperatorNameLoc().
Referenced by clang::Sema::ActOnCharacterConstant().
|
static |
Definition at line 3596 of file SemaExpr.cpp.
References clang::Sema::Context, clang::FloatingLiteral::Create(), clang::Sema::CurFPFeatures, clang::SemaBase::Diag(), clang::ASTContext::getFloatTypeSemantics(), clang::FPOptions::getRoundingMode(), and Loc.
Referenced by clang::Sema::ActOnNumericConstant().
|
static |
Create up to 4 fix-its for explicit reference and value capture of Var
or default capture.
Fixes may be omitted if they aren't allowed by the standard, for example we can't emit a default copy capture fix-it if we already explicitly copy capture capture another variable.
Definition at line 18619 of file SemaExpr.cpp.
References clang::C, canCaptureVariableByCopy(), clang::sema::CapturingScopeInfo::Captures, clang::FixItHint::CreateInsertion(), clang::SemaBase::Diag(), clang::Sema::getASTContext(), clang::SourceRange::getBegin(), clang::sema::CapturingScopeInfo::getCXXThisCapture(), clang::NamedDecl::getDeclName(), clang::SourceRange::getEnd(), clang::Sema::getLangOpts(), clang::SourceLocation::getLocWithOffset(), clang::NamedDecl::getName(), clang::sema::CapturingScopeInfo::ImpCap_None, clang::sema::CapturingScopeInfo::ImpCaptureStyle, clang::sema::LambdaScopeInfo::IntroducerRange, clang::sema::Capture::isCopyCapture(), clang::sema::CapturingScopeInfo::isCXXThisCaptured(), clang::DeclarationName::isIdentifier(), and clang::sema::LambdaScopeInfo::NumExplicitCaptures.
Referenced by clang::Sema::tryCaptureVariable().
|
static |
Build an overloaded binary operator expression in the given scope.
Definition at line 15098 of file SemaExpr.cpp.
References CheckIdentityFieldAssignment(), clang::Sema::CreateOverloadedBinOp(), DiagnoseSelfAssignment(), and clang::Sema::LookupBinOp().
Referenced by clang::Sema::BuildBinOp().
|
static |
Definition at line 18593 of file SemaExpr.cpp.
References clang::Sema::Context, clang::Type::getAsCXXRecordDecl(), clang::QualType::getNonReferenceType(), clang::ValueDecl::getType(), clang::Type::isDependentType(), and clang::T.
Referenced by buildLambdaCaptureFixit().
|
static |
Test if a (constant) integer Int can be casted to another integer type IntTy without losing precision.
Definition at line 9889 of file SemaExpr.cpp.
References clang::Sema::Context, clang::APValue::getInt(), clang::ASTContext::getIntegerTypeOrder(), clang::ASTContext::getIntWidth(), clang::Type::hasSignedIntegerRepresentation(), clang::Result, and clang::Expr::EvalResult::Val.
Referenced by tryGCCVectorConvertAndSplat().
|
static |
Test if a (constant) integer Int can be casted to floating point type FloatTy without losing precision.
Definition at line 9927 of file SemaExpr.cpp.
References clang::Sema::Context, clang::Float, clang::ASTContext::getFloatTypeSemantics(), clang::APValue::getInt(), clang::ASTContext::getIntWidth(), clang::ASTContext::getTypeSize(), clang::Type::hasSignedIntegerRepresentation(), clang::Result, and clang::Expr::EvalResult::Val.
Referenced by tryGCCVectorConvertAndSplat().
|
static |
Definition at line 18383 of file SemaExpr.cpp.
References clang::sema::CapturingScopeInfo::addCapture(), clang::Sema::Context, clang::SemaBase::Diag(), clang::Type::getAs(), clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::QualType::getNonReferenceType(), clang::QualType::getObjCLifetime(), clang::Type::getPointeeType(), clang::Decl::hasAttr(), clang::ASTContext::hasDirectOwnershipQualifier(), clang::Invalid, clang::Type::isArrayType(), clang::SemaOpenMP::isOpenMPCapturedDecl(), clang::Type::isReferenceType(), Loc, clang::Qualifiers::OCL_Autoreleasing, clang::Sema::OpenMP(), and clang::QualType::withConst().
Referenced by clang::Sema::tryCaptureVariable().
|
static |
Capture the given variable in the captured region.
Definition at line 18451 of file SemaExpr.cpp.
References clang::sema::CapturingScopeInfo::addCapture(), clang::QualType::addConst(), clang::sema::CapturedRegionScopeInfo::CapRegionKind, clang::Sema::Context, clang::CR_OpenMP, clang::Sema::getLangOpts(), clang::ASTContext::getLValueReferenceType(), clang::QualType::getUnqualifiedType(), clang::Invalid, clang::QualType::isConstQualified(), clang::SemaOpenMP::isOpenMPCapturedByRef(), clang::SemaOpenMP::isOpenMPCapturedDecl(), clang::SemaOpenMP::isOpenMPPrivateDecl(), Loc, clang::Sema::OpenMP(), clang::sema::CapturedRegionScopeInfo::OpenMPCaptureLevel, clang::sema::CapturedRegionScopeInfo::OpenMPLevel, clang::Sema::TryCapture_ExplicitByRef, and clang::Sema::TryCapture_Implicit.
Referenced by clang::Sema::tryCaptureVariable().
|
static |
Capture the given variable in the lambda.
Definition at line 18491 of file SemaExpr.cpp.
References clang::sema::CapturingScopeInfo::addCapture(), clang::QualType::addConst(), clang::Sema::Context, clang::SemaBase::Diag(), clang::Type::getAs(), clang::NamedDecl::getDeclName(), clang::Decl::getLocation(), clang::ASTContext::getLValueReferenceType(), clang::QualType::getNonReferenceType(), clang::QualType::getObjCLifetime(), clang::Type::getPointeeType(), clang::ASTContext::getTargetInfo(), clang::TargetInfo::getTriple(), clang::sema::CapturingScopeInfo::ImpCaptureStyle, clang::Invalid, clang::Type::isDependentType(), clang::Type::isReferenceType(), clang::QualType::isWebAssemblyReferenceType(), clang::sema::LambdaScopeInfo::lambdaCaptureShouldBeConst(), Loc, clang::Qualifiers::OCL_Autoreleasing, clang::Sema::RequireCompleteSizedType(), clang::Sema::RequireNonAbstractType(), clang::Sema::TryCapture_ExplicitByRef, and clang::Sema::TryCapture_Implicit.
Referenced by clang::Sema::tryCaptureVariable().
|
static |
Definition at line 4384 of file SemaExpr.cpp.
References clang::sema::CapturingScopeInfo::addVLATypeCapture(), clang::FunctionProtoType::desugar(), clang::ArrayType::getElementType(), clang::Type::getPointeeType(), clang::FunctionType::getReturnType(), clang::VariableArrayType::getSizeExpr(), clang::ASTContext::getSizeType(), clang::Type::getTypeClass(), clang::Type::isVariablyModifiedType(), clang::sema::CapturingScopeInfo::isVLATypeCaptured(), and clang::T.
Referenced by clang::Sema::CheckUnaryExprOrTypeTraitOperand(), clang::Sema::CreateBuiltinArraySubscriptExpr(), and clang::Sema::tryCaptureVariable().
|
static |
Definition at line 11831 of file SemaExpr.cpp.
References clang::CastExpr::getCastKindName(), clang::ICK_Array_To_Pointer, clang::ICK_Complex_Conversion, clang::ICK_Complex_Real, clang::ICK_Floating_Conversion, clang::ICK_Floating_Integral, clang::ICK_Function_To_Pointer, clang::ICK_HLSL_Array_RValue, clang::ICK_Identity, clang::ICK_Integral_Conversion, and clang::ICK_Lvalue_To_Rvalue.
Referenced by checkThreeWayNarrowingConversion().
|
static |
Definition at line 4318 of file SemaExpr.cpp.
References clang::Sema::CheckUnaryExprOrTypeTraitOperand(), D, clang::SemaBase::Diag(), E, clang::Expr::getExprLoc(), clang::Expr::getObjectKind(), clang::Stmt::getSourceRange(), clang::Expr::IgnoreParens(), clang::Expr::isTypeDependent(), and clang::OK_BitField.
Referenced by clang::Sema::CreateUnaryExprOrTypeTraitExpr().
|
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
Definition at line 10710 of file SemaExpr.cpp.
References checkArithmeticIncompletePointerType(), clang::SemaBase::Diag(), diagnoseArithmeticOnFunctionPointer(), diagnoseArithmeticOnTwoFunctionPointers(), diagnoseArithmeticOnTwoVoidPointers(), diagnoseArithmeticOnVoidPointer(), clang::Sema::getLangOpts(), clang::Type::getPointeeType(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::QualType::isAddressSpaceOverlapping(), clang::Type::isAnyPointerType(), clang::Type::isFunctionType(), clang::Type::isVoidType(), and Loc.
Referenced by clang::Sema::CheckSubtractionOperands().
|
static |
Emit error if Operand is incomplete pointer type.
Definition at line 10656 of file SemaExpr.cpp.
References clang::Type::getAs(), clang::Type::getPointeeType(), clang::Type::isAnyPointerType(), Loc, and clang::Sema::RequireCompleteSizedType().
Referenced by checkArithmeticBinOpPointerOperands(), checkArithmeticOpPointerOperand(), and CheckIncrementDecrementOperand().
|
static |
Definition at line 10400 of file SemaExpr.cpp.
References clang::Type::canDecayToPointerType(), clang::SemaBase::Diag(), clang::ActionResult< PtrTy, Compress >::get(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Expr::IgnoreParenImpCasts(), clang::Type::isAnyPointerType(), clang::Type::isBlockPointerType(), clang::Type::isFunctionType(), clang::Type::isMemberPointerType(), and Loc.
Referenced by clang::Sema::CheckAdditionOperands(), clang::Sema::CheckBitwiseOperands(), clang::Sema::CheckCompareOperands(), clang::Sema::CheckMultiplyDivideOperands(), clang::Sema::CheckRemainderOperands(), clang::Sema::CheckShiftOperands(), and clang::Sema::CheckSubtractionOperands().
|
static |
Diagnose if arithmetic on the given ObjC pointer is illegal.
Definition at line 4759 of file SemaExpr.cpp.
References clang::ObjCRuntime::allowsPointerArithmetic(), clang::Type::castAs(), clang::SemaBase::Diag(), getPointeeType(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Type::isObjCObjectPointerType(), clang::Sema::LangOpts, and clang::LangOptions::ObjCRuntime.
Referenced by clang::Sema::CheckAdditionOperands(), CheckIncrementDecrementOperand(), and clang::Sema::CheckSubtractionOperands().
|
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.
Definition at line 10678 of file SemaExpr.cpp.
References checkArithmeticIncompletePointerType(), diagnoseArithmeticOnFunctionPointer(), diagnoseArithmeticOnVoidPointer(), clang::Type::getAs(), clang::Sema::getLangOpts(), clang::Type::getPointeeType(), clang::Type::isAnyPointerType(), clang::Type::isFunctionType(), clang::Type::isVoidType(), and Loc.
Referenced by clang::Sema::CheckAdditionOperands(), CheckIncrementDecrementOperand(), and clang::Sema::CheckSubtractionOperands().
|
static |
Definition at line 11995 of file SemaExpr.cpp.
References clang::Sema::ACK_Comparison, checkArithmeticOrEnumeralThreeWayCompare(), clang::Sema::CheckFloatComparison(), clang::Sema::Context, clang::ActionResult< PtrTy, Compress >::get(), clang::ASTContext::getLogicalOperationType(), clang::Type::hasFloatingRepresentation(), clang::Sema::InvalidOperands(), clang::Type::isAnyComplexType(), clang::Type::isArithmeticType(), clang::Type::isEnumeralType(), clang::ActionResult< PtrTy, Compress >::isInvalid(), clang::BinaryOperator::isRelationalOp(), Loc, and clang::Sema::UsualArithmeticConversions().
Referenced by clang::Sema::CheckCompareOperands().
|
static |
Definition at line 11913 of file SemaExpr.cpp.
References clang::Sema::ACK_Comparison, clang::Type::castAs(), clang::Sema::CheckComparisonCategoryType(), checkThreeWayNarrowingConversion(), clang::Sema::Context, clang::ActionResult< PtrTy, Compress >::get(), clang::Stmt::getBeginLoc(), clang::getComparisonCategoryForBuiltinCmp(), clang::ASTContext::getPromotedIntegerType(), clang::Expr::getType(), clang::Type::hasFloatingRepresentation(), clang::ASTContext::hasSameUnqualifiedType(), clang::Expr::IgnoreParenImpCasts(), clang::Sema::ImpCastExprToType(), int, clang::Sema::InvalidOperands(), clang::Type::isArithmeticType(), clang::Type::isBooleanType(), clang::Type::isEnumeralType(), clang::ActionResult< PtrTy, Compress >::isInvalid(), clang::ASTContext::isPromotableIntegerType(), Loc, clang::Sema::OperatorInExpression, and clang::Sema::UsualArithmeticConversions().
Referenced by checkArithmeticOrEnumeralCompare().
|
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 8997 of file SemaExpr.cpp.
References clang::Sema::Compatible, clang::Sema::CompatiblePointerDiscardsQualifiers, clang::Sema::Context, clang::Sema::getLangOpts(), clang::QualType::getLocalQualifiers(), clang::Type::getPointeeType(), clang::ASTContext::getQualifiedType(), clang::QualType::getUnqualifiedType(), clang::Sema::IncompatibleBlockPointer, clang::QualType::isCanonical(), clang::Qualifiers::removeAddressSpace(), and clang::ASTContext::typesAreBlockPointerCompatible().
Referenced by clang::Sema::CheckAssignmentConstraints().
Return true if the Expr is block type.
Definition at line 8316 of file SemaExpr.cpp.
References clang::SemaBase::Diag(), E, clang::Expr::getExprLoc(), and clang::Type::isBlockPointerType().
Referenced by clang::Sema::CheckConditionalOperands().
|
static |
Definition at line 13759 of file SemaExpr.cpp.
References clang::Sema::CheckPlaceholderExpr(), clang::Sema::DefaultFunctionArrayLvalueConversion(), clang::Sema::DiagnoseCommaOperator(), clang::Sema::DiagnoseUnusedExprResult(), clang::ActionResult< PtrTy, Compress >::get(), clang::Sema::getDiagnostics(), clang::Sema::getLangOpts(), clang::Expr::getType(), clang::Sema::IgnoredValueConversions(), clang::DiagnosticsEngine::isIgnored(), clang::ActionResult< PtrTy, Compress >::isInvalid(), clang::Type::isVoidType(), Loc, and clang::Sema::RequireCompleteType().
Referenced by clang::Sema::CreateBuiltinBinOp().
|
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 17765 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(), Loc, clang::FunctionDecl::parameters(), clang::Sema::RequireCompleteType(), and clang::T.
Referenced by clang::Sema::MarkFunctionReferenced().
|
static |
Return false if the condition expression is valid, true otherwise.
Definition at line 7881 of file SemaExpr.cpp.
References clang::SemaBase::Diag(), clang::Sema::getLangOpts(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Type::isFloatingType(), and clang::Type::isScalarType().
Referenced by clang::Sema::CheckConditionalOperands().
|
static |
Return the resulting type when the operands are both block pointers.
Definition at line 8046 of file SemaExpr.cpp.
References checkConditionalPointerCompatibility(), clang::Sema::Context, clang::SemaBase::Diag(), clang::ActionResult< PtrTy, Compress >::get(), clang::ASTContext::getPointerType(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Sema::ImpCastExprToType(), clang::Type::isBlockPointerType(), clang::Type::isVoidPointerType(), Loc, and clang::ASTContext::VoidTy.
Referenced by clang::Sema::CheckConditionalOperands().
|
static |
Return false if the NullExpr can be promoted to PointerTy, true otherwise.
Definition at line 7902 of file SemaExpr.cpp.
References clang::Sema::Context, clang::ActionResult< PtrTy, Compress >::get(), clang::Sema::ImpCastExprToType(), clang::Type::isAnyPointerType(), clang::Type::isBlockPointerType(), clang::Expr::isNullPointerConstant(), and clang::Expr::NPC_ValueDependentIsNull.
Referenced by clang::Sema::CheckConditionalOperands().
|
static |
Return the resulting type when the operands are both pointers.
Definition at line 8072 of file SemaExpr.cpp.
References clang::Type::castAs(), checkConditionalPointerCompatibility(), clang::Sema::Context, clang::ActionResult< PtrTy, Compress >::get(), getPointeeType(), clang::ASTContext::getPointerType(), clang::ASTContext::getQualifiedType(), clang::QualType::getQualifiers(), clang::Expr::getType(), clang::Sema::ImpCastExprToType(), clang::Type::isIncompleteOrObjectType(), clang::Type::isVoidType(), and Loc.
Referenced by clang::Sema::CheckConditionalOperands().
|
static |
Checks compatibility between two pointers and return the resulting type.
Definition at line 7915 of file SemaExpr.cpp.
References clang::Type::castAs(), clang::Sema::Context, clang::Default, clang::SemaBase::Diag(), clang::ActionResult< PtrTy, Compress >::get(), clang::Qualifiers::getAddressSpace(), clang::ASTContext::getAddrSpaceQualType(), clang::Type::getAs(), clang::ASTContext::getBlockPointerType(), clang::ASTContext::getCommonSugaredType(), clang::Qualifiers::getCVRQualifiers(), clang::Sema::getLangOpts(), clang::Type::getPointeeType(), getPointeeType(), clang::ASTContext::getPointerType(), clang::ASTContext::getQualifiedType(), clang::QualType::getQualifiers(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::QualType::getUnqualifiedType(), clang::ASTContext::hasSameType(), clang::Sema::ImpCastExprToType(), clang::Qualifiers::isAddressSpaceSupersetOf(), clang::QualType::isNull(), Loc, clang::ASTContext::mergeTypes(), clang::Qualifiers::removeAddressSpace(), clang::Qualifiers::removeCVRQualifiers(), clang::Qualifiers::setAddressSpace(), clang::ASTContext::VoidTy, and clang::QualType::withCVRQualifiers().
Referenced by checkConditionalBlockPointerCompatibility(), and checkConditionalObjectPointersCompatibility().
|
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 3143 of file SemaExpr.cpp.
References D, clang::SemaBase::Diag(), clang::Decl::isInvalidDecl(), and Loc.
Referenced by clang::Sema::BuildDeclarationNameExpr().
|
static |
Definition at line 6229 of file SemaExpr.cpp.
References clang::Sema::CheckEnableIf(), clang::SemaBase::Diag(), and clang::Sema::TooManyArguments().
Referenced by clang::Sema::BuildCallExpr().
|
static |
Check that the usual arithmetic conversions can be performed on this pair of expressions that might be of enumeration type.
Definition at line 1486 of file SemaExpr.cpp.
References clang::Sema::ACK_Comparison, clang::Sema::ACK_CompAssign, clang::Sema::ACK_Conditional, clang::Type::castAs(), clang::Sema::Context, clang::SemaBase::Diag(), clang::EnumType::getDecl(), clang::Expr::getEnumCoercedType(), clang::Sema::getLangOpts(), clang::Stmt::getSourceRange(), clang::TagDecl::hasNameForLinkage(), clang::ASTContext::hasSameUnqualifiedType(), int, clang::Type::isFloatingType(), clang::Type::isUnscopedEnumerationType(), and Loc.
Referenced by clang::Sema::UsualArithmeticConversions().
|
static |
Definition at line 4147 of file SemaExpr.cpp.
References clang::SemaBase::Diag(), clang::getTraitSpelling(), clang::Type::isFunctionType(), clang::Type::isVoidType(), clang::Sema::LangOpts, Loc, and clang::T.
Referenced by clang::Sema::CheckUnaryExprOrTypeTraitOperand().
Definition at line 11685 of file SemaExpr.cpp.
Referenced by diagnoseTautologicalComparison().
|
static |
CheckForModifiableLvalue - Verify that E is a modifiable lvalue.
If not, emit an error and return true. If so, return false.
Definition at line 13376 of file SemaExpr.cpp.
References clang::Sema::CheckShadowingDeclModification(), clang::Sema::Context, clang::SemaBase::Diag(), DiagnoseConstAssignment(), DiagnoseRecursiveConstFields(), E, 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::ObjCMethodDecl::isClassMethod(), clang::Expr::isModifiableLvalue(), IsReadonlyMessage(), isReferenceToNonConstCapture(), Loc, 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().
Definition at line 558 of file SemaExpr.cpp.
References clang::Sema::Context, clang::Sema::DiagRuntimeBehavior(), E, clang::Expr::IgnoreParenCasts(), clang::isTargetAddressSpace(), clang::Expr::NPC_ValueDependentIsNotNull, clang::SemaBase::PDiag(), and clang::toTargetAddressSpace().
Referenced by clang::Sema::CheckAssignmentOperands(), clang::Sema::DefaultLvalueConversion(), and clang::InitializationSequence::Perform().
|
static |
Definition at line 13504 of file SemaExpr.cpp.
References clang::SemaBase::Diag(), clang::Type::getAs(), clang::MemberExpr::getBase(), clang::ObjCIvarRefExpr::getBase(), clang::Decl::getCanonicalDecl(), clang::DeclRefExpr::getDecl(), clang::ObjCIvarRefExpr::getDecl(), clang::Expr::getExprLoc(), clang::MemberExpr::getMemberDecl(), clang::ValueDecl::getType(), clang::Expr::IgnoreImpCasts(), clang::Sema::inTemplateInstantiation(), clang::SourceLocation::isInvalid(), clang::SourceLocation::isMacroID(), clang::Sema::isUnevaluatedContext(), clang::QualType::isVolatileQualified(), and Loc.
Referenced by BuildOverloadedBinOp(), and clang::Sema::CheckAssignmentOperands().
|
static |
CheckIncrementDecrementOperand - unlike most "Check" methods, this routine doesn't need to call UsualUnaryConversions or UsualArithmeticConversions.
Definition at line 13795 of file SemaExpr.cpp.
References clang::AltiVecBool, clang::Type::castAs(), checkArithmeticIncompletePointerType(), checkArithmeticOnObjCPointer(), checkArithmeticOpPointerOperand(), CheckForModifiableLvalue(), CheckIncrementDecrementOperand(), clang::Sema::CheckPlaceholderExpr(), clang::SemaBase::Diag(), clang::ActionResult< PtrTy, Compress >::get(), clang::Type::getAs(), clang::VectorType::getElementType(), clang::Sema::getLangOpts(), clang::Expr::getObjectKind(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::QualType::getUnqualifiedType(), clang::VectorType::getVectorKind(), int, clang::Type::isAnyComplexType(), clang::Type::isBooleanType(), clang::Type::isEnumeralType(), clang::Type::isIntegerType(), clang::ActionResult< PtrTy, Compress >::isInvalid(), clang::QualType::isNull(), clang::Type::isObjCObjectPointerType(), clang::Type::isPlaceholderType(), clang::Type::isPointerType(), clang::Type::isRealType(), clang::Type::isVectorType(), clang::QualType::isVolatileQualified(), clang::VK_LValue, and clang::VK_PRValue.
Referenced by CheckIncrementDecrementOperand(), and clang::Sema::CreateBuiltinUnaryOp().
|
static |
CheckIndirectionOperand - Type check unary indirection (prefix '*').
Definition at line 14265 of file SemaExpr.cpp.
References clang::Sema::CheckCompatibleReinterpretCast(), CheckIndirectionOperand(), clang::Sema::CheckPlaceholderExpr(), clang::SemaBase::Diag(), clang::ActionResult< PtrTy, Compress >::get(), clang::Type::getAs(), clang::Sema::getLangOpts(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Expr::IgnoreParenCasts(), clang::ActionResult< PtrTy, Compress >::isInvalid(), clang::Sema::isUnevaluatedContext(), clang::Result, clang::Sema::UsualUnaryConversions(), clang::VK_LValue, and clang::VK_PRValue.
Referenced by CheckIndirectionOperand(), and clang::Sema::CreateBuiltinUnaryOp().
|
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 14463 of file SemaExpr.cpp.
References Diag(), clang::SemaBase::Diag(), clang::ActionResult< PtrTy, Compress >::get(), clang::Sema::getLangOpts(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Expr::IgnoreParenCasts(), and clang::Type::isObjCObjectPointerType().
Referenced by clang::Sema::CreateBuiltinBinOp().
|
static |
checkObjCPointerTypesForAssignment - Compares two objective-c pointer types for assignment compatibility.
Definition at line 9048 of file SemaExpr.cpp.
References clang::Type::castAs(), clang::Sema::Compatible, clang::Sema::CompatiblePointerDiscardsQualifiers, clang::Sema::Context, getPointeeType(), clang::Sema::IncompatibleObjCQualifiedId, clang::Sema::IncompatiblePointer, clang::QualType::isAtLeastAsQualifiedAs(), clang::QualType::isCanonical(), clang::Type::isObjCBuiltinType(), clang::Type::isObjCClassType(), clang::Type::isObjCQualifiedClassType(), clang::Type::isObjCQualifiedIdType(), and clang::ASTContext::typesAreCompatible().
Referenced by clang::Sema::CheckAssignmentConstraints().
|
static |
Definition at line 4177 of file SemaExpr.cpp.
References clang::ObjCRuntime::allowsSizeofAlignof(), clang::SemaBase::Diag(), clang::Type::isObjCObjectType(), clang::Sema::LangOpts, Loc, clang::LangOptions::ObjCRuntime, and clang::T.
Referenced by clang::Sema::CheckUnaryExprOrTypeTraitOperand().
|
static |
Return false if this is a valid OpenCL condition vector.
Definition at line 8230 of file SemaExpr.cpp.
References clang::SemaBase::Diag(), clang::Type::getAs(), clang::VectorType::getElementType(), clang::Stmt::getSourceRange(), clang::Expr::getType(), and clang::Type::isIntegerType().
Referenced by OpenCLCheckVectorConditional().
|
static |
Return false if the first expression is not an integer and the second expression is not a pointer, true otherwise.
Definition at line 8111 of file SemaExpr.cpp.
References clang::SemaBase::Diag(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Sema::ImpCastExprToType(), clang::Type::isPointerType(), and Loc.
Referenced by clang::Sema::CheckConditionalOperands().
|
static |
Definition at line 8845 of file SemaExpr.cpp.
References clang::Sema::Compatible, clang::Sema::CompatiblePointerDiscardsQualifiers, clang::Qualifiers::compatiblyIncludes(), clang::Qualifiers::compatiblyIncludesObjCLifetime(), clang::Sema::Context, clang::Sema::Diags, clang::Sema::FunctionVoidPointer, clang::Qualifiers::getAddressSpace(), clang::ASTContext::getCorrespondingUnsignedType(), clang::Sema::getLangOpts(), clang::Qualifiers::getObjCLifetime(), clang::Type::hasSignedIntegerRepresentation(), clang::Sema::IncompatibleFunctionPointer, clang::Sema::IncompatibleFunctionPointerStrict, clang::Sema::IncompatibleNestedPointerAddressSpaceMismatch, clang::Sema::IncompatibleNestedPointerQualifiers, clang::Sema::IncompatiblePointer, clang::Sema::IncompatiblePointerDiscardsQualifiers, clang::Sema::IncompatiblePointerSign, clang::Qualifiers::isAddressSpaceSupersetOf(), clang::QualType::isCanonical(), clang::Type::isCharType(), clang::Sema::IsFunctionConversion(), clang::Type::isFunctionPointerType(), clang::Type::isFunctionType(), clang::DiagnosticsEngine::isIgnored(), clang::Type::isIncompleteOrObjectType(), IsInvalidCmseNSCallConversion(), clang::Sema::IsInvalidSMECallConversion(), clang::Type::isVoidType(), Loc, clang::Qualifiers::removeObjCLifetime(), clang::ASTContext::typesAreCompatible(), clang::ASTContext::UnsignedCharTy, clang::Qualifiers::withoutObjCGCAttr(), and clang::Qualifiers::withoutObjCLifetime().
Referenced by clang::Sema::CheckAssignmentConstraints().
|
static |
Definition at line 4132 of file SemaExpr.cpp.
References clang::Sema::checkPointerAuthEnabled(), clang::SemaBase::Diag(), clang::Type::isFunctionPointerType(), clang::Type::isFunctionReferenceType(), clang::Type::isFunctionType(), clang::Type::isMemberFunctionPointerType(), Loc, and clang::T.
Referenced by clang::Sema::CheckUnaryExprOrTypeTraitOperand().
|
static |
Definition at line 4702 of file SemaExpr.cpp.
References clang::Sema::CheckPlaceholderExpr(), CheckRealImagOperand(), clang::Sema::Context, clang::Sema::DefaultLvalueConversion(), clang::ASTContext::DependentTy, clang::SemaBase::Diag(), clang::ActionResult< PtrTy, Compress >::get(), clang::ActionResult< PtrTy, Compress >::isInvalid(), Loc, clang::OK_Ordinary, and V.
Referenced by CheckRealImagOperand(), and clang::Sema::CreateBuiltinUnaryOp().
|
static |
Definition at line 11327 of file SemaExpr.cpp.
References clang::Type::castAs(), clang::Sema::Context, clang::SemaBase::Diag(), clang::ASTContext::BuiltinVectorTypeInfo::EC, clang::ActionResult< PtrTy, Compress >::get(), clang::Sema::getASTContext(), clang::ASTContext::getBuiltinVectorTypeInfo(), clang::ASTContext::getScalableVectorType(), clang::Stmt::getSourceRange(), clang::Type::getSveEltType(), clang::Expr::getType(), clang::ASTContext::getTypeSize(), clang::Sema::ImpCastExprToType(), clang::ActionResult< PtrTy, Compress >::isInvalid(), clang::BuiltinType::isSVEBool(), clang::Type::isSveVLSBuiltinType(), Loc, and clang::Sema::UsualUnaryConversions().
Referenced by clang::Sema::CheckShiftOperands().
|
static |
Definition at line 11870 of file SemaExpr.cpp.
References castKindToImplicitConversionKind(), clang::Sema::Context, clang::SemaBase::Diag(), E, clang::APValue::getAsString(), clang::Stmt::getBeginLoc(), clang::StandardConversionSequence::getNarrowingKind(), clang::NK_Constant_Narrowing, clang::NK_Dependent_Narrowing, clang::NK_Not_Narrowing, clang::NK_Type_Narrowing, clang::NK_Variable_Narrowing, clang::StandardConversionSequence::Second, clang::StandardConversionSequence::setAsIdentityConversion(), and clang::StandardConversionSequence::setToType().
Referenced by checkArithmeticOrEnumeralThreeWayCompare().
|
static |
Definition at line 4102 of file SemaExpr.cpp.
References clang::SemaBase::Diag(), clang::Type::isArithmeticType(), clang::Type::isIncompleteType(), clang::Type::isVectorType(), clang::Type::isVoidType(), Loc, and clang::T.
Referenced by clang::Sema::CheckUnaryExprOrTypeTraitOperand().
|
static |
Definition at line 4120 of file SemaExpr.cpp.
References clang::SemaBase::Diag(), clang::Type::isSizelessVectorType(), clang::Type::isVectorType(), Loc, and clang::T.
Referenced by clang::Sema::CheckUnaryExprOrTypeTraitOperand().
|
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 8250 of file SemaExpr.cpp.
References clang::Sema::Context, clang::SemaBase::Diag(), clang::Type::getAs(), clang::VectorType::getElementType(), clang::VectorType::getNumElements(), and clang::ASTContext::getTypeSize().
Referenced by OpenCLCheckVectorConditional().
|
static |
Return the resulting type when a vector is shifted by a scalar or vector shift amount.
Definition at line 11233 of file SemaExpr.cpp.
References clang::Sema::Context, clang::SemaBase::Diag(), clang::ActionResult< PtrTy, Compress >::get(), clang::Type::getAs(), clang::VectorType::getElementType(), clang::ASTContext::getExtVectorType(), clang::VectorType::getNumElements(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::ASTContext::getTypeSize(), clang::Sema::ImpCastExprToType(), clang::Type::isExtVectorBoolType(), clang::ActionResult< PtrTy, Compress >::isInvalid(), clang::Type::isVectorType(), clang::Sema::LangOpts, Loc, and clang::Sema::UsualUnaryConversions().
Referenced by clang::Sema::CheckShiftOperands().
|
static |
Compute the nullability of a conditional expression.
Definition at line 8652 of file SemaExpr.cpp.
References clang::ASTContext::getAttributedType(), clang::Type::getNullability(), clang::AttributedType::getNullabilityAttrKind(), clang::QualType::getSingleStepDesugaredType(), clang::Type::isAnyPointerType(), clang::NonNull, clang::Nullable, clang::NullableResult, and clang::Unspecified.
Referenced by clang::Sema::ActOnConditionalOp().
|
static |
Constructs a transparent union from an expression that is used to initialize the transparent union.
Definition at line 9485 of file SemaExpr.cpp.
References clang::C, E, clang::ActionResult< PtrTy, Compress >::get(), clang::Initializer, and clang::VK_PRValue.
Referenced by clang::Sema::CheckTransparentUnionArgumentConstraints().
|
static |
Definition at line 14519 of file SemaExpr.cpp.
References clang::Type::castAs(), convertVector(), clang::BinaryOperator::Create(), clang::CompoundAssignOperator::Create(), clang::ASTContext::FloatTy, clang::ActionResult< PtrTy, Compress >::get(), clang::Sema::getASTContext(), clang::VectorType::getElementType(), clang::Sema::GetSignedVectorType(), clang::Expr::getType(), clang::ASTContext::HalfTy, isVector(), and clang::ASTContext::ShortTy.
Referenced by clang::Sema::CreateBuiltinBinOp().
|
static |
Returns false if the pointers are converted to a composite type, true otherwise.
Definition at line 11494 of file SemaExpr.cpp.
References diagnoseDistinctPointerComparison(), clang::Sema::FindCompositePointerType(), clang::ActionResult< PtrTy, Compress >::get(), clang::Expr::getType(), clang::Sema::InvalidOperands(), clang::Type::isAnyPointerType(), clang::Type::isMemberPointerType(), clang::Type::isPointerType(), Loc, and clang::T.
Referenced by clang::Sema::CheckCompareOperands().
|
inlinestatic |
Definition at line 14365 of file SemaExpr.cpp.
Referenced by clang::Sema::ActOnUnaryOp().
|
static |
Definition at line 3466 of file SemaExpr.cpp.
Referenced by clang::Sema::BuildPredefinedExpr().
|
static |
Convert vector E to a vector with the same number of elements but different element type.
Definition at line 9868 of file SemaExpr.cpp.
References clang::Sema::Context, E, clang::Type::getAs(), clang::ASTContext::getExtVectorType(), clang::Expr::getType(), clang::ASTContext::getVectorType(), clang::Sema::ImpCastExprToType(), clang::Type::isExtVectorType(), and clang::Type::isIntegerType().
Referenced by convertHalfVecBinOp(), and clang::Sema::CreateBuiltinUnaryOp().
|
static |
Definition at line 14552 of file SemaExpr.cpp.
References clang::Sema::Context, clang::Sema::CorrectDelayedTyposInExpr(), D, E, clang::ExprError(), clang::ActionResult< PtrTy, Compress >::get(), getDeclFromExpr(), and clang::ASTContext::isDependenceAllowed().
Referenced by clang::Sema::BuildBinOp(), and clang::Sema::CreateBuiltinBinOp().
|
static |
Definition at line 14995 of file SemaExpr.cpp.
References clang::SemaBase::Diag(), clang::SemaBase::PDiag(), and SuggestParentheses().
Referenced by DiagnoseBinOpPrecedence().
|
static |
Diagnose invalid operand for address of operations.
Type | The type of operand which cannot have its address taken. |
Definition at line 13957 of file SemaExpr.cpp.
References clang::SemaBase::Diag(), E, clang::Stmt::getSourceRange(), and Loc.
Referenced by clang::Sema::CheckAddressOfOperand().
|
static |
Diagnose invalid arithmetic on a function pointer.
Definition at line 10642 of file SemaExpr.cpp.
References clang::SemaBase::Diag(), clang::Sema::getLangOpts(), Loc, and Pointer.
Referenced by checkArithmeticBinOpPointerOperands(), and checkArithmeticOpPointerOperand().
|
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 10597 of file SemaExpr.cpp.
References clang::SemaBase::Diag(), clang::Sema::getLangOpts(), Loc, and Pointer.
Referenced by clang::Sema::CheckAdditionOperands(), and clang::Sema::CheckSubtractionOperands().
|
static |
Diagnose invalid arithmetic on two function pointers.
Definition at line 10626 of file SemaExpr.cpp.
References clang::Sema::Context, clang::SemaBase::Diag(), clang::Sema::getLangOpts(), clang::Type::getPointeeType(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::ASTContext::hasSameUnqualifiedType(), clang::Type::isAnyPointerType(), and Loc.
Referenced by checkArithmeticBinOpPointerOperands().
|
static |
Diagnose invalid arithmetic on two void pointers.
Definition at line 10574 of file SemaExpr.cpp.
References clang::SemaBase::Diag(), clang::Sema::getLangOpts(), clang::Stmt::getSourceRange(), and Loc.
Referenced by checkArithmeticBinOpPointerOperands().
|
static |
Diagnose invalid arithmetic on a void pointer.
Definition at line 10584 of file SemaExpr.cpp.
References clang::SemaBase::Diag(), clang::Sema::getLangOpts(), Loc, and Pointer.
Referenced by checkArithmeticBinOpPointerOperands(), and checkArithmeticOpPointerOperand().
|
static |
Definition at line 10484 of file SemaExpr.cpp.
References clang::Sema::Context, clang::Sema::DiagRuntimeBehavior(), clang::Expr::EvaluateAsInt(), clang::ActionResult< PtrTy, Compress >::get(), clang::APValue::getInt(), clang::Stmt::getSourceRange(), clang::Expr::isValueDependent(), Loc, clang::SemaBase::PDiag(), and clang::Expr::EvalResult::Val.
Referenced by clang::Sema::CheckMultiplyDivideOperands(), and clang::Sema::CheckRemainderOperands().
|
static |
Definition at line 11132 of file SemaExpr.cpp.
References clang::Sema::Context, clang::SemaBase::Diag(), clang::Sema::DiagRuntimeBehavior(), clang::Expr::EvaluateAsInt(), clang::ActionResult< PtrTy, Compress >::get(), clang::ASTContext::getFixedPointSemantics(), clang::APValue::getInt(), clang::ASTContext::getIntWidth(), clang::Sema::getLangOpts(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::ASTContext::getTypeSize(), clang::Type::hasUnsignedIntegerRepresentation(), clang::Type::isBitIntType(), clang::Type::isFixedPointType(), clang::LangOptions::isSignedOverflowDefined(), clang::Expr::isValueDependent(), Loc, clang::SemaBase::PDiag(), clang::Result, and clang::Expr::EvalResult::Val.
Referenced by clang::Sema::CheckShiftOperands().
|
static |
DiagnoseBinOpPrecedence - Emit warnings for expressions with tricky precedence.
Definition at line 15037 of file SemaExpr.cpp.
References DiagnoseAdditionInShift(), DiagnoseBitwiseOpInBitwiseOp(), DiagnoseBitwisePrecedence(), DiagnoseLogicalAndInLogicalOrLHS(), DiagnoseLogicalAndInLogicalOrRHS(), DiagnoseShiftCompare(), clang::BinaryOperator::getOpcodeStr(), clang::Expr::getType(), clang::BinaryOperator::isBitwiseOp(), clang::BinaryOperator::isComparisonOp(), clang::Type::isIntegralType(), clang::SourceLocation::isMacroID(), and clang::Self.
Referenced by clang::Sema::ActOnBinOp().
|
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 14980 of file SemaExpr.cpp.
References clang::SemaBase::Diag(), clang::BinaryOperator::getOpcodeStr(), clang::SemaBase::PDiag(), and SuggestParentheses().
Referenced by DiagnoseBinOpPrecedence().
|
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 14889 of file SemaExpr.cpp.
References clang::Stmt::getBeginLoc(), clang::Stmt::getEndLoc(), clang::BinaryOperator::getLHS(), clang::BinaryOperator::getOpcodeStr(), clang::BinaryOperator::getRHS(), clang::BinaryOperator::isBitwiseOp(), clang::BinaryOperator::isComparisonOp(), clang::Self, and SuggestParentheses().
Referenced by DiagnoseBinOpPrecedence().
|
static |
Definition at line 5996 of file SemaExpr.cpp.
References clang::SemaBase::Diag(), clang::TypeLoc::getAs(), clang::Decl::getLocation(), clang::TypeSourceInfo::getTypeLoc(), and clang::DeclaratorDecl::getTypeSourceInfo().
Referenced by clang::Sema::CheckStaticArrayArgument().
|
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 8618 of file SemaExpr.cpp.
References clang::Condition, ExprLooksBoolean(), clang::Stmt::getBeginLoc(), clang::Stmt::getEndLoc(), clang::BinaryOperator::getOpcodeStr(), IsArithmeticBinaryExpr(), clang::BinaryOperator::isBitwiseOp(), clang::Self, and SuggestParentheses().
Referenced by clang::Sema::ActOnConditionalOp().
|
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 13187 of file SemaExpr.cpp.
References ConstFunction, ConstMember, ConstMethod, ConstUnknown, ConstVariable, clang::SemaBase::Diag(), E, clang::SourceRange::getBegin(), clang::Sema::getFunctionLevelDeclContext(), clang::Decl::getLocation(), clang::FunctionDecl::getReturnType(), clang::FunctionDecl::getReturnTypeSourceRange(), clang::Stmt::getSourceRange(), clang::Expr::IgnoreImplicit(), clang::Expr::IgnoreParenImpCasts(), IsTypeModifiable(), and Loc.
Referenced by CheckForModifiableLvalue(), and DiagnoseRecursiveConstFields().
|
static |
Definition at line 583 of file SemaExpr.cpp.
References clang::Sema::Context, clang::FixItHint::CreateInsertion(), clang::FixItHint::CreateReplacement(), clang::SemaBase::Diag(), clang::IdentifierTable::get(), clang::Type::getAs(), clang::DeclarationName::getAsIdentifierInfo(), clang::ObjCIvarRefExpr::getBase(), clang::ObjCIvarRefExpr::getBeginLoc(), clang::ObjCIvarRefExpr::getDecl(), clang::NamedDecl::getDeclName(), clang::ObjCIvarRefExpr::getEndLoc(), clang::Stmt::getEndLoc(), clang::Expr::getExprLoc(), clang::Decl::getLocation(), clang::ObjCIvarRefExpr::getLocation(), clang::Sema::getLocForEndOfToken(), clang::ObjCIvarRefExpr::getOpLoc(), clang::Type::getPointeeType(), clang::ObjCInterfaceDecl::getSuperClass(), clang::ASTContext::Idents, clang::ObjCIvarRefExpr::isArrow(), clang::ObjCInterfaceDecl::ivar_begin(), clang::Sema::LookupOrdinaryName, clang::Sema::LookupSingleName(), clang::Member, and clang::Sema::TUScope.
Referenced by clang::Sema::CreateBuiltinBinOp(), and clang::Sema::DefaultLvalueConversion().
|
static |
Diagnose bad pointer comparisons.
Definition at line 11483 of file SemaExpr.cpp.
References clang::SemaBase::Diag(), clang::ActionResult< PtrTy, Compress >::get(), clang::Stmt::getSourceRange(), clang::Expr::getType(), and Loc.
Referenced by clang::Sema::CheckCompareOperands(), and convertPointersToCompositeType().
|
static |
Definition at line 10436 of file SemaExpr.cpp.
References clang::Sema::Context, clang::SemaBase::Diag(), clang::ASTContext::getAsArrayType(), clang::ASTContext::getBaseElementType(), clang::Type::getPointeeType(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::ASTContext::getTypeSize(), clang::ASTContext::hasSameUnqualifiedType(), clang::Expr::IgnoreParens(), clang::Type::isCharType(), clang::Type::isDependentType(), clang::Type::isPointerType(), clang::Type::isReferenceType(), and Loc.
Referenced by clang::Sema::CheckMultiplyDivideOperands().
Definition at line 6339 of file SemaExpr.cpp.
References clang::Call, clang::FixItHint::CreateInsertion(), clang::SemaBase::Diag(), E, clang::FunctionDecl::getBuiltinID(), clang::DeclRefExpr::getLocation(), clang::NamedDecl::getQualifiedNameAsString(), clang::DeclRefExpr::getQualifier(), and clang::SourceLocation::isValid().
Referenced by clang::Sema::ActOnCallExpr().
|
static |
Definition at line 11523 of file SemaExpr.cpp.
References clang::SemaBase::Diag(), clang::ActionResult< PtrTy, Compress >::get(), clang::Stmt::getSourceRange(), clang::Expr::getType(), and Loc.
Referenced by clang::Sema::CheckCompareOperands().
|
static |
Look for '&&' in the left hand of a '||' expr.
Definition at line 14944 of file SemaExpr.cpp.
References EmitDiagnosticForLogicalAndInLogicalOr().
Referenced by DiagnoseBinOpPrecedence().
|
static |
Look for '&&' in the right hand of a '||' expr.
Definition at line 14965 of file SemaExpr.cpp.
References EmitDiagnosticForLogicalAndInLogicalOr().
Referenced by DiagnoseBinOpPrecedence().
|
static |
Warns on !x < y, !x & y where !(x < y), !(x & y) was probably intended.
Definition at line 11643 of file SemaExpr.cpp.
References clang::FixItHint::CreateInsertion(), clang::SemaBase::Diag(), clang::ActionResult< PtrTy, Compress >::get(), clang::Stmt::getBeginLoc(), clang::Stmt::getEndLoc(), clang::Sema::getLocForEndOfToken(), clang::UnaryOperator::getOpcode(), clang::UnaryOperator::getOperatorLoc(), clang::UnaryOperator::getSubExpr(), clang::Expr::IgnoreImpCasts(), clang::SourceLocation::isInvalid(), clang::Expr::isKnownToHaveBooleanValue(), and Loc.
Referenced by clang::Sema::CheckBitwiseOperands(), and clang::Sema::CheckCompareOperands().
|
static |
Definition at line 11593 of file SemaExpr.cpp.
References clang::SemaObjC::CheckLiteralKind(), clang::FixItHint::CreateInsertion(), clang::FixItHint::CreateReplacement(), clang::SemaBase::Diag(), clang::ActionResult< PtrTy, Compress >::get(), clang::Sema::getASTContext(), clang::Stmt::getBeginLoc(), clang::CharSourceRange::getCharRange(), clang::Stmt::getEndLoc(), clang::Sema::getLocForEndOfToken(), hasIsEqualMethod(), clang::BinaryOperator::isEqualityOp(), isObjCObjectLiteral(), clang::SemaObjC::LK_Block, clang::SemaObjC::LK_None, clang::SemaObjC::LK_String, Loc, clang::Expr::NPC_ValueDependentIsNotNull, clang::Sema::ObjC(), and clang::Other.
Referenced by clang::Sema::CheckCompareOperands().
|
static |
Emit error when two pointers are incompatible.
Definition at line 10844 of file SemaExpr.cpp.
References clang::SemaBase::Diag(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Type::isAnyPointerType(), and Loc.
Referenced by clang::Sema::CheckSubtractionOperands().
|
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 13353 of file SemaExpr.cpp.
References DiagnoseConstAssignment(), DiagnoseRecursiveConstFields(), E, clang::Type::getAs(), clang::QualType::getCanonicalType(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Type::isRecordType(), Loc, OEK_LValue, OEK_Member, OEK_Variable, and Range.
|
static |
Definition at line 13312 of file SemaExpr.cpp.
References clang::SemaBase::Diag(), clang::Type::getAs(), clang::QualType::getCanonicalType(), clang::QualType::isConstQualified(), Loc, NestedConstMember, and Range.
Referenced by CheckForModifiableLvalue(), and DiagnoseRecursiveConstFields().
|
static |
DiagnoseSelfAssignment - Emits a warning if a value is assigned to itself.
This warning suppressed in the event of macro expansions.
Definition at line 14421 of file SemaExpr.cpp.
References clang::FixItHint::CreateInsertion(), Diag(), clang::SemaBase::Diag(), clang::Type::getAs(), clang::DeclRefExpr::getBeginLoc(), clang::Decl::getCanonicalDecl(), clang::DeclRefExpr::getDecl(), clang::DeclRefExpr::getLocation(), clang::Sema::getSelfAssignmentClassMemberCandidate(), clang::Stmt::getSourceRange(), clang::ValueDecl::getType(), clang::Expr::getType(), clang::Expr::IgnoreParenImpCasts(), clang::Sema::inTemplateInstantiation(), clang::SourceLocation::isInvalid(), clang::SourceLocation::isMacroID(), clang::Sema::isUnevaluatedContext(), and clang::QualType::isVolatileQualified().
Referenced by BuildOverloadedBinOp(), and clang::Sema::CreateBuiltinBinOp().
|
static |
Definition at line 15009 of file SemaExpr.cpp.
References clang::SemaBase::Diag(), clang::CallExpr::getArg(), clang::Stmt::getBeginLoc(), clang::CallExpr::getDirectCallee(), clang::Stmt::getEndLoc(), clang::CXXOperatorCallExpr::getOperatorLoc(), clang::FunctionDecl::getOverloadedOperator(), clang::CXXOperatorCallExpr::getSourceRange(), clang::Stmt::getSourceRange(), clang::FunctionDecl::isOverloadedOperator(), clang::SemaBase::PDiag(), and SuggestParentheses().
Referenced by DiagnoseBinOpPrecedence().
|
static |
Emit a warning when adding a char literal to a string.
Definition at line 10793 of file SemaExpr.cpp.
References clang::ASTContext::CharTy, clang::FixItHint::CreateInsertion(), clang::FixItHint::CreateReplacement(), clang::Stmt::getBeginLoc(), clang::ASTContext::getCharWidth(), clang::Stmt::getEndLoc(), clang::Type::getPointeeType(), clang::Expr::getType(), clang::CharacterLiteral::getValue(), clang::Expr::IgnoreImpCasts(), clang::Type::isAnyCharacterType(), clang::Type::isAnyPointerType(), clang::Type::isIntegerType(), and clang::Self.
Referenced by clang::Sema::CheckAdditionOperands().
|
static |
diagnoseStringPlusInt - Emit a warning when adding an integer to a string literal.
Definition at line 10763 of file SemaExpr.cpp.
References clang::FixItHint::CreateInsertion(), clang::FixItHint::CreateReplacement(), clang::Stmt::getBeginLoc(), clang::Stmt::getEndLoc(), clang::Expr::getType(), clang::Expr::IgnoreImpCasts(), clang::Type::isIntegralOrUnscopedEnumerationType(), clang::Expr::isValueDependent(), and clang::Self.
Referenced by clang::Sema::CheckAdditionOperands().
|
static |
Diagnose invalid subraction on a null pointer.
Definition at line 10609 of file SemaExpr.cpp.
References clang::Sema::DiagRuntimeBehavior(), clang::Sema::Diags, clang::Sema::getLangOpts(), clang::DiagnosticsEngine::getSuppressSystemWarnings(), clang::SourceManager::isInSystemMacro(), Loc, clang::SemaBase::PDiag(), Pointer, and clang::Sema::SourceMgr.
Referenced by clang::Sema::CheckSubtractionOperands().
|
static |
Diagnose some forms of syntactically-obvious tautological comparison.
Definition at line 11699 of file SemaExpr.cpp.
References checkForArray(), clang::Sema::Context, clang::SemaBase::Diag(), clang::Sema::DiagRuntimeBehavior(), clang::Stmt::getBeginLoc(), clang::Sema::getLangOpts(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Type::hasFloatingRepresentation(), clang::Expr::IgnoreParenCasts(), clang::Expr::IgnoreParenImpCasts(), clang::Sema::inTemplateInstantiation(), clang::Type::isArrayType(), clang::Type::isBlockPointerType(), clang::BinaryOperator::isEqualityOp(), clang::SourceLocation::isMacroID(), clang::Expr::isNullPointerConstant(), clang::Expr::isSameComparisonOperand(), clang::Type::isWebAssemblyTableType(), Loc, clang::Expr::NPC_ValueDependentIsNull, clang::SemaBase::PDiag(), and clang::Result.
Referenced by clang::Sema::CheckCompareOperands(), clang::Sema::CheckSizelessVectorCompareOperands(), and clang::Sema::CheckVectorCompareOperands().
|
static |
Definition at line 18210 of file SemaExpr.cpp.
References clang::Sema::CurContext, clang::SemaBase::Diag(), clang::Sema::getLangOpts(), clang::DeclContext::getParent(), and clang::DeclContext::isFunctionOrMethod().
Referenced by getParentOfCapturingContextOrNull(), isVariableCapturable(), and clang::Sema::tryCaptureVariable().
|
static |
Definition at line 20673 of file SemaExpr.cpp.
References clang::SemaBase::Diag(), E, clang::ExprError(), clang::Expr::getExprLoc(), clang::Stmt::getSourceRange(), and clang::Expr::IgnoreParenImpCasts().
Referenced by clang::Sema::CheckPlaceholderExpr().
|
static |
Definition at line 107 of file SemaExpr.cpp.
References D, clang::SemaBase::Diag(), clang::Decl::getAttr(), clang::SemaObjC::getCurObjCLexicalContext(), clang::Decl::hasAttr(), Loc, and clang::Sema::ObjC().
Referenced by clang::Sema::DiagnoseUseOfDecl().
|
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 161 of file SemaExpr.cpp.
References D, clang::SemaBase::Diag(), clang::Decl::getCanonicalDecl(), clang::Sema::getCurFunctionDecl(), clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::Sema::getSourceManager(), clang::Decl::hasAttr(), clang::Internal, clang::FunctionDecl::isInlined(), clang::SourceManager::isInMainFile(), Loc, and clang::Sema::MaybeSuggestAddingStaticToDecl().
Referenced by clang::Sema::DiagnoseUseOfDecl().
|
static |
Definition at line 12694 of file SemaExpr.cpp.
References clang::FixItHint::CreateReplacement(), clang::SemaBase::Diag(), clang::ActionResult< PtrTy, Compress >::get(), clang::CharSourceRange::getCharRange(), clang::Expr::getExprLoc(), clang::Sema::getLangOpts(), clang::Sema::getLocForEndOfToken(), clang::Sema::getPreprocessor(), clang::Sema::getSourceManager(), clang::Lexer::getSourceText(), clang::CharSourceRange::getTokenRange(), clang::Preprocessor::isMacroDefined(), clang::SourceLocation::isMacroID(), Loc, and toString().
Referenced by clang::Sema::CheckBitwiseOperands().
|
static |
Definition at line 19641 of file SemaExpr.cpp.
References DoMarkPotentialCapture(), E, clang::Decl::isInvalidDecl(), isOdrUseContext(), Loc, clang::SemaBase::SemaRef, clang::Decl::setReferenced(), clang::Sema::TryCapture_Implicit, and clang::Sema::tryCaptureVariable().
Referenced by MarkExprReferenced().
|
static |
Definition at line 19438 of file SemaExpr.cpp.
References clang::sema::LambdaScopeInfo::addPotentialCapture(), clang::sema::LambdaScopeInfo::CallOperator, clang::Sema::Context, clang::Sema::CurContext, E, clang::DeclContext::Encloses(), clang::Sema::getCurLambda(), clang::Decl::getDeclContext(), clang::ValueDecl::getPotentiallyDecomposedVarDecl(), clang::ValueDecl::getType(), clang::VarDecl::hasLocalStorage(), clang::Expr::IgnoreParens(), clang::DeclContext::isFunctionOrMethod(), clang::Type::isReferenceType(), clang::VarDecl::isUsableInConstantExpressions(), and clang::SemaBase::SemaRef.
Referenced by DoMarkBindingDeclReferenced(), and DoMarkVarDeclReferenced().
|
static |
Definition at line 19470 of file SemaExpr.cpp.
References clang::Sema::checkSpecializationVisibility(), clang::Sema::Context, DoMarkPotentialCapture(), E, clang::VarDecl::getMemberSpecializationInfo(), clang::VarDecl::getPointOfInstantiation(), clang::VarDecl::getTemplateSpecializationKind(), clang::MemberSpecializationInfo::getTemplateSpecializationKind(), clang::VarDecl::hasExternalStorage(), clang::Sema::InstantiateVariableDefinition(), clang::SourceLocation::isInvalid(), clang::Decl::isInvalidDecl(), clang::VarDecl::isLocalVarDeclOrParm(), isOdrUseContext(), isPotentiallyConstantEvaluatedContext(), clang::isTemplateInstantiation(), clang::Sema::isUnevaluatedContext(), clang::VarDecl::isUsableInConstantExpressions(), Iter, Loc, MarkVarDeclODRUsed(), clang::Sema::MaybeODRUseExprs, clang::VarDecl::mightBeUsableInConstantExpressions(), P, clang::Sema::PendingInstantiations, clang::Sema::RefsMinusAssignments, clang::Sema::runWithSufficientStackSpace(), clang::Sema::SavedPendingInstantiations, clang::SemaBase::SemaRef, clang::Decl::setReferenced(), clang::VarDecl::setTemplateSpecializationKind(), clang::TSK_ExplicitInstantiationDeclaration, clang::TSK_ImplicitInstantiation, and clang::TSK_Undeclared.
Referenced by MarkExprReferenced(), and clang::Sema::MarkVariableReferenced().
|
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 14932 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().
|
static |
Definition at line 2354 of file SemaExpr.cpp.
References clang::Sema::computeDeclContext(), clang::SemaBase::Diag(), clang::Sema::diagnoseTypo(), clang::TypoCorrection::getAsString(), clang::TypoCorrection::getCorrectionDeclAs(), clang::Sema::getLangOpts(), clang::CXXScopeSpec::getRange(), clang::CXXScopeSpec::isEmpty(), clang::SemaBase::PDiag(), and clang::TypoCorrection::WillReplaceSpecifier().
|
static |
Definition at line 6256 of file SemaExpr.cpp.
References clang::CXXRecordDecl::getCanonicalDecl(), clang::Sema::getFunctionLevelDeclContext(), clang::UnresolvedMemberExpr::getNamingClass(), clang::DeclContext::getParent(), and clang::CXXRecordDecl::isDerivedFrom().
Referenced by tryImplicitlyCaptureThisIfImplicitMemberFunctionAccessWithDependentArgs().
|
static |
Definition at line 17374 of file SemaExpr.cpp.
References clang::Call, clang::Sema::Context, clang::Expr::EvalStatus::Diag, clang::SemaBase::Diag(), clang::Sema::DiagnoseImmediateEscalatingReason(), clang::Expr::EvaluateAsConstantExpr(), clang::Sema::FailedImmediateInvocations, clang::FunctionalCast, clang::Sema::getASTContext(), clang::ConstantExpr::getBeginLoc(), clang::FullExpr::getSubExpr(), clang::Expr::IgnoreImplicit(), clang::Sema::InnermostDeclarationWithDelayedImmediateInvocations(), clang::FunctionDecl::isConsteval(), clang::FunctionDecl::isImmediateFunction(), clang::Decl::isInvalidDecl(), clang::ConstantExpr::MoveIntoResult(), clang::Note, clang::Result, clang::SemaBase::SemaRef, and clang::Expr::EvalResult::Val.
Referenced by HandleImmediateInvocations().
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 8597 of file SemaExpr.cpp.
References E, clang::Expr::getType(), clang::Expr::IgnoreParenImpCasts(), clang::Type::isBooleanType(), and clang::Type::isPointerType().
Referenced by DiagnoseConditionalPrecedence().
|
static |
Definition at line 19670 of file SemaExpr.cpp.
References clang::C, clang::Sema::CurContext, D, E, clang::Sema::FunctionScopes, clang::Type::getAs(), clang::Sema::getASTContext(), clang::Type::isDependentType(), and clang::SemaBase::SemaRef.
Referenced by MarkExprReferenced().
|
static |
Return true if this function has a calling convention that requires mangling in the size of the parameter pack.
Definition at line 17731 of file SemaExpr.cpp.
References clang::Type::castAs(), clang::CC_X86FastCall, clang::CC_X86StdCall, clang::CC_X86VectorCall, clang::Sema::Context, clang::Sema::getLangOpts(), clang::ASTContext::getTargetInfo(), clang::TargetInfo::getTriple(), clang::ValueDecl::getType(), and clang::FunctionDecl::isExternC().
Referenced by clang::Sema::MarkFunctionReferenced().
Definition at line 14504 of file SemaExpr.cpp.
References E.
Referenced by CorrectDelayedTyposInBinOp().
|
static |
Definition at line 4792 of file SemaExpr.cpp.
References clang::ASTContext::DependentTy, clang::Type::getAs(), clang::Type::getAsArrayTypeUnsafe(), clang::Expr::getType(), clang::Type::isIntegralOrUnscopedEnumerationType(), clang::Expr::isTypeDependent(), and clang::Result.
Referenced by clang::Sema::ActOnArraySubscriptExpr(), and clang::Sema::CreateBuiltinArraySubscriptExpr().
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 1400 of file SemaExpr.cpp.
References clang::Type::getAs().
Referenced by handleFixedPointConversion().
|
static |
Definition at line 18284 of file SemaExpr.cpp.
References clang::Sema::Diagnose, diagnoseUncapturableValueReferenceOrBinding(), clang::getLambdaAwareParentOfDeclContext(), clang::ValueDecl::getPotentiallyDecomposedVarDecl(), clang::VarDecl::hasLocalStorage(), clang::isLambdaCallOperator(), and Loc.
Referenced by clang::Sema::tryCaptureVariable().
|
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 1918 of file SemaExpr.cpp.
References clang::DeclContext::getParent().
Referenced by clang::Sema::BuildPredefinedExpr(), and clang::Sema::ExpandFunctionLocalPredefinedMacros().
|
static |
Definition at line 1894 of file SemaExpr.cpp.
References clang::Func, clang::FuncDName, clang::FuncSig, clang::Function, clang::LFuncSig, clang::LFunction, and clang::PrettyFunction.
Referenced by clang::Sema::ActOnPredefinedExpr(), and clang::Sema::ExpandFunctionLocalPredefinedMacros().
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:
FIXME: We don't recurse to the RHS of a comma, nor handle pointers to members.
Definition at line 13897 of file SemaExpr.cpp.
References E, clang::UnaryOperator::getOpcode(), getPrimaryDecl(), clang::Stmt::getStmtClass(), and clang::UnaryOperator::getSubExpr().
Referenced by clang::Sema::CheckAddressOfOperand(), and getPrimaryDecl().
|
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 1926 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().
|
static |
Handle arithmetic conversion with complex types.
Helper function of UsualArithmeticConversions()
Definition at line 1156 of file SemaExpr.cpp.
References clang::Sema::Context, clang::ASTContext::getFloatingTypeOrder(), handleComplexFloatConversion(), and handleComplexIntegerToFloatConversion().
Referenced by clang::Sema::UsualArithmeticConversions().
|
static |
Definition at line 1133 of file SemaExpr.cpp.
References clang::Type::castAs(), clang::Sema::Context, clang::ActionResult< PtrTy, Compress >::get(), clang::QualType::getCanonicalType(), clang::ASTContext::getComplexType(), clang::Sema::ImpCastExprToType(), and clang::Result.
Referenced by handleComplexConversion().
|
static |
Handle conversions with GCC complex int extension.
Helper function of UsualArithmeticConversions()
Definition at line 1354 of file SemaExpr.cpp.
References clang::Sema::Context, clang::ActionResult< PtrTy, Compress >::get(), clang::Type::getAsComplexIntegerType(), clang::ASTContext::getComplexType(), clang::ComplexType::getElementType(), and clang::Sema::ImpCastExprToType().
Referenced by clang::Sema::UsualArithmeticConversions().
|
static |
Convert complex integers to complex floats and real integers to real floats as required for complex arithmetic.
Helper function of UsualArithmeticConversions()
Definition at line 1105 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 - 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 1447 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().
|
static |
Handle arithmethic conversion with floating point types.
Helper function of UsualArithmeticConversions()
Definition at line 1211 of file SemaExpr.cpp.
References clang::Sema::Context, clang::ASTContext::FloatTy, clang::ActionResult< PtrTy, Compress >::get(), clang::ASTContext::getFloatingTypeOrder(), clang::Sema::getLangOpts(), handleIntToFloatConversion(), clang::Sema::ImpCastExprToType(), clang::Type::isFixedPointType(), clang::Type::isHalfType(), and clang::Type::isRealFloatingType().
Referenced by OpenCLArithmeticConversions(), and clang::Sema::UsualArithmeticConversions().
|
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 17513 of file SemaExpr.cpp.
References clang::Sema::Context, clang::Sema::ExpressionEvaluationContextRecord::Context, clang::SemaBase::Diag(), clang::Sema::DiagnoseImmediateEscalatingReason(), E, EvaluateAndDiagnoseImmediateInvocation(), clang::Sema::FailedImmediateInvocations, clang::Decl::getLocation(), clang::if(), clang::Sema::ExpressionEvaluationContextRecord::ImmediateInvocationCandidates, clang::Sema::ExpressionEvaluationContextRecord::InImmediateEscalatingFunctionContext, clang::Sema::InnermostDeclarationWithDelayedImmediateInvocations(), clang::Sema::inTemplateInstantiation(), clang::Sema::ExpressionEvaluationContextRecord::isImmediateFunctionContext(), clang::isLambdaCallOperator(), 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().
|
static |
Handle integer arithmetic conversions.
Helper function of UsualArithmeticConversions()
Definition at line 1304 of file SemaExpr.cpp.
References clang::Sema::Context, clang::ActionResult< PtrTy, Compress >::get(), clang::ASTContext::getCorrespondingUnsignedType(), clang::ASTContext::getIntegerTypeOrder(), clang::ASTContext::getIntWidth(), and clang::Type::hasSignedIntegerRepresentation().
|
static |
Handle arithmetic conversion from integer to float.
Helper function of UsualArithmeticConversions()
Definition at line 1180 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().
|
static |
Determine whether a FunctionDecl was ever declared with an explicit storage class.
Definition at line 145 of file SemaExpr.cpp.
References D, clang::Decl::redecls(), and clang::SC_None.
Referenced by clang::Sema::MaybeSuggestAddingStaticToDecl().
Definition at line 11546 of file SemaExpr.cpp.
References clang::Type::getAs(), clang::Type::getPointeeType(), clang::ObjCMethodDecl::getReturnType(), clang::Expr::getType(), clang::Type::isObjCIdType(), clang::Type::isObjCObjectPointerType(), clang::Type::isScalarType(), clang::SemaObjC::LookupInstanceMethodInGlobalPool(), clang::SemaObjC::LookupMethodInObjectType(), clang::SemaObjC::LookupMethodInQualifiedType(), clang::SemaObjC::NSAPIObj, clang::Sema::ObjC(), clang::ObjCMethodDecl::parameters(), and clang::T.
Referenced by diagnoseObjCLiteralComparison().
|
static |
Definition at line 13690 of file SemaExpr.cpp.
References E, clang::Expr::getType(), clang::Expr::IgnoreParens(), and clang::Type::isVoidType().
Referenced by clang::Sema::DiagnoseCommaOperator().
|
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 8552 of file SemaExpr.cpp.
References clang::Call, E, clang::BinaryOperator::getOverloadedOpcode(), clang::Expr::IgnoreConversionOperatorSingleStep(), clang::Expr::IgnoreImpCasts(), and IsArithmeticOp().
Referenced by DiagnoseConditionalPrecedence().
|
static |
Definition at line 8537 of file SemaExpr.cpp.
References clang::BinaryOperator::isAdditiveOp(), clang::BinaryOperator::isMultiplicativeOp(), and clang::BinaryOperator::isShiftOp().
Referenced by IsArithmeticBinaryExpr().
Definition at line 2219 of file SemaExpr.cpp.
References clang::Sema::CurContext, clang::Decl::getDeclContext(), clang::VarDecl::getInit(), clang::Sema::getLangOpts(), clang::ValueDecl::getType(), clang::VarDecl::hasInit(), and clang::Type::isReferenceType().
Referenced by clang::Sema::getNonOdrUseReasonInCurrentContext().
|
static |
Definition at line 17851 of file SemaExpr.cpp.
References clang::Func.
Referenced by clang::Sema::MarkFunctionReferenced().
Definition at line 8824 of file SemaExpr.cpp.
References clang::Sema::Context, clang::ASTContext::getCanonicalType(), and clang::FunctionType::ExtInfo::getCmseNSCall().
Referenced by checkPointerTypesForAssignment().
|
static |
Definition at line 12924 of file SemaExpr.cpp.
Referenced by clang::Sema::CheckBitwiseOperands().
Definition at line 4773 of file SemaExpr.cpp.
Referenced by clang::Sema::ActOnArraySubscriptExpr().
|
static |
Definition at line 11533 of file SemaExpr.cpp.
References E, clang::Stmt::getStmtClass(), and clang::Expr::IgnoreParenImpCasts().
Referenced by clang::Sema::CheckCompareOperands(), and diagnoseObjCLiteralComparison().
|
static |
Are we within a context in which references to resolved functions or to variables result in odr-use?
Definition at line 17819 of file SemaExpr.cpp.
References clang::Sema::ConstantEvaluated, clang::Sema::CurContext, clang::Sema::DiscardedStatement, clang::Sema::ExprEvalContexts, clang::Sema::ImmediateFunctionContext, clang::DeclContext::isDependentContext(), clang::Sema::PotentiallyEvaluated, clang::Sema::PotentiallyEvaluatedIfUsed, clang::Result, clang::SemaBase::SemaRef, clang::Sema::Unevaluated, clang::Sema::UnevaluatedAbstract, and clang::Sema::UnevaluatedList.
Referenced by DoMarkBindingDeclReferenced(), DoMarkVarDeclReferenced(), and clang::Sema::MarkFunctionReferenced().
|
static |
Definition at line 15277 of file SemaExpr.cpp.
References clang::ASTContext::getIntWidth(), clang::ASTContext::IntTy, clang::Type::isDependentType(), clang::ASTContext::isPromotableIntegerType(), and clang::T.
Referenced by clang::Sema::CreateBuiltinUnaryOp().
Definition at line 5734 of file SemaExpr.cpp.
Referenced by clang::Sema::ConvertArgumentsForCall().
Is the given type a placeholder that we need to lower out immediately during argument processing?
Definition at line 6064 of file SemaExpr.cpp.
References clang::BuiltinType::getKind(), and clang::ast_matchers::type.
Referenced by clang::Sema::CheckArgsForPlaceholders().
Are we in a context that is potentially constant evaluated per C++20 [expr.const]p12?
C++2a [expr.const]p12:
Definition at line 17700 of file SemaExpr.cpp.
References clang::Sema::ConstantEvaluated, clang::Sema::DiscardedStatement, clang::Sema::ExprEvalContexts, clang::Sema::ImmediateFunctionContext, clang::Sema::PotentiallyEvaluated, clang::Sema::PotentiallyEvaluatedIfUsed, clang::SemaBase::SemaRef, clang::Sema::Unevaluated, clang::Sema::UnevaluatedAbstract, and clang::Sema::UnevaluatedList.
Referenced by DoMarkVarDeclReferenced(), and clang::Sema::MarkFunctionReferenced().
Definition at line 13115 of file SemaExpr.cpp.
References E, clang::MemberExpr::getBase(), clang::MemberExpr::getMemberDecl(), clang::Expr::IgnoreImplicit(), and clang::Expr::IgnoreParenImpCasts().
Referenced by CheckForModifiableLvalue().
|
static |
Definition at line 13129 of file SemaExpr.cpp.
References clang::Sema::CurContext, E, clang::DeclRefExpr::getDecl(), clang::DeclContext::getParent(), clang::Expr::getType(), clang::Expr::IgnoreParens(), clang::QualType::isConstQualified(), clang::Expr::isLValue(), NCCK_Block, NCCK_Lambda, NCCK_None, and clang::DeclRefExpr::refersToEnclosingVariableOrCapture().
Referenced by CheckForModifiableLvalue().
Definition at line 11126 of file SemaExpr.cpp.
References clang::Type::getAs(), and clang::T.
Referenced by clang::Sema::CheckShiftOperands(), and clang::Sema::CreateBuiltinUnaryOp().
Definition at line 13165 of file SemaExpr.cpp.
References clang::QualType::getNonReferenceType(), clang::Type::getPointeeType(), clang::QualType::isConstQualified(), and clang::Type::isPointerType().
Referenced by DiagnoseConstAssignment().
|
static |
Definition at line 18251 of file SemaExpr.cpp.
References clang::QualType::addConst(), clang::sema::CapturingScopeInfo::CaptureMap, clang::CR_OpenMP, clang::sema::CapturingScopeInfo::getCapture(), clang::sema::Capture::getCaptureType(), clang::QualType::getNonReferenceType(), and clang::sema::Capture::isCopyCapture().
Referenced by clang::Sema::tryCaptureVariable().
|
static |
Definition at line 18303 of file SemaExpr.cpp.
References clang::SemaBase::Diag(), clang::Sema::Diagnose, diagnoseUncapturableValueReferenceOrBinding(), clang::Type::getAs(), clang::NamedDecl::getDeclName(), clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::ValueDecl::getType(), clang::Decl::hasAttr(), clang::Type::isBlockPointerType(), clang::Type::isVariablyModifiedType(), clang::Sema::LangOpts, and Loc.
Referenced by clang::Sema::tryCaptureVariable().
This helper function returns true if QT is a vector type that has element type ElementType.
Definition at line 9097 of file SemaExpr.cpp.
References clang::Type::getAs().
Referenced by convertHalfVecBinOp(), and clang::Sema::CreateBuiltinBinOp().
|
static |
Definition at line 16470 of file SemaExpr.cpp.
References clang::ASTContext::CharTy, clang::Sema::Context, clang::SemaBase::Diag(), clang::RecordDecl::fields(), clang::IdentifierTable::get(), clang::LookupResult::getAsSingle(), clang::Preprocessor::getIdentifierTable(), clang::CXXRecordDecl::getNumBases(), clang::ASTContext::getPointerType(), clang::Sema::getStdNamespace(), clang::TagDecl::isCompleteDefinition(), clang::CXXRecordDecl::isStandardLayout(), clang::TagDecl::isUnion(), Loc, clang::Sema::LookupOrdinaryName, clang::Sema::LookupQualifiedName(), clang::Sema::PP, Std, and clang::CanQual< T >::withConst().
Referenced by clang::Sema::ActOnSourceLocExpr().
|
static |
Definition at line 19716 of file SemaExpr.cpp.
References clang::SemaOpenMP::checkDeclIsAllowedInOpenMPTarget(), D, DoMarkBindingDeclReferenced(), DoMarkVarDeclReferenced(), E, FixDependencyOfIdExpressionsInLambdaWithDependentObjectParameter(), clang::MemberExpr::getBase(), clang::CXXMethodDecl::getDevirtualizedMethod(), clang::Sema::getLangOpts(), clang::MemberExpr::getMemberDecl(), clang::SemaOpenMP::isInOpenMPDeclareTargetContext(), clang::CXXMethodDecl::isVirtual(), Loc, clang::Sema::MarkAnyDeclReferenced(), clang::Sema::OpenMP(), clang::MemberExpr::performsVirtualDispatch(), clang::Sema::RefsMinusAssignments, and clang::SemaBase::SemaRef.
Referenced by clang::Sema::MarkDeclRefReferenced(), clang::Sema::MarkFunctionParmPackReferenced(), and clang::Sema::MarkMemberReferenced().
|
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:
Definition at line 18134 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::QualType::isConstQualified(), clang::NamedDecl::isExternallyVisible(), clang::Sema::isExternalWithNoLinkageType(), clang::VarDecl::isInline(), clang::SourceLocation::isInvalid(), clang::VarDecl::isStaticDataMember(), clang::Sema::LangOpts, Loc, clang::Sema::OpenMP(), clang::SemaBase::SemaRef, clang::Sema::targetDiag(), clang::Sema::TryCapture_Implicit, clang::SemaOpenMP::tryCaptureOpenMPLambdas(), clang::Sema::tryCaptureVariable(), clang::Sema::UndefinedButUsed, and V.
Referenced by clang::Sema::CleanupVarDeclMarking(), DoMarkVarDeclReferenced(), and clang::Sema::MarkCaptureUsedInEnclosingContext().
|
static |
Definition at line 16587 of file SemaExpr.cpp.
References clang::Sema::checkAddressOfFunctionIsAvailable(), clang::Stmt::getBeginLoc(), clang::Expr::getType(), clang::Expr::IgnoreParenImpCasts(), clang::Type::isFunctionPointerType(), and clang::Type::isFunctionType().
Referenced by clang::Sema::DiagnoseAssignmentResult().
|
static |
Returns true if conversion between vectors of halfs and vectors of floats is needed.
Definition at line 14575 of file SemaExpr.cpp.
References E, clang::Type::getAs(), clang::ASTContext::getLangOpts(), clang::ASTContext::getTargetInfo(), clang::Expr::getType(), clang::ASTContext::HalfTy, clang::Expr::IgnoreImplicit(), clang::Neon, and clang::TargetInfo::useFP16ConversionIntrinsics().
Referenced by clang::Sema::CreateBuiltinBinOp(), and clang::Sema::CreateBuiltinUnaryOp().
|
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 8141 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(), clang::Type::isIntegerType(), clang::ActionResult< PtrTy, Compress >::isInvalid(), and clang::Type::isRealFloatingType().
Referenced by OpenCLConvertScalarsToVectors().
|
static |
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.
Definition at line 8278 of file SemaExpr.cpp.
References checkOpenCLConditionVector(), clang::Sema::CheckVectorOperands(), checkVectorResult(), clang::Sema::DefaultFunctionArrayLvalueConversion(), clang::ActionResult< PtrTy, Compress >::get(), clang::Sema::getLangOpts(), clang::Expr::getType(), clang::ActionResult< PtrTy, Compress >::isInvalid(), clang::QualType::isNull(), clang::Type::isVectorType(), and OpenCLConvertScalarsToVectors().
Referenced by clang::Sema::CheckConditionalOperands().
|
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 8196 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().
|
static |
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.
Definition at line 19055 of file SemaExpr.cpp.
References clang::Sema::ActOnArraySubscriptExpr(), clang::Sema::ActOnChooseExpr(), clang::Sema::ActOnConditionalOp(), clang::Sema::ActOnParenExpr(), clang::Sema::BuildUnaryOp(), clang::Sema::Context, clang::MemberExpr::Create(), clang::ConstantExpr::Create(), clang::DeclRefExpr::Create(), clang::Sema::CreateGenericSelectionExpr(), D, E, clang::ExprEmpty(), clang::ExprError(), clang::ActionResult< PtrTy, Compress >::get(), clang::Sema::getCurLambda(), clang::Stmt::getStmtClass(), clang::Expr::getType(), clang::Expr::IgnoreImplicit(), clang::Sema::ImpCastExprToType(), clang::Type::isArrayType(), clang::ActionResult< PtrTy, Compress >::isInvalid(), clang::ActionResult< PtrTy, Compress >::isUsable(), clang::Sema::MaybeODRUseExprs, clang::NOUR_Constant, clang::NOUR_Discarded, clang::NOUR_None, clang::NOUR_Unevaluated, Path, and rebuildPotentialResultsAsNonOdrUsed().
Referenced by clang::Sema::CheckLValueToRValueConversionOperand(), and rebuildPotentialResultsAsNonOdrUsed().
|
static |
Given a function expression of unknown-any type, try to rebuild it to have a function type.
Definition at line 20280 of file SemaExpr.cpp.
References clang::Sema::DefaultFunctionArrayConversion(), clang::ExprError(), and clang::Result.
Referenced by clang::Sema::BuildCallExpr(), and clang::Sema::BuildResolvedCallExpr().
Definition at line 14247 of file SemaExpr.cpp.
References D, clang::Sema::getCurFunction(), clang::DeclRefExpr::getDecl(), clang::Decl::getDeclContext(), and clang::Decl::hasAttr().
Referenced by clang::Sema::CreateBuiltinBinOp(), and clang::Sema::CreateBuiltinUnaryOp().
|
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 2621 of file SemaExpr.cpp.
References clang::NestedNameSpecifier::Create(), clang::DependentScopeDeclRefExpr::Create(), clang::CXXDependentScopeMemberExpr::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::TypeDecl::getTypeForDecl(), clang::CXXScopeSpec::getWithLocInContext(), clang::CXXRecordDecl::hasAnyDependentBases(), clang::CXXRecordDecl::hasDefinition(), clang::QualType::isNull(), Loc, and clang::CXXScopeSpec::MakeTrivial().
Referenced by clang::Sema::ActOnIdExpression().
|
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.
ConstantExpr 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 17416 of file SemaExpr.cpp.
References E, clang::Sema::FailedImmediateInvocations, clang::ActionResult< PtrTy, Compress >::get(), clang::Expr::IgnoreImplicit(), clang::Sema::ExpressionEvaluationContextRecord::ImmediateInvocationCandidates, clang::Init, clang::ActionResult< PtrTy, Compress >::isUsable(), clang::Sema::MaybeCreateExprWithCleanups(), clang::Sema::ExpressionEvaluationContextRecord::ReferenceToConsteval, and clang::SemaBase::SemaRef.
Referenced by HandleImmediateInvocations().
|
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.
Definition at line 6156 of file SemaExpr.cpp.
References clang::ASTContext::BuiltinInfo, clang::ParmVarDecl::Create(), clang::FunctionDecl::Create(), clang::Sema::DefaultFunctionArrayLvalueConversion(), clang::ActionResult< PtrTy, Compress >::get(), clang::QualType::getAddressSpace(), clang::ASTContext::getAddrSpaceQualType(), clang::FunctionDecl::getBuiltinID(), clang::Sema::getCurFPFeatures(), clang::ASTContext::getFunctionType(), clang::NamedDecl::getIdentifier(), clang::Decl::getLocation(), clang::FunctionProtoType::getNumParams(), clang::FunctionProtoType::getParamType(), clang::DeclContext::getParent(), clang::Type::getPointeeType(), clang::ASTContext::getPointerType(), clang::FunctionType::getReturnType(), clang::ValueDecl::getType(), clang::Expr::getType(), clang::QualType::hasAddressSpace(), clang::Builtin::Context::hasPtrArgsOrResult(), clang::FPOptions::isFPConstrained(), clang::ActionResult< PtrTy, Compress >::isInvalid(), clang::Type::isPointerType(), clang::isPtrSizeAddressSpace(), clang::FunctionProtoType::isVariadic(), clang::Sema::mergeDeclAttributes(), clang::FunctionProtoType::param_types(), Parent, clang::SC_Extern, clang::SC_None, clang::ParmVarDecl::setScopeInfo(), and clang::FunctionProtoType::ExtProtoInfo::Variadic.
Referenced by clang::Sema::BuildCallExpr().
|
static |
Definition at line 3168 of file SemaExpr.cpp.
References clang::LookupResult::getFoundDecl(), and clang::LookupResult::isSingleResult().
Referenced by clang::Sema::BuildDeclarationNameExpr().
|
static |
SuggestParentheses - Emit a note with a fixit hint that wraps ParenRange in parentheses.
Definition at line 8522 of file SemaExpr.cpp.
References clang::FixItHint::CreateInsertion(), clang::SourceRange::getBegin(), clang::SourceRange::getEnd(), clang::SourceLocation::isFileID(), clang::SourceLocation::isValid(), Loc, clang::Note, and clang::Self.
Referenced by DiagnoseAdditionInShift(), DiagnoseBitwiseOpInBitwiseOp(), DiagnoseBitwisePrecedence(), DiagnoseConditionalPrecedence(), DiagnoseShiftCompare(), and EmitDiagnosticForLogicalAndInLogicalOr().
|
static |
Attempt to convert and splat Scalar into a vector whose types matches Vector following GCC conversion rules.
The rule is that implicit conversion can occur when Scalar can be casted to match Vector's element type without causing truncation of Scalar.
Definition at line 9971 of file SemaExpr.cpp.
References canConvertIntToOtherIntTy(), canConvertIntTyToFloatTy(), clang::Type::castAs(), clang::Sema::Context, clang::Type::getAs(), clang::Sema::getASTContext(), clang::ASTContext::getFloatingTypeOrder(), clang::ASTContext::getFloatTypeSemantics(), clang::ASTContext::getIntegerTypeOrder(), clang::ASTContext::getTypeSize(), clang::Sema::ImpCastExprToType(), clang::Type::isArithmeticType(), clang::Type::isEnumeralType(), clang::Type::isIntegralType(), clang::Type::isRealFloatingType(), clang::Type::isSveVLSBuiltinType(), clang::Result, and clang::Vector.
Referenced by clang::Sema::CheckSizelessVectorOperands(), and clang::Sema::CheckVectorOperands().
|
static |
Definition at line 6298 of file SemaExpr.cpp.
References clang::sema::LambdaScopeInfo::addPotentialThisCapture(), clang::Sema::CheckCXXThisCapture(), clang::Sema::CurContext, enclosingClassIsRelatedToClassInWhichMembersWereFound(), clang::Sema::getCurLambda(), clang::DeclContext::getParent(), clang::sema::CapturingScopeInfo::ImpCap_None, clang::sema::CapturingScopeInfo::ImpCaptureStyle, clang::sema::CapturingScopeInfo::isCXXThisCaptured(), clang::DeclContext::isDependentContext(), and clang::UnresolvedMemberExpr::isImplicitAccess().
Referenced by clang::Sema::BuildCallExpr().
|
static |
Definition at line 5693 of file SemaExpr.cpp.
References clang::Sema::AddOverloadCandidate(), clang::AS_none, clang::OverloadCandidateSet::BestViableFunction(), clang::Sema::CorrectTypo(), clang::OverloadCandidateSet::CSK_Normal, clang::Sema::CTK_ErrorRecovery, clang::Sema::CurContext, clang::DeclarationName::getAsIdentifierInfo(), clang::NamedDecl::getDeclName(), clang::MemberExpr::getMemberLoc(), clang::Sema::getScopeForContext(), clang::Sema::LookupOrdinaryName, clang::DeclAccessPair::make(), and clang::OR_Success.
Referenced by clang::Sema::ConvertArgumentsForCall().
|
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.
scalar | - if non-null, actually perform the conversions |
Definition at line 9821 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::isIntegerType(), clang::Type::isIntegralType(), and clang::Type::isRealFloatingType().
Referenced by clang::Sema::CheckVectorOperands().
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 1261 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().
|
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 4195 of file SemaExpr.cpp.
References clang::SemaBase::Diag(), E, clang::Expr::getType(), Loc, and clang::T.
Referenced by clang::Sema::CheckUnaryExprOrTypeTraitOperand().