clang 8.0.0

Macros | Typedefs | Enumerations | Functions
SemaExpr.cpp File Reference
`#include "TreeTransform.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/RecursiveASTVisitor.h"`
`#include "clang/AST/TypeLoc.h"`
`#include "clang/Basic/FixedPoint.h"`
`#include "clang/Basic/PartialDiagnostic.h"`
`#include "clang/Basic/SourceManager.h"`
`#include "clang/Basic/TargetInfo.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/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/SemaFixItUtils.h"`
`#include "clang/Sema/SemaInternal.h"`
`#include "clang/Sema/Template.h"`
`#include "llvm/Support/ConvertUTF.h"`
`#include "clang/AST/DeclNodes.inc"`
`#include "clang/AST/TypeNodes.def"`
`#include "clang/Basic/OpenCLImageTypes.def"`
`#include "clang/Basic/OpenCLExtensionTypes.def"`
`#include "clang/AST/BuiltinTypes.def"`
Include dependency graph for SemaExpr.cpp:

Go to the source code of this file.

## 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 | 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 | 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 }
enum |

## 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. More...
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). More...
static void | CheckForNullPointerDereference (Sema &S, Expr *E)
static void | DiagnoseDirectIsaAccess (Sema &S, const ObjCIvarRefExpr *OIRE, SourceLocation AssignLoc, const Expr *RHS)
static bool | handleIntegerToComplexFloatConversion (Sema &S, ExprResult &IntExpr, ExprResult &ComplexExpr, QualType IntTy, QualType ComplexTy, bool SkipCast)
| Converts an integer to complex float type. More...
static QualType | handleComplexFloatConversion (Sema &S, ExprResult &LHS, ExprResult &RHS, QualType LHSType, QualType RHSType, bool IsCompAssign)
| Handle arithmetic conversion with complex types. More...
static QualType | handleIntToFloatConversion (Sema &S, ExprResult &FloatExpr, ExprResult &IntExpr, QualType FloatTy, QualType IntTy, bool ConvertFloat, bool ConvertInt)
| Handle arithmetic conversion from integer to float. More...
static QualType | handleFloatConversion (Sema &S, ExprResult &LHS, ExprResult &RHS, QualType LHSType, QualType RHSType, bool IsCompAssign)
| Handle arithmethic conversion with floating point types. More...
static bool | unsupportedTypeConversion (const Sema &S, QualType LHSType, QualType RHSType)
| Diagnose attempts to convert between __float128 and long double if there is no support for such conversion. More...
template<PerformCastFn doLHSCast, PerformCastFn doRHSCast>
static QualType | handleIntegerConversion (Sema &S, ExprResult &LHS, ExprResult &RHS, QualType LHSType, QualType RHSType, bool IsCompAssign)
| Handle integer arithmetic conversions. More...
static QualType | handleComplexIntConversion (Sema &S, ExprResult &LHS, ExprResult &RHS, QualType LHSType, QualType RHSType, bool IsCompAssign)
| Handle conversions with GCC complex int extension. More...
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. More...
static ExprResult | BuildCookedLiteralOperatorCall (Sema &S, Scope *Scope, IdentifierInfo *UDSuffix, SourceLocation UDSuffixLoc, ArrayRef< Expr *> Args, SourceLocation LitEndLoc)
| BuildCookedLiteralOperatorCall - A user-defined literal was found. More...
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. More...
static bool | CheckDeclInExpr (Sema &S, SourceLocation Loc, NamedDecl *D)
| Diagnoses obvious problems with the use of the given declaration as an expression. More...
static bool | ShouldLookupResultBeMultiVersionOverload (const LookupResult &R)
static void | diagnoseUncapturableValueReference (Sema &S, SourceLocation loc, ValueDecl *var, DeclContext *DC)
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 | 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, 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. More...
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. More...
static bool | isMSPropertySubscriptExpr (Sema &S, Expr *Base)
static TypoCorrection | TryTypoCorrectionForCall (Sema &S, Expr *Fn, FunctionDecl *FDecl, ArrayRef< Expr *> Args)
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. More...
static bool | isPlaceholderToRemoveAsArg (QualType type)
| Is the given type a placeholder that we need to lower out immediately during argument processing? More...
static bool | checkArgsForPlaceholders (Sema &S, MultiExprArg args)
| Check an argument list for placeholders that we won't try to handle later. More...
static FunctionDecl * | rewriteBuiltinFunctionDecl (Sema *Sema, ASTContext &Context, const 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. More...
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 bool | breakDownVectorType (QualType type, uint64_t &len, QualType &eltType)
static bool | checkCondition (Sema &S, Expr *Cond, SourceLocation QuestionLoc)
| Return false if the condition expression is valid, true otherwise. More...
static QualType | checkConditionalVoidType (Sema &S, ExprResult &LHS, ExprResult &RHS)
| Handle when one or both operands are void type. More...
static bool | checkConditionalNullPointer (Sema &S, ExprResult &NullExpr, QualType PointerTy)
| Return false if the NullExpr can be promoted to PointerTy, true otherwise. More...
static QualType | checkConditionalPointerCompatibility (Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc)
| Checks compatibility between two pointers and return the resulting type. More...
static QualType | checkConditionalBlockPointerCompatibility (Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc)
| Return the resulting type when the operands are both block pointers. More...
static QualType | checkConditionalObjectPointersCompatibility (Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc)
| Return the resulting type when the operands are both pointers. More...
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. More...
static QualType | OpenCLArithmeticConversions (Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
| Simple conversion between integer and floating point types. More...
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. More...
static bool | checkOpenCLConditionVector (Sema &S, Expr *Cond, SourceLocation QuestionLoc)
| Return false if this is a valid OpenCL condition vector. More...
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. More...
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. More...
static bool | checkBlockType (Sema &S, const Expr *E)
| Return true if the Expr is block type. More...
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. More...
static bool | IsArithmeticOp (BinaryOperatorKind Opc)
static bool | IsArithmeticBinaryExpr (Expr *E, BinaryOperatorKind *Opcode, 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. More...
static bool | ExprLooksBoolean (Expr *E)
| ExprLooksBoolean - Returns true if E looks boolean, i.e. More...
static void | DiagnoseConditionalPrecedence (Sema &Self, SourceLocation OpLoc, Expr *Condition, Expr *LHSExpr, 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". More...
static QualType | computeConditionalNullability (QualType ResTy, bool IsBin, QualType LHSTy, QualType RHSTy, ASTContext &Ctx)
| Compute the nullability of a conditional expression. More...
static Sema::AssignConvertType | checkPointerTypesForAssignment (Sema &S, QualType LHSType, QualType RHSType)
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. More...
static Sema::AssignConvertType | checkObjCPointerTypesForAssignment (Sema &S, QualType LHSType, QualType RHSType)
| checkObjCPointerTypesForAssignment - Compares two objective-c pointer types for assignment compatibility. More...
static bool | isVector (QualType QT, QualType ElementType)
| This helper function returns true if QT is a vector type that has element type ElementType. More...
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. More...
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. More...
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. More...
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. More...
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. More...
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. More...
static void | checkArithmeticNull (Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompare)
static void | DiagnoseDivisionSizeofPointer (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. More...
static void | diagnoseArithmeticOnVoidPointer (Sema &S, SourceLocation Loc, Expr *Pointer)
| Diagnose invalid arithmetic on a void pointer. More...
static void | diagnoseArithmeticOnNullPointer (Sema &S, SourceLocation Loc, Expr *Pointer, bool IsGNUIdiom)
| Diagnose invalid arithmetic on a null pointer. More...
static void | diagnoseArithmeticOnTwoFunctionPointers (Sema &S, SourceLocation Loc, Expr *LHS, Expr *RHS)
| Diagnose invalid arithmetic on two function pointers. More...
static void | diagnoseArithmeticOnFunctionPointer (Sema &S, SourceLocation Loc, Expr *Pointer)
| Diagnose invalid arithmetic on a function pointer. More...
static bool | checkArithmeticIncompletePointerType (Sema &S, SourceLocation Loc, Expr *Operand)
| Emit error if Operand is incomplete pointer type. More...
static bool | checkArithmeticOpPointerOperand (Sema &S, SourceLocation Loc, Expr *Operand)
| Check the validity of an arithmetic pointer operand. More...
static bool | checkArithmeticBinOpPointerOperands (Sema &S, SourceLocation Loc, Expr *LHSExpr, Expr *RHSExpr)
| Check the validity of a binary arithmetic operation w.r.t. More...
static void | diagnoseStringPlusInt (Sema &Self, SourceLocation OpLoc, Expr *LHSExpr, Expr *RHSExpr)
| diagnoseStringPlusInt - Emit a warning when adding an integer to a string literal. More...
static void | diagnoseStringPlusChar (Sema &Self, SourceLocation OpLoc, Expr *LHSExpr, Expr *RHSExpr)
| Emit a warning when adding a char literal to a string. More...
static void | diagnosePointerIncompatibility (Sema &S, SourceLocation Loc, Expr *LHSExpr, Expr *RHSExpr)
| Emit error when two pointers are incompatible. More...
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. More...
static void | checkEnumComparison (Sema &S, SourceLocation Loc, Expr *LHS, Expr *RHS)
| If two different enums are compared, raise a warning. More...
static void | diagnoseDistinctPointerComparison (Sema &S, SourceLocation Loc, ExprResult &LHS, ExprResult &RHS, bool IsError)
| Diagnose bad pointer comparisons. More...
static bool | convertPointersToCompositeType (Sema &S, SourceLocation Loc, ExprResult &LHS, ExprResult &RHS)
| Returns false if the pointers are converted to a composite type, true otherwise. More...
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. More...
static ValueDecl * | getCompareDecl (Expr *E)
static void | diagnoseTautologicalComparison (Sema &S, SourceLocation Loc, Expr *LHS, Expr *RHS, BinaryOperatorKind Opc)
| Diagnose some forms of syntactically-obvious tautological comparison. More...
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 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. More...
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. More...
static bool | CheckForModifiableLvalue (Expr *E, SourceLocation Loc, Sema &S)
| CheckForModifiableLvalue - Verify that E is a modifiable lvalue. More...
static void | CheckIdentityFieldAssignment (Expr *LHSExpr, Expr *RHSExpr, SourceLocation Loc, Sema &Sema)
static bool | IgnoreCommaOperand (const Expr *E)
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. More...
static ValueDecl * | getPrimaryDecl (Expr *E)
| getPrimaryDecl - Helper function for CheckAddressOfOperand(). More...
static void | diagnoseAddressOfInvalidType (Sema &S, SourceLocation Loc, Expr *E, unsigned Type)
| Diagnose invalid operand for address of operations. More...
static void | RecordModifiableNonNullParam (Sema &S, const Expr *Exp)
static QualType | CheckIndirectionOperand (Sema &S, Expr *Op, ExprValueKind &VK, SourceLocation OpLoc)
| CheckIndirectionOperand - Type check unary indirection (prefix '*'). More...
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. More...
static void | checkObjCPointerIntrospection (Sema &S, ExprResult &L, ExprResult &R, SourceLocation OpLoc)
| Check if a bitwise-& is performed on an Objective-C pointer. More...
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, FPOptions FPFeatures)
static std::pair< ExprResult, ExprResult > | CorrectDelayedTyposInBinOp (Sema &S, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
static bool | needsConversionOfHalfVec (bool OpRequiresConversion, ASTContext &Ctx, QualType SrcType)
| Returns true if conversion between vectors of halfs and vectors of floats is needed. More...
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. More...
static void | EmitDiagnosticForLogicalAndInLogicalOr (Sema &Self, SourceLocation OpLoc, BinaryOperator *Bop)
| It accepts a '&&' expr that is inside a '||' one. More...
static bool | EvaluatesAsTrue (Sema &S, Expr *E)
| Returns true if the given expression can be evaluated as a constant 'true'. More...
static bool | EvaluatesAsFalse (Sema &S, Expr *E)
| Returns true if the given expression can be evaluated as a constant 'false'. More...
static void | DiagnoseLogicalAndInLogicalOrLHS (Sema &S, SourceLocation OpLoc, Expr *LHSExpr, Expr *RHSExpr)
| Look for '&&' in the left hand of a '||' expr. More...
static void | DiagnoseLogicalAndInLogicalOrRHS (Sema &S, SourceLocation OpLoc, Expr *LHSExpr, Expr *RHSExpr)
| Look for '&&' in the right hand of a '||' expr. More...
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. More...
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. More...
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. More...
static bool | isOverflowingIntegerType (ASTContext &Ctx, QualType T)
static Expr * | maybeRebuildARCConsumingStmt (Stmt *Statement)
| Given the last statement in a statement-expression, check whether the result is a producing expression (like a call to an ns_returns_retained function) and, if so, rebuild it to hoist the release out of the full-expression. More...
static bool | maybeDiagnoseAssignmentToFunction (Sema &S, QualType DstType, const Expr *SrcExpr)
static bool | isEvaluatableContext (Sema &SemaRef)
| Are we within a context in which some evaluation could be performed (be it constant evaluation or runtime evaluation)? Sadly, this notion is not quite captured by C++'s idea of an "unevaluated context". More...
static bool | isOdrUseContext (Sema &SemaRef, bool SkipDependentUses=true)
| Are we within a context in which references to resolved functions or to variables result in odr-use? More...
static bool | isImplicitlyDefinableConstexprFunction (FunctionDecl *Func)
static bool | isVariableAlreadyCapturedInScopeInfo (CapturingScopeInfo *CSI, VarDecl *Var, bool &SubCapturesAreNested, QualType &CaptureType, QualType &DeclRefType)
static DeclContext * | getParentOfCapturingContextOrNull (DeclContext *DC, VarDecl *Var, SourceLocation Loc, const bool Diagnose, Sema &S)
static bool | isVariableCapturable (CapturingScopeInfo *CSI, VarDecl *Var, SourceLocation Loc, const bool Diagnose, Sema &S)
static bool | captureInBlock (BlockScopeInfo *BSI, VarDecl *Var, SourceLocation Loc, const bool BuildAndDiagnose, QualType &CaptureType, QualType &DeclRefType, const bool Nested, Sema &S)
static bool | captureInCapturedRegion (CapturedRegionScopeInfo *RSI, VarDecl *Var, SourceLocation Loc, const bool BuildAndDiagnose, QualType &CaptureType, QualType &DeclRefType, const bool RefersToCapturedVariable, Sema &S)
| Capture the given variable in the captured region. More...
static void | addAsFieldToClosureType (Sema &S, LambdaScopeInfo *LSI, QualType FieldType, QualType DeclRefType, SourceLocation Loc, bool RefersToCapturedVariable)
| Create a field within the lambda class for the variable being captured. More...
static bool | captureInLambda (LambdaScopeInfo *LSI, VarDecl *Var, SourceLocation Loc, const bool BuildAndDiagnose, QualType &CaptureType, QualType &DeclRefType, const bool RefersToCapturedVariable, const Sema::TryCaptureKind Kind, SourceLocation EllipsisLoc, const bool IsTopScope, Sema &S)
| Capture the given variable in the lambda. More...
static bool | IsVariableNonDependentAndAConstantExpression (VarDecl *Var, ASTContext &Context)
static void | DoMarkVarDeclReferenced (Sema &SemaRef, SourceLocation Loc, VarDecl *Var, Expr *E)
static void | MarkExprReferenced (Sema &SemaRef, SourceLocation Loc, Decl *D, Expr *E, bool MightBeOdrUse)
static ExprResult | diagnoseUnknownAnyExpr (Sema &S, Expr *E)

## Macro Definition Documentation

## ◆ ABSTRACT_DECL

#define ABSTRACT_DECL | ( |  | kind | ) |

## ◆ ABSTRACT_TYPE

#define ABSTRACT_TYPE | ( |  | Class,
|  |  | Base
| ) |  |

## ◆ BUILTIN_TYPE [1/2]

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

## ◆ BUILTIN_TYPE [2/2]

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

## ◆ DECL

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

## ◆ DEPENDENT_TYPE

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

## ◆ EXT_OPAQUE_TYPE [1/2]

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

## ◆ EXT_OPAQUE_TYPE [2/2]

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

## ◆ IMAGE_TYPE [1/2]

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

## ◆ IMAGE_TYPE [2/2]

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

## ◆ NON_CANONICAL_TYPE

#define NON_CANONICAL_TYPE | ( |  | Class,
|  |  | Base
| ) |  |

## ◆ NON_CANONICAL_UNLESS_DEPENDENT_TYPE

#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE | ( |  | Class,
|  |  | Base
| ) |  |

## ◆ PLACEHOLDER_TYPE [1/2]

#define PLACEHOLDER_TYPE | ( |  | ID,
|  |  | SINGLETON_ID
| ) |  |

## ◆ PLACEHOLDER_TYPE [2/2]

#define PLACEHOLDER_TYPE | ( |  | Id,
|  |  | SingletonId
| ) |  |

## ◆ TYPE

#define TYPE | ( |  | Class,
|  |  | Base
| ) |  |

## ◆ VALUE

#define VALUE | ( |  | type,
|  |  | base
| ) |  |

## Typedef Documentation

## ◆ PerformCastFn

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

Definition at line 1129 of file SemaExpr.cpp.

## Enumeration Type Documentation

## ◆ anonymous enum

anonymous enum

Enumerator
ConstFunction |
ConstVariable |
ConstMember |
ConstMethod |
NestedConstMember |
ConstUnknown |

Definition at line 10963 of file SemaExpr.cpp.

## ◆ anonymous enum

anonymous enum

Definition at line 11704 of file SemaExpr.cpp.

## ◆ NonConstCaptureKind

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 10917 of file SemaExpr.cpp.

## ◆ OriginalExprKind

enum OriginalExprKind

Enumerator
OEK_Variable |
OEK_Member |
OEK_LValue |

Definition at line 11095 of file SemaExpr.cpp.

## Function Documentation

## ◆ addAsFieldToClosureType()

static void addAsFieldToClosureType | ( | Sema & | S,
|  | LambdaScopeInfo * | LSI,
|  | QualType | FieldType,
|  | QualType | DeclRefType,
|  | SourceLocation | Loc,
|  | bool | RefersToCapturedVariable
| ) |  |
| static

Create a field within the lambda class for the variable being captured.

Definition at line 15129 of file SemaExpr.cpp.

## ◆ breakDownVectorType()

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

Definition at line 6176 of file SemaExpr.cpp.

References clang::Type::getAs(), clang::Type::isRealType(), clang::Type::isScalarType(), and clang::ast_matchers::type.

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

## ◆ BuildCookedLiteralOperatorCall()

static ExprResult BuildCookedLiteralOperatorCall | ( | Sema & | S,
|  | Scope * | Scope,
|  | IdentifierInfo * | UDSuffix,
|  | SourceLocation | UDSuffixLoc,
|  | ArrayRef< Expr *> | Args,
|  | SourceLocation | LitEndLoc
| ) |  |
| 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 1504 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().

## ◆ BuildFloatingLiteral()

static Expr* BuildFloatingLiteral | ( | Sema & | S,
|  | NumericLiteralParser & | Literal,
|  | QualType | Ty,
|  | SourceLocation | Loc
| ) |  |
| static

Definition at line 3203 of file SemaExpr.cpp.

References clang::Sema::Context, clang::FloatingLiteral::Create(), clang::Sema::Diag(), clang::ASTContext::getFloatTypeSemantics(), and clang::NumericLiteralParser::GetFloatValue().

## ◆ BuildOverloadedBinOp()

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

Build an overloaded binary operator expression in the given scope.

Definition at line 12704 of file SemaExpr.cpp.

References CheckIdentityFieldAssignment(), clang::Sema::CreateOverloadedBinOp(), DiagnoseSelfAssignment(), clang::BinaryOperator::getOverloadedOperator(), clang::Expr::getType(), clang::Sema::LookupOverloadedOperatorName(), and clang::OO_None.

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

## ◆ canConvertIntToOtherIntTy()

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

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

Definition at line 8495 of file SemaExpr.cpp.

References clang::Sema::Context, clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::APValue::getInt(), clang::ASTContext::getIntegerTypeOrder(), clang::ASTContext::getIntWidth(), clang::Type::hasSignedIntegerRepresentation(), and clang::Expr::EvalResult::Val.

Referenced by tryGCCVectorConvertAndSplat().

## ◆ canConvertIntTyToFloatTy()

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

Test if a (constant) integer Int can be casted to floating point type FloatTy without losing precision.

Definition at line 8533 of file SemaExpr.cpp.

References clang::Sema::Context, clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::ASTContext::getFloatTypeSemantics(), clang::APValue::getInt(), clang::ASTContext::getIntWidth(), clang::ASTContext::getTypeSize(), clang::Type::hasSignedIntegerRepresentation(), and clang::Expr::EvalResult::Val.

Referenced by tryGCCVectorConvertAndSplat().

## ◆ captureInBlock()

static bool captureInBlock | ( | BlockScopeInfo * | BSI,
|  | VarDecl * | Var,
|  | SourceLocation | Loc,
|  | const bool | BuildAndDiagnose,
|  | QualType & | CaptureType,
|  | QualType & | DeclRefType,
|  | const bool | Nested,
|  | Sema & | S
| ) |  |
| static

Definition at line 14942 of file SemaExpr.cpp.

## ◆ captureInCapturedRegion()

static bool captureInCapturedRegion | ( | CapturedRegionScopeInfo * | RSI,
|  | VarDecl * | Var,
|  | SourceLocation | Loc,
|  | const bool | BuildAndDiagnose,
|  | QualType & | CaptureType,
|  | QualType & | DeclRefType,
|  | const bool | RefersToCapturedVariable,
|  | Sema & | S
| ) |  |
| static

Capture the given variable in the captured region.

Definition at line 15068 of file SemaExpr.cpp.

## ◆ captureInLambda()

static bool captureInLambda | ( | LambdaScopeInfo * | LSI,
|  | VarDecl * | Var,
|  | SourceLocation | Loc,
|  | const bool | BuildAndDiagnose,
|  | QualType & | CaptureType,
|  | QualType & | DeclRefType,
|  | const bool | RefersToCapturedVariable,
|  | const Sema::TryCaptureKind | Kind,
|  | SourceLocation | EllipsisLoc,
|  | const bool | IsTopScope,
|  | Sema & | S
| ) |  |
| static

Capture the given variable in the lambda.

Definition at line 15161 of file SemaExpr.cpp.

## ◆ captureVariablyModifiedType()

static void captureVariablyModifiedType | ( | ASTContext & | Context,
|  | QualType | T,
|  | CapturingScopeInfo * | CSI
| ) |  |
| static

Definition at line 3903 of file SemaExpr.cpp.

Referenced by clang::Sema::CreateUnaryExprOrTypeTraitExpr(), and clang::Sema::tryCaptureVariable().

## ◆ castKindToImplicitConversionKind()

static ImplicitConversionKind castKindToImplicitConversionKind | ( | CastKind | CK | ) |
| static

Definition at line 10041 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_Identity, clang::ICK_Integral_Conversion, and clang::ICK_Lvalue_To_Rvalue.

Referenced by checkThreeWayNarrowingConversion().

## ◆ CheckAlignOfExpr()

static bool CheckAlignOfExpr | ( | Sema & | S,
|  | Expr * | E,
|  | UnaryExprOrTypeTrait | ExprKind
| ) |  |
| static

Definition at line 3836 of file SemaExpr.cpp.

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

## ◆ checkArgsForPlaceholders()

static bool checkArgsForPlaceholders | ( | Sema & | S,
|  | MultiExprArg | args
| ) |  |
| static

Check an argument list for placeholders that we won't try to handle later.

Definition at line 5198 of file SemaExpr.cpp.

References clang::Sema::CheckPlaceholderExpr(), clang::Sema::CorrectDelayedTyposInExpr(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), and isPlaceholderToRemoveAsArg().

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

## ◆ checkArithmeticBinOpPointerOperands()

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

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

pointer operands.

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

See also
  checkArithmeticOpPointerOperand. However, it has special logic for emitting a single diagnostic even for operations where both LHS and RHS are (potentially problematic) pointers.

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

Definition at line 9065 of file SemaExpr.cpp.

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

## ◆ checkArithmeticIncompletePointerType()

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

Emit error if Operand is incomplete pointer type.

Returns
  True if pointer has incomplete type

Definition at line 9012 of file SemaExpr.cpp.

References clang::Type::getAs(), clang::Type::getPointeeType(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Type::isAnyPointerType(), clang::Type::isDependentType(), and clang::Sema::RequireCompleteType().

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

## ◆ checkArithmeticNull()

static void checkArithmeticNull | ( | Sema & | S,
|  | ExprResult & | LHS,
|  | ExprResult & | RHS,
|  | SourceLocation | Loc,
|  | bool | IsCompare
| ) |  |
| static

Definition at line 8823 of file SemaExpr.cpp.

References clang::Sema::Diag(), and clang::ActionResult< PtrTy, CompressInvalid >::get().

Referenced by clang::Sema::CheckAdditionOperands(), clang::Sema::CheckBitwiseOperands(), clang::Sema::CheckCompareOperands(), clang::Sema::CheckMultiplyDivideOperands(), clang::Sema::CheckRemainderOperands(), clang::Sema::CheckShiftOperands(), and clang::Sema::CheckSubtractionOperands().

## ◆ checkArithmeticOnObjCPointer()

static bool checkArithmeticOnObjCPointer | ( | Sema & | S,
|  | SourceLocation | opLoc,
|  | Expr * | op
| ) |  |
| static

Diagnose if arithmetic on the given ObjC pointer is illegal.

Returns
  true on error

Definition at line 4192 of file SemaExpr.cpp.

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

## ◆ checkArithmeticOpPointerOperand()

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

Check the validity of an arithmetic pointer operand.

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

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

Definition at line 9033 of file SemaExpr.cpp.

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

Referenced by CheckIncrementDecrementOperand().

## ◆ checkArithmeticOrEnumeralCompare()

static QualType checkArithmeticOrEnumeralCompare | ( | Sema & | S,
|  | ExprResult & | LHS,
|  | ExprResult & | RHS,
|  | SourceLocation | Loc,
|  | BinaryOperatorKind | Opc
| ) |  |
| static

Definition at line 10211 of file SemaExpr.cpp.

References checkArithmeticOrEnumeralThreeWayCompare(), checkEnumComparison(), clang::Sema::CheckFloatComparison(), clang::Sema::Context, clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::ASTContext::getLogicalOperationType(), clang::Type::hasFloatingRepresentation(), clang::Sema::InvalidOperands(), clang::Type::isAnyComplexType(), clang::Type::isArithmeticType(), clang::Type::isEnumeralType(), clang::BinaryOperator::isEqualityOp(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::QualType::isNull(), clang::BinaryOperator::isRelationalOp(), and clang::Sema::UsualArithmeticConversions().

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

## ◆ checkArithmeticOrEnumeralThreeWayCompare()

static QualType checkArithmeticOrEnumeralThreeWayCompare | ( | Sema & | S,
|  | ExprResult & | LHS,
|  | ExprResult & | RHS,
|  | SourceLocation | Loc
| ) |  |
| static

Definition at line 10121 of file SemaExpr.cpp.

References clang::Sema::CheckComparisonCategoryType(), checkThreeWayNarrowingConversion(), clang::Sema::Context, clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Type::getAs(), clang::ASTContext::getPromotedIntegerType(), clang::Type::hasFloatingRepresentation(), clang::ASTContext::hasSameUnqualifiedType(), clang::Sema::ImpCastExprToType(), clang::Sema::InvalidOperands(), clang::Type::isArithmeticType(), clang::Type::isBooleanType(), clang::Type::isEnumeralType(), clang::Type::isIntegralOrEnumerationType(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::QualType::isNull(), clang::Type::isPromotableIntegerType(), clang::PartialOrdering, clang::StrongEquality, clang::StrongOrdering, clang::Sema::UsualArithmeticConversions(), and clang::WeakEquality.

Referenced by checkArithmeticOrEnumeralCompare().

## ◆ checkBlockPointerTypesForAssignment()

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

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

It is more restrict than comparing two function pointer

Definition at line 7687 of file SemaExpr.cpp.

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

## ◆ checkBlockType()

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

Return true if the Expr is block type.

Definition at line 6989 of file SemaExpr.cpp.

References clang::Sema::Diag(), clang::Expr::getExprLoc(), and clang::Type::isBlockPointerType().

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

## ◆ CheckCommaOperands()

static QualType CheckCommaOperands | ( | Sema & | S,
|  | ExprResult & | LHS,
|  | ExprResult & | RHS,
|  | SourceLocation | Loc
| ) |  |
| static

Definition at line 11526 of file SemaExpr.cpp.

References clang::Sema::CheckPlaceholderExpr(), clang::Sema::DefaultFunctionArrayLvalueConversion(), clang::Sema::DiagnoseCommaOperator(), clang::Sema::DiagnoseUnusedExprResult(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Sema::getDiagnostics(), clang::Sema::getLangOpts(), clang::Sema::IgnoredValueConversions(), clang::DiagnosticsEngine::isIgnored(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), and clang::Sema::RequireCompleteType().

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

## ◆ checkCondition()

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

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

Definition at line 6546 of file SemaExpr.cpp.

References clang::Sema::Diag(), clang::Sema::getLangOpts(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Type::isFloatingType(), and clang::Type::isScalarType().

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

## ◆ checkConditionalBlockPointerCompatibility()

static QualType checkConditionalBlockPointerCompatibility | ( | Sema & | S,
|  | ExprResult & | LHS,
|  | ExprResult & | RHS,
|  | SourceLocation | Loc
| ) |  |
| static

Return the resulting type when the operands are both block pointers.

Definition at line 6725 of file SemaExpr.cpp.

References checkConditionalPointerCompatibility(), clang::Sema::Context, clang::Sema::Diag(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::ASTContext::getPointerType(), clang::Sema::ImpCastExprToType(), clang::Type::isBlockPointerType(), clang::Type::isVoidPointerType(), and clang::ASTContext::VoidTy.

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

## ◆ checkConditionalNullPointer()

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

Return false if the NullExpr can be promoted to PointerTy, true otherwise.

Definition at line 6583 of file SemaExpr.cpp.

References clang::Sema::Context, clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Sema::ImpCastExprToType(), clang::Type::isAnyPointerType(), clang::Type::isBlockPointerType(), and clang::Expr::NPC_ValueDependentIsNull.

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

## ◆ checkConditionalObjectPointersCompatibility()

static QualType checkConditionalObjectPointersCompatibility | ( | Sema & | S,
|  | ExprResult & | LHS,
|  | ExprResult & | RHS,
|  | SourceLocation | Loc
| ) |  |
| static

Return the resulting type when the operands are both pointers.

Definition at line 6751 of file SemaExpr.cpp.

References checkConditionalPointerCompatibility(), clang::Sema::Context, clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Type::getAs(), clang::ASTContext::getPointerType(), clang::ASTContext::getQualifiedType(), clang::QualType::getQualifiers(), clang::Sema::ImpCastExprToType(), clang::Type::isIncompleteOrObjectType(), and clang::Type::isVoidType().

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

## ◆ checkConditionalPointerCompatibility()

static QualType checkConditionalPointerCompatibility | ( | Sema & | S,
|  | ExprResult & | LHS,
|  | ExprResult & | RHS,
|  | SourceLocation | Loc
| ) |  |
| static

Checks compatibility between two pointers and return the resulting type.

Definition at line 6596 of file SemaExpr.cpp.

References clang::Type::castAs(), clang::Sema::Context, clang::Default, clang::Sema::Diag(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Qualifiers::getAddressSpace(), clang::ASTContext::getAddrSpaceQualType(), clang::Type::getAs(), clang::ASTContext::getBlockPointerType(), clang::Qualifiers::getCVRQualifiers(), clang::Sema::getLangOpts(), clang::Type::getPointeeType(), clang::ASTContext::getPointerType(), clang::ASTContext::getQualifiedType(), clang::QualType::getQualifiers(), clang::QualType::getUnqualifiedType(), clang::ASTContext::hasSameType(), clang::Sema::ImpCastExprToType(), clang::Qualifiers::isAddressSpaceSupersetOf(), clang::QualType::isNull(), clang::ASTContext::mergeTypes(), clang::Qualifiers::removeAddressSpace(), clang::Qualifiers::removeCVRQualifiers(), clang::Qualifiers::setAddressSpace(), clang::ASTContext::VoidTy, and clang::QualType::withCVRQualifiers().

Referenced by checkConditionalBlockPointerCompatibility(), and checkConditionalObjectPointersCompatibility().

## ◆ checkConditionalVoidType()

static QualType checkConditionalVoidType | ( | Sema & | S,
|  | ExprResult & | LHS,
|  | ExprResult & | RHS
| ) |  |
| static

Handle when one or both operands are void type.

Definition at line 6565 of file SemaExpr.cpp.

References clang::Sema::Context, clang::Sema::Diag(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Stmt::getBeginLoc(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Sema::ImpCastExprToType(), clang::Type::isVoidType(), and clang::ASTContext::VoidTy.

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

## ◆ CheckDeclInExpr()

static bool CheckDeclInExpr | ( | Sema & | S,
|  | SourceLocation | Loc,
|  | NamedDecl * | D
| ) |  |
| 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 2753 of file SemaExpr.cpp.

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

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

## ◆ checkDirectCallValidity()

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

Definition at line 5298 of file SemaExpr.cpp.

References clang::Sema::CheckEnableIf(), clang::Sema::Diag(), clang::Stmt::getBeginLoc(), clang::Decl::getLocation(), clang::FunctionDecl::getMinRequiredArguments(), clang::FunctionDecl::getNumParams(), clang::FunctionDecl::getSourceRange(), clang::FunctionDecl::isVariadic(), and clang::Sema::TooManyArguments().

## ◆ checkEnumComparison()

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

If two different enums are compared, raise a warning.

Definition at line 9649 of file SemaExpr.cpp.

References clang::Sema::Context, clang::Sema::Diag(), clang::Type::getAs(), clang::EnumType::getDecl(), clang::NamedDecl::getIdentifier(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::TagDecl::getTypedefNameForAnonDecl(), clang::ASTContext::hasSameUnqualifiedType(), and clang::Expr::IgnoreParenImpCasts().

Referenced by checkArithmeticOrEnumeralCompare().

## ◆ CheckExtensionTraitOperandType()

static bool CheckExtensionTraitOperandType | ( | Sema & | S,
|  | QualType | T,
|  | SourceLocation | Loc,
|  | SourceRange | ArgRange,
|  | UnaryExprOrTypeTrait | TraitKind
| ) |  |
| static

Definition at line 3623 of file SemaExpr.cpp.

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

## ◆ CheckForModifiableLvalue()

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

CheckForModifiableLvalue - Verify that E is a modifiable lvalue.

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

Definition at line 11165 of file SemaExpr.cpp.

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

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

## ◆ CheckForNullPointerDereference()

static void CheckForNullPointerDereference | ( | Sema & | S,
|  | Expr * | E
| ) |  |
| static

Definition at line 477 of file SemaExpr.cpp.

## ◆ CheckIdentityFieldAssignment()

static void CheckIdentityFieldAssignment | ( | Expr * | LHSExpr,
|  | Expr * | RHSExpr,
|  | SourceLocation | Loc,
|  | Sema & | Sema
| ) |  |
| static

Definition at line 11293 of file SemaExpr.cpp.

References clang::Sema::Diag(), clang::Type::getAs(), clang::ObjCIvarRefExpr::getBase(), clang::MemberExpr::getBase(), clang::Decl::getCanonicalDecl(), clang::ObjCIvarRefExpr::getDecl(), clang::DeclRefExpr::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(), and clang::QualType::isVolatileQualified().

Referenced by BuildOverloadedBinOp(), and clang::Sema::CheckAssignmentOperands().

## ◆ CheckIncrementDecrementOperand()

static QualType CheckIncrementDecrementOperand | ( | Sema & | S,
|  | Expr * | Op,
|  | ExprValueKind & | VK,
|  | ExprObjectKind & | OK,
|  | SourceLocation | OpLoc,
|  | bool | IsInc,
|  | bool | IsPrefix
| ) |  |
| static

CheckIncrementDecrementOperand - unlike most "Check" methods, this routine doesn't need to call UsualUnaryConversions or UsualArithmeticConversions.

Definition at line 11562 of file SemaExpr.cpp.

References clang::VectorType::AltiVecBool, checkArithmeticIncompletePointerType(), checkArithmeticOnObjCPointer(), checkArithmeticOpPointerOperand(), CheckForModifiableLvalue(), clang::Sema::CheckPlaceholderExpr(), clang::Sema::Context, clang::ASTContext::DependentTy, clang::Sema::Diag(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Type::getAs(), clang::Sema::getLangOpts(), clang::Expr::getObjectKind(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Type::isIntegerType(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::Expr::isTypeDependent(), clang::VK_LValue, and clang::VK_RValue.

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

## ◆ CheckIndirectionOperand()

static QualType CheckIndirectionOperand | ( | Sema & | S,
|  | Expr * | Op,
|  | ExprValueKind & | VK,
|  | SourceLocation | OpLoc
| ) |  |
| static

CheckIndirectionOperand - Type check unary indirection (prefix '*').

Definition at line 11962 of file SemaExpr.cpp.

References clang::Sema::CheckCompatibleReinterpretCast(), clang::Sema::CheckPlaceholderExpr(), clang::Sema::Context, clang::ASTContext::DependentTy, clang::Sema::Diag(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Type::getAs(), clang::Sema::getLangOpts(), clang::Type::getPointeeType(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Expr::IgnoreParenCasts(), clang::QualType::isCForbiddenLValueType(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::QualType::isNull(), clang::Expr::isTypeDependent(), clang::Type::isVoidType(), clang::Sema::UsualUnaryConversions(), clang::VK_LValue, and clang::VK_RValue.

## ◆ checkObjCPointerIntrospection()

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

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

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

Definition at line 12122 of file SemaExpr.cpp.

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

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

## ◆ checkObjCPointerTypesForAssignment()

static Sema::AssignConvertType checkObjCPointerTypesForAssignment | ( | Sema & | S,
|  | QualType | LHSType,
|  | QualType | RHSType
| ) |  |
| static

checkObjCPointerTypesForAssignment - Compares two objective-c pointer types for assignment compatibility.

Definition at line 7738 of file SemaExpr.cpp.

References clang::Sema::Compatible, clang::Sema::CompatiblePointerDiscardsQualifiers, clang::Sema::Context, clang::Type::getAs(), 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().

## ◆ CheckObjCTraitOperandConstraints()

static bool CheckObjCTraitOperandConstraints | ( | Sema & | S,
|  | QualType | T,
|  | SourceLocation | Loc,
|  | SourceRange | ArgRange,
|  | UnaryExprOrTypeTrait | TraitKind
| ) |  |
| static

Definition at line 3653 of file SemaExpr.cpp.

## ◆ checkOpenCLConditionVector()

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

Return false if this is a valid OpenCL condition vector.

Definition at line 6909 of file SemaExpr.cpp.

References clang::Sema::Diag(), clang::Type::getAs(), clang::VectorType::getElementType(), clang::Stmt::getSourceRange(), clang::Expr::getType(), and clang::Type::isIntegerType().

Referenced by OpenCLCheckVectorConditional().

## ◆ checkPointerIntegerMismatch()

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

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

Definition at line 6790 of file SemaExpr.cpp.

References clang::Sema::Diag(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Sema::ImpCastExprToType(), and clang::Type::isPointerType().

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

## ◆ checkPointerTypesForAssignment()

static Sema::AssignConvertType checkPointerTypesForAssignment | ( | Sema & | S,
|  | QualType | LHSType,
|  | QualType | RHSType
| ) |  |
| static

Definition at line 7563 of file SemaExpr.cpp.

References clang::Sema::Compatible, clang::Sema::CompatiblePointerDiscardsQualifiers, clang::Qualifiers::compatiblyIncludes(), clang::Qualifiers::compatiblyIncludesObjCLifetime(), clang::Sema::Context, clang::Sema::FunctionVoidPointer, clang::ASTContext::getCorrespondingUnsignedType(), clang::Sema::getLangOpts(), clang::Qualifiers::getObjCLifetime(), clang::if(), clang::Sema::IncompatibleNestedPointerQualifiers, clang::Sema::IncompatiblePointer, clang::Sema::IncompatiblePointerDiscardsQualifiers, clang::Sema::IncompatiblePointerSign, clang::Qualifiers::isAddressSpaceSupersetOf(), clang::QualType::isCanonical(), clang::Sema::IsFunctionConversion(), clang::Qualifiers::removeObjCLifetime(), clang::ASTContext::typesAreCompatible(), clang::ASTContext::UnsignedCharTy, clang::Qualifiers::withoutObjCGCAttr(), and clang::Qualifiers::withoutObjCLifetime().

## ◆ CheckRealImagOperand()

static QualType CheckRealImagOperand | ( | Sema & | S,
|  | ExprResult & | V,
|  | SourceLocation | Loc,
|  | bool | IsReal
| ) |  |
| static

Definition at line 4135 of file SemaExpr.cpp.

## ◆ checkThreeWayNarrowingConversion()

static bool checkThreeWayNarrowingConversion | ( | Sema & | S,
|  | QualType | ToType,
|  | Expr * | E,
|  | QualType | FromType,
|  | SourceLocation | Loc
| ) |  |
| static

Definition at line 10078 of file SemaExpr.cpp.

References castKindToImplicitConversionKind(), clang::Sema::Context, clang::Sema::Diag(), 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().

## ◆ CheckVecStepTraitOperandType()

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

Definition at line 3605 of file SemaExpr.cpp.

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

## ◆ checkVectorResult()

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

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

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

Definition at line 6929 of file SemaExpr.cpp.

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

Referenced by OpenCLCheckVectorConditional().

## ◆ checkVectorShift()

static QualType checkVectorShift | ( | Sema & | S,
|  | ExprResult & | LHS,
|  | ExprResult & | RHS,
|  | SourceLocation | Loc,
|  | bool | IsCompAssign
| ) |  |
| static

Return the resulting type when a vector is shifted by a scalar or vector shift amount.

Definition at line 9504 of file SemaExpr.cpp.

References clang::Sema::Context, clang::Sema::Diag(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Type::getAs(), clang::VectorType::getElementType(), clang::ASTContext::getExtVectorType(), clang::VectorType::getNumElements(), clang::ASTContext::getTypeSize(), clang::Sema::ImpCastExprToType(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::Sema::LangOpts, and clang::Sema::UsualUnaryConversions().

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

## ◆ computeConditionalNullability()

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

Compute the nullability of a conditional expression.

Definition at line 7404 of file SemaExpr.cpp.

References clang::ASTContext::getAttributedType(), clang::Type::getNullability(), clang::AttributedType::getNullabilityAttrKind(), clang::QualType::getSingleStepDesugaredType(), clang::Type::isAnyPointerType(), clang::NonNull, clang::Nullable, and clang::Unspecified.

## ◆ ConstructTransparentUnion()

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

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

Definition at line 8123 of file SemaExpr.cpp.

References clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::InitListExpr::setInitializedFieldInUnion(), clang::Expr::setType(), and clang::VK_RValue.

## ◆ convertHalfVecBinOp()

static ExprResult convertHalfVecBinOp | ( | Sema & | S,
|  | ExprResult | LHS,
|  | ExprResult | RHS,
|  | BinaryOperatorKind | Opc,
|  | QualType | ResultTy,
|  | ExprValueKind | VK,
|  | ExprObjectKind | OK,
|  | bool | IsCompAssign,
|  | SourceLocation | OpLoc,
|  | FPOptions | FPFeatures
| ) |  |
| static

Definition at line 12178 of file SemaExpr.cpp.

## ◆ convertPointersToCompositeType()

static bool convertPointersToCompositeType | ( | Sema & | S,
|  | SourceLocation | Loc,
|  | ExprResult & | LHS,
|  | ExprResult & | RHS
| ) |  |
| static

Returns false if the pointers are converted to a composite type, true otherwise.

Definition at line 9689 of file SemaExpr.cpp.

References diagnoseDistinctPointerComparison(), clang::Sema::FindCompositePointerType(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Sema::ImpCastExprToType(), clang::Sema::InvalidOperands(), clang::Type::isMemberPointerType(), and clang::Type::isPointerType().

## ◆ ConvertTokenKindToUnaryOpcode()

static UnaryOperatorKind ConvertTokenKindToUnaryOpcode | ( | tok::TokenKind | Kind | ) |
| inline static

Definition at line 12064 of file SemaExpr.cpp.

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

## ◆ ConvertUTF8ToWideString()

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

Definition at line 3060 of file SemaExpr.cpp.

## ◆ convertVector()

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

Convert vector E to a vector with the same number of elements but different element type.

Definition at line 8476 of file SemaExpr.cpp.

References clang::Sema::Context, clang::Type::getAs(), clang::Expr::getType(), clang::ASTContext::getVectorType(), clang::Sema::ImpCastExprToType(), and clang::Type::isIntegerType().

## ◆ CorrectDelayedTyposInBinOp()

static std::pair<ExprResult, ExprResult> CorrectDelayedTyposInBinOp | ( | Sema & | S,
|  | BinaryOperatorKind | Opc,
|  | Expr * | LHSExpr,
|  | Expr * | RHSExpr
| ) |  |
| static

Definition at line 12211 of file SemaExpr.cpp.

References clang::Sema::CorrectDelayedTyposInExpr(), clang::ExprError(), clang::ActionResult< PtrTy, CompressInvalid >::get(), getDeclFromExpr(), and clang::Sema::getLangOpts().

Referenced by clang::Sema::BuildBinOp(), and clang::Sema::CreateBuiltinBinOp().

## ◆ DiagnoseAdditionInShift()

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

Definition at line 12613 of file SemaExpr.cpp.

References clang::Sema::Diag(), clang::Sema::PDiag(), and SuggestParentheses().

Referenced by DiagnoseBinOpPrecedence().

## ◆ diagnoseAddressOfInvalidType()

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

Diagnose invalid operand for address of operations.

Parameters

  Type | The type of operand which cannot have its address taken.

Definition at line 11715 of file SemaExpr.cpp.

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

## ◆ diagnoseArithmeticOnFunctionPointer()

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

Diagnose invalid arithmetic on a function pointer.

Definition at line 8998 of file SemaExpr.cpp.

References clang::Sema::Diag(), clang::Sema::getLangOpts(), clang::Type::getPointeeType(), clang::Stmt::getSourceRange(), clang::Expr::getType(), and clang::Type::isAnyPointerType().

Referenced by checkArithmeticBinOpPointerOperands(), and checkArithmeticOpPointerOperand().

## ◆ diagnoseArithmeticOnNullPointer()

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

Diagnose invalid arithmetic on a null pointer.

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

Definition at line 8971 of file SemaExpr.cpp.

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

## ◆ diagnoseArithmeticOnTwoFunctionPointers()

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

Diagnose invalid arithmetic on two function pointers.

Definition at line 8982 of file SemaExpr.cpp.

References clang::Sema::Context, clang::Sema::Diag(), clang::Sema::getLangOpts(), clang::Type::getPointeeType(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::ASTContext::hasSameUnqualifiedType(), and clang::Type::isAnyPointerType().

Referenced by checkArithmeticBinOpPointerOperands().

## ◆ diagnoseArithmeticOnTwoVoidPointers()

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

Diagnose invalid arithmetic on two void pointers.

Definition at line 8948 of file SemaExpr.cpp.

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

Referenced by checkArithmeticBinOpPointerOperands().

## ◆ diagnoseArithmeticOnVoidPointer()

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

Diagnose invalid arithmetic on a void pointer.

Definition at line 8958 of file SemaExpr.cpp.

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

Referenced by checkArithmeticBinOpPointerOperands(), and checkArithmeticOpPointerOperand().

## ◆ DiagnoseBadDivideOrRemainderValues()

static void DiagnoseBadDivideOrRemainderValues | ( | Sema & | S,
|  | ExprResult & | LHS,
|  | ExprResult & | RHS,
|  | SourceLocation | Loc,
|  | bool | IsDiv
| ) |  |
| static

Definition at line 8885 of file SemaExpr.cpp.

References clang::Sema::Context, clang::Sema::DiagRuntimeBehavior(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::APValue::getInt(), clang::Sema::PDiag(), and clang::Expr::EvalResult::Val.

Referenced by clang::Sema::CheckMultiplyDivideOperands(), and clang::Sema::CheckRemainderOperands().

## ◆ DiagnoseBadShiftValues()

static void DiagnoseBadShiftValues | ( | Sema & | S,
|  | ExprResult & | LHS,
|  | ExprResult & | RHS,
|  | SourceLocation | Loc,
|  | BinaryOperatorKind | Opc,
|  | QualType | LHSType
| ) |  |
| static

Definition at line 9421 of file SemaExpr.cpp.

References clang::Sema::Context, clang::Sema::Diag(), clang::Sema::DiagRuntimeBehavior(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::APValue::getInt(), clang::Sema::getLangOpts(), clang::ASTContext::getTypeSize(), clang::Type::hasUnsignedIntegerRepresentation(), clang::LangOptions::isSignedOverflowDefined(), clang::Sema::PDiag(), and clang::Expr::EvalResult::Val.

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

## ◆ DiagnoseBinOpPrecedence()

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

DiagnoseBinOpPrecedence - Emit warnings for expressions with tricky precedence.

Definition at line 12655 of file SemaExpr.cpp.

References DiagnoseAdditionInShift(), DiagnoseBitwiseOpInBitwiseOp(), DiagnoseBitwisePrecedence(), DiagnoseLogicalAndInLogicalOrLHS(), DiagnoseLogicalAndInLogicalOrRHS(), DiagnoseShiftCompare(), clang::Sema::getASTContext(), clang::BinaryOperator::getOpcodeStr(), clang::Expr::getType(), clang::BinaryOperator::isBitwiseOp(), clang::BinaryOperator::isComparisonOp(), clang::Type::isIntegralType(), clang::SourceLocation::isMacroID(), and clang::prec::Shift.

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

## ◆ DiagnoseBitwiseOpInBitwiseOp()

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

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

Definition at line 12598 of file SemaExpr.cpp.

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

Referenced by DiagnoseBinOpPrecedence().

## ◆ DiagnoseBitwisePrecedence()

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

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

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

Definition at line 12488 of file SemaExpr.cpp.

References clang::Sema::Diag(), clang::Stmt::getBeginLoc(), clang::Stmt::getEndLoc(), clang::BinaryOperator::getOpcodeStr(), clang::BinaryOperator::getRHS(), clang::tooling::fixit::internal::getSourceRange(), clang::BinaryOperator::isBitwiseOp(), clang::BinaryOperator::isComparisonOp(), clang::Sema::PDiag(), and SuggestParentheses().

Referenced by DiagnoseBinOpPrecedence().

## ◆ DiagnoseCalleeStaticArrayParam()

static void DiagnoseCalleeStaticArrayParam | ( | Sema & | S,
|  | ParmVarDecl * | PVD
| ) |  |
| static

Definition at line 5087 of file SemaExpr.cpp.

## ◆ DiagnoseConditionalPrecedence()

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

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

Definition at line 7372 of file SemaExpr.cpp.

References clang::Sema::Diag(), ExprLooksBoolean(), clang::Stmt::getBeginLoc(), clang::Stmt::getEndLoc(), clang::BinaryOperator::getOpcodeStr(), clang::Stmt::getSourceRange(), IsArithmeticBinaryExpr(), clang::Sema::PDiag(), and SuggestParentheses().

## ◆ DiagnoseConstAssignment()

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

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

Definition at line 10976 of file SemaExpr.cpp.

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

Referenced by CheckForModifiableLvalue(), and DiagnoseRecursiveConstFields().

## ◆ DiagnoseDirectIsaAccess()

static void DiagnoseDirectIsaAccess | ( | Sema & | S,
|  | const ObjCIvarRefExpr * | OIRE,
|  | SourceLocation | AssignLoc,
|  | const Expr * | RHS
| ) |  |
| static

Definition at line 496 of file SemaExpr.cpp.

## ◆ diagnoseDistinctPointerComparison()

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

Diagnose bad pointer comparisons.

Definition at line 9678 of file SemaExpr.cpp.

References clang::Sema::Diag(), and clang::ActionResult< PtrTy, CompressInvalid >::get().

Referenced by convertPointersToCompositeType().

## ◆ DiagnoseDivisionSizeofPointer()

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

Definition at line 8859 of file SemaExpr.cpp.

References clang::Sema::Diag(), clang::Type::getPointeeType(), clang::Stmt::getSourceRange(), clang::Type::isPointerType(), and clang::UETT_SizeOf.

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

## ◆ diagnoseFunctionPointerToVoidComparison()

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

Definition at line 9720 of file SemaExpr.cpp.

References clang::Sema::Diag(), and clang::ActionResult< PtrTy, CompressInvalid >::get().

## ◆ DiagnoseLogicalAndInLogicalOrLHS()

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

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

Definition at line 12559 of file SemaExpr.cpp.

References EmitDiagnosticForLogicalAndInLogicalOr(), EvaluatesAsFalse(), and EvaluatesAsTrue().

Referenced by DiagnoseBinOpPrecedence().

## ◆ DiagnoseLogicalAndInLogicalOrRHS()

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

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

Definition at line 12581 of file SemaExpr.cpp.

References EmitDiagnosticForLogicalAndInLogicalOr(), EvaluatesAsFalse(), and EvaluatesAsTrue().

Referenced by DiagnoseBinOpPrecedence().

## ◆ diagnoseLogicalNotOnLHSofCheck()

static void diagnoseLogicalNotOnLHSofCheck | ( | Sema & | S,
|  | ExprResult & | LHS,
|  | ExprResult & | RHS,
|  | SourceLocation | Loc,
|  | BinaryOperatorKind | Opc
| ) |  |
| static

Warns on !x < y, !x & y where !(x < y), !(x & y) was probably intended.

Definition at line 9881 of file SemaExpr.cpp.

References clang::FixItHint::CreateInsertion(), clang::Sema::Diag(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Stmt::getBeginLoc(), clang::Sema::getLocForEndOfToken(), clang::UnaryOperator::getOpcode(), clang::UnaryOperator::getOperatorLoc(), clang::UnaryOperator::getSubExpr(), clang::Expr::IgnoreImpCasts(), clang::SourceLocation::isInvalid(), and clang::Expr::isKnownToHaveBooleanValue().

Referenced by clang::Sema::CheckBitwiseOperands(), and clang::Sema::CheckCompareOperands().

## ◆ diagnoseObjCLiteralComparison()

static void diagnoseObjCLiteralComparison | ( | Sema & | S,
|  | SourceLocation | Loc,
|  | ExprResult & | LHS,
|  | ExprResult & | RHS,
|  | BinaryOperator::Opcode | Opc
| ) |  |
| static

Definition at line 9831 of file SemaExpr.cpp.

References clang::Sema::CheckLiteralKind(), clang::FixItHint::CreateInsertion(), clang::FixItHint::CreateReplacement(), clang::Sema::Diag(), End, clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Sema::getASTContext(), clang::CharSourceRange::getCharRange(), clang::Sema::getLocForEndOfToken(), clang::Stmt::getSourceRange(), hasIsEqualMethod(), clang::Expr::IgnoreParenCasts(), clang::BinaryOperator::isEqualityOp(), clang::Expr::isNullPointerConstant(), isObjCObjectLiteral(), clang::Sema::LK_Block, clang::Sema::LK_None, clang::Sema::LK_String, and clang::Expr::NPC_ValueDependentIsNotNull.

## ◆ diagnosePointerIncompatibility()

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

Emit error when two pointers are incompatible.

Definition at line 9201 of file SemaExpr.cpp.

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

## ◆ DiagnoseRecursiveConstFields() [1/2]

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

Definition at line 11101 of file SemaExpr.cpp.

References clang::Sema::Diag(), clang::Type::getAs(), clang::QualType::getCanonicalType(), clang::QualType::isConstQualified(), and NestedConstMember.

Referenced by CheckForModifiableLvalue(), and DiagnoseRecursiveConstFields().

## ◆ DiagnoseRecursiveConstFields() [2/2]

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

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

Definition at line 11142 of file SemaExpr.cpp.

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

## ◆ DiagnoseSelfAssignment()

static void DiagnoseSelfAssignment | ( | Sema & | S,
|  | Expr * | LHSExpr,
|  | Expr * | RHSExpr,
|  | SourceLocation | OpLoc,
|  | bool | IsBuiltin
| ) |  |
| static

DiagnoseSelfAssignment - Emits a warning if a value is assigned to itself.

This warning suppressed in the event of macro expansions.

Definition at line 12086 of file SemaExpr.cpp.

References clang::Sema::Diag(), clang::Type::getAs(), clang::Decl::getCanonicalDecl(), clang::DeclRefExpr::getDecl(), clang::DeclRefExpr::getLocation(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::ValueDecl::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().

## ◆ DiagnoseShiftCompare()

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

Definition at line 12627 of file SemaExpr.cpp.

References clang::Sema::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::Sema::PDiag(), and SuggestParentheses().

Referenced by DiagnoseBinOpPrecedence().

## ◆ diagnoseStringPlusChar()

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

Emit a warning when adding a char literal to a string.

Definition at line 9150 of file SemaExpr.cpp.

References clang::ASTContext::CharTy, clang::FixItHint::CreateInsertion(), clang::FixItHint::CreateReplacement(), clang::Sema::Diag(), clang::Sema::getASTContext(), clang::Stmt::getBeginLoc(), clang::ASTContext::getCharWidth(), clang::Stmt::getEndLoc(), clang::Sema::getLocForEndOfToken(), clang::Type::getPointeeType(), clang::Expr::getType(), clang::CharacterLiteral::getValue(), clang::Expr::IgnoreImpCasts(), clang::Type::isAnyCharacterType(), and clang::Type::isAnyPointerType().

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

## ◆ diagnoseStringPlusInt()

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

diagnoseStringPlusInt - Emit a warning when adding an integer to a string literal.

Definition at line 9120 of file SemaExpr.cpp.

References clang::FixItHint::CreateInsertion(), clang::FixItHint::CreateReplacement(), clang::Sema::Diag(), clang::Stmt::getBeginLoc(), clang::Stmt::getEndLoc(), clang::Sema::getLocForEndOfToken(), clang::Expr::getType(), clang::Expr::IgnoreImpCasts(), and clang::Type::isIntegralOrUnscopedEnumerationType().

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

## ◆ diagnoseTautologicalComparison()

static void diagnoseTautologicalComparison | ( | Sema & | S,
|  | SourceLocation | Loc,
|  | Expr * | LHS,
|  | Expr * | RHS,
|  | BinaryOperatorKind | Opc
| ) |  |
| static

Diagnose some forms of syntactically-obvious tautological comparison.

Definition at line 9939 of file SemaExpr.cpp.

References clang::Sema::Context, clang::declaresSameEntity(), clang::Sema::DiagRuntimeBehavior(), clang::Stmt::getBeginLoc(), getCompareDecl(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::ValueDecl::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::ValueDecl::isWeak(), clang::Expr::NPC_ValueDependentIsNull, and clang::Sema::PDiag().

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

## ◆ diagnoseUncapturableValueReference()

static void diagnoseUncapturableValueReference | ( | Sema & | S,
|  | SourceLocation | loc,
|  | ValueDecl * | var,
|  | DeclContext * | DC
| ) |  |
| static

Definition at line 14786 of file SemaExpr.cpp.

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

## ◆ diagnoseUnknownAnyExpr()

static ExprResult diagnoseUnknownAnyExpr | ( | Sema & | S,
|  | Expr * | E
| ) |  |
| static

Definition at line 16646 of file SemaExpr.cpp.

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

## ◆ DiagnoseUnusedOfDecl()

static void DiagnoseUnusedOfDecl | ( | Sema & | S,
|  | NamedDecl * | D,
|  | SourceLocation | Loc
| ) |  |
| static

Definition at line 85 of file SemaExpr.cpp.

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

## ◆ diagnoseUseOfInternalDeclInInlineFunction()

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

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

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

Definition at line 145 of file SemaExpr.cpp.

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

## ◆ DoMarkVarDeclReferenced()

static void DoMarkVarDeclReferenced | ( | Sema & | SemaRef,
|  | SourceLocation | Loc,
|  | VarDecl * | Var,
|  | Expr * | E
| ) |  |
| static

Definition at line 15574 of file SemaExpr.cpp.

References clang::sema::LambdaScopeInfo::addPotentialCapture(), clang::TemplateSpecializationType::anyDependentTemplateArguments(), clang::sema::LambdaScopeInfo::CallOperator, clang::Sema::checkSpecializationVisibility(), clang::Sema::Context, clang::Sema::CurContext, clang::DeclContext::Encloses(), clang::Sema::getCurLambda(), clang::Decl::getDeclContext(), clang::VarDecl::getPointOfInstantiation(), clang::VarTemplateSpecializationDecl::getTemplateArgsInfo(), clang::VarDecl::getTemplateSpecializationKind(), clang::ValueDecl::getType(), clang::VarDecl::hasLocalStorage(), clang::Expr::IgnoreParens(), clang::Sema::InstantiateVariableDefinition(), isEvaluatableContext(), clang::DeclContext::isFunctionOrMethod(), clang::SourceLocation::isInvalid(), isOdrUseContext(), clang::Sema::isOpenMPCapturedDecl(), clang::Type::isReferenceType(), clang::isTemplateInstantiation(), clang::VarDecl::isUsableInConstantExpressions(), clang::IsVariableAConstantExpression(), IsVariableNonDependentAndAConstantExpression(), clang::Sema::LangOpts, clang::MarkVarDeclODRUsed(), clang::Sema::MaybeODRUseExprs, clang::Sema::PendingInstantiations, clang::Decl::setReferenced(), clang::VarDecl::setTemplateSpecializationKind(), clang::TSK_ExplicitInstantiationDeclaration, clang::TSK_ImplicitInstantiation, and clang::TSK_Undeclared.

Referenced by MarkExprReferenced(), and clang::Sema::MarkVariableReferenced().

## ◆ EmitDiagnosticForLogicalAndInLogicalOr()

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

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

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

Definition at line 12531 of file SemaExpr.cpp.

References clang::Sema::Diag(), clang::BinaryOperator::getOpcode(), clang::BinaryOperator::getOpcodeStr(), clang::BinaryOperator::getOperatorLoc(), clang::Stmt::getSourceRange(), clang::Sema::PDiag(), and SuggestParentheses().

Referenced by DiagnoseLogicalAndInLogicalOrLHS(), and DiagnoseLogicalAndInLogicalOrRHS().

## ◆ emitEmptyLookupTypoDiagnostic()

static void emitEmptyLookupTypoDiagnostic | ( | const TypoCorrection & | TC,
|  | Sema & | SemaRef,
|  | const CXXScopeSpec & | SS,
|  | DeclarationName | Typo,
|  | SourceLocation | TypoLoc,
|  | ArrayRef< Expr *> | Args,
|  | unsigned | DiagnosticID,
|  | unsigned | DiagnosticSuggestID
| ) |  |
| static

Definition at line 1782 of file SemaExpr.cpp.

## ◆ enclosingClassIsRelatedToClassInWhichMembersWereFound()

static bool enclosingClassIsRelatedToClassInWhichMembersWereFound | ( | const UnresolvedMemberExpr *const | UME,
|  | Sema & | S
| ) |  |
| static

Definition at line 5324 of file SemaExpr.cpp.

Referenced by tryImplicitlyCaptureThisIfImplicitMemberFunctionAccessWithDependentArgs().

## ◆ EvaluatesAsFalse()

static bool EvaluatesAsFalse | ( | Sema & | S,
|  | Expr * | E
| ) |  |
| static

Returns true if the given expression can be evaluated as a constant 'false'.

Definition at line 12552 of file SemaExpr.cpp.

References clang::Expr::EvaluateAsBooleanCondition(), clang::Sema::getASTContext(), and clang::Expr::isValueDependent().

Referenced by DiagnoseLogicalAndInLogicalOrLHS(), and DiagnoseLogicalAndInLogicalOrRHS().

## ◆ EvaluatesAsTrue()

static bool EvaluatesAsTrue | ( | Sema & | S,
|  | Expr * | E
| ) |  |
| static

Returns true if the given expression can be evaluated as a constant 'true'.

Definition at line 12544 of file SemaExpr.cpp.

References clang::Expr::EvaluateAsBooleanCondition(), clang::Sema::getASTContext(), and clang::Expr::isValueDependent().

Referenced by DiagnoseLogicalAndInLogicalOrLHS(), and DiagnoseLogicalAndInLogicalOrRHS().

## ◆ ExprLooksBoolean()

static bool ExprLooksBoolean | ( | Expr * | E | ) |
| static

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

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

Definition at line 7351 of file SemaExpr.cpp.

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

Referenced by DiagnoseConditionalPrecedence().

## ◆ getCompareDecl()

static ValueDecl* getCompareDecl | ( | Expr * | E | ) |
| static

Definition at line 9924 of file SemaExpr.cpp.

Referenced by diagnoseTautologicalComparison().

## ◆ getDeclFromExpr()

static NamedDecl* getDeclFromExpr | ( | Expr * | E | ) |
| static

Definition at line 12163 of file SemaExpr.cpp.

Referenced by attemptRecovery(), and CorrectDelayedTyposInBinOp().

## ◆ getParentOfCapturingContextOrNull()

static DeclContext* getParentOfCapturingContextOrNull | ( | DeclContext * | DC,
|  | VarDecl * | Var,
|  | SourceLocation | Loc,
|  | const bool | Diagnose,
|  | Sema & | S
| ) |  |
| static

Definition at line 14859 of file SemaExpr.cpp.

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

## ◆ getPrimaryDecl()

static ValueDecl* getPrimaryDecl | ( | Expr * | E | ) |
| static

getPrimaryDecl - Helper function for CheckAddressOfOperand().

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

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

Definition at line 11658 of file SemaExpr.cpp.

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

## ◆ getUDSuffixLoc()

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

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

Definition at line 1496 of file SemaExpr.cpp.

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

## ◆ handleComplexFloatConversion()

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

Handle arithmetic conversion with complex types.

Helper function of UsualArithmeticConversions()

Definition at line 965 of file SemaExpr.cpp.

## ◆ handleComplexIntConversion()

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

Handle conversions with GCC complex int extension.

Helper function of UsualArithmeticConversions()

Definition at line 1197 of file SemaExpr.cpp.

References clang::Type::getAsComplexIntegerType(), and clang::ComplexType::getElementType().

## ◆ handleFloatConversion()

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

Handle arithmethic conversion with floating point types.

Helper function of UsualArithmeticConversions()

Definition at line 1052 of file SemaExpr.cpp.

Referenced by OpenCLArithmeticConversions().

## ◆ handleIntegerConversion()

template<PerformCastFn doLHSCast, PerformCastFn doRHSCast>

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

Handle integer arithmetic conversions.

Helper function of UsualArithmeticConversions()

Definition at line 1147 of file SemaExpr.cpp.

References clang::Sema::Context, clang::ASTContext::getIntegerTypeOrder(), and clang::Type::hasSignedIntegerRepresentation().

## ◆ handleIntegerToComplexFloatConversion()

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

Converts an integer to complex float type.

Helper function of UsualArithmeticConversions()

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

Definition at line 943 of file SemaExpr.cpp.

## ◆ handleIntToFloatConversion()

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

Handle arithmetic conversion from integer to float.

Helper function of UsualArithmeticConversions()

Definition at line 1021 of file SemaExpr.cpp.

## ◆ hasAnyExplicitStorageClass()

static bool hasAnyExplicitStorageClass | ( | const FunctionDecl * | D | ) |
| static

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

Definition at line 129 of file SemaExpr.cpp.

References clang::Redeclarable< decl_type >::redecls(), and clang::SC_None.

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

## ◆ hasIsEqualMethod()

static bool hasIsEqualMethod | ( | Sema & | S,
|  | const Expr * | LHS,
|  | const Expr * | RHS
| ) |  |
| static

Definition at line 9743 of file SemaExpr.cpp.

References clang::Type::getAs(), clang::ObjCObjectPointerType::getPointeeType(), clang::ObjCMethodDecl::getReturnType(), clang::Expr::getType(), clang::ObjCObjectPointerType::isObjCIdType(), clang::Type::isObjCObjectPointerType(), clang::Type::isScalarType(), clang::Sema::LookupInstanceMethodInGlobalPool(), clang::Sema::LookupMethodInObjectType(), clang::Sema::LookupMethodInQualifiedType(), clang::Sema::NSAPIObj, and clang::ObjCMethodDecl::parameters().

Referenced by diagnoseObjCLiteralComparison().

## ◆ IgnoreCommaOperand()

static bool IgnoreCommaOperand | ( | const Expr * | E | ) |
| static

Definition at line 11456 of file SemaExpr.cpp.

References clang::Expr::getType(), clang::Expr::IgnoreParens(), and clang::Type::isVoidType().

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

## ◆ IsArithmeticBinaryExpr()

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

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

Definition at line 7305 of file SemaExpr.cpp.

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

Referenced by DiagnoseConditionalPrecedence().

## ◆ IsArithmeticOp()

static bool IsArithmeticOp | ( | BinaryOperatorKind | Opc | ) |
| static

Definition at line 7295 of file SemaExpr.cpp.

References clang::BinaryOperator::isAdditiveOp(), clang::BinaryOperator::isMultiplicativeOp(), and clang::BinaryOperator::isShiftOp().

Referenced by IsArithmeticBinaryExpr().

## ◆ isEvaluatableContext()

static bool isEvaluatableContext | ( | Sema & | SemaRef | ) |
| static

Are we within a context in which some evaluation could be performed (be it constant evaluation or runtime evaluation)? Sadly, this notion is not quite captured by C++'s idea of an "unevaluated context".

Definition at line 14559 of file SemaExpr.cpp.

References clang::Sema::ConstantEvaluated, clang::Sema::DiscardedStatement, clang::Sema::ExprEvalContexts, clang::Sema::PotentiallyEvaluated, clang::Sema::PotentiallyEvaluatedIfUsed, clang::Sema::Unevaluated, clang::Sema::UnevaluatedAbstract, and clang::Sema::UnevaluatedList.

Referenced by DoMarkVarDeclReferenced(), and clang::Sema::MarkFunctionReferenced().

## ◆ isImplicitlyDefinableConstexprFunction()

static bool isImplicitlyDefinableConstexprFunction | ( | FunctionDecl * | Func | ) |
| static

Definition at line 14607 of file SemaExpr.cpp.

References clang::FunctionDecl::isConstexpr(), clang::FunctionDecl::isImplicitlyInstantiable(), and clang::CXXMethodDecl::isUserProvided().

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

## ◆ isMSPropertySubscriptExpr()

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

Definition at line 4206 of file SemaExpr.cpp.

## ◆ isObjCObjectLiteral()

static bool isObjCObjectLiteral | ( | ExprResult & | E | ) |
| static

Definition at line 9730 of file SemaExpr.cpp.

References clang::ActionResult< PtrTy, CompressInvalid >::get().

Referenced by diagnoseObjCLiteralComparison().

## ◆ isOdrUseContext()

static bool isOdrUseContext | ( | Sema & | SemaRef,
|  | bool | SkipDependentUses = `true`
| ) |  |
| static

Are we within a context in which references to resolved functions or to variables result in odr-use?

Definition at line 14584 of file SemaExpr.cpp.

References clang::Sema::ConstantEvaluated, clang::Sema::CurContext, clang::Sema::DiscardedStatement, clang::Sema::ExprEvalContexts, clang::DeclContext::isDependentContext(), clang::Sema::PotentiallyEvaluated, clang::Sema::PotentiallyEvaluatedIfUsed, clang::Sema::Unevaluated, clang::Sema::UnevaluatedAbstract, and clang::Sema::UnevaluatedList.

Referenced by DoMarkVarDeclReferenced(), and clang::Sema::MarkFunctionReferenced().

## ◆ isOverflowingIntegerType()

static bool isOverflowingIntegerType | ( | ASTContext & | Ctx,
|  | QualType | T
| ) |  |
| static

Definition at line 12844 of file SemaExpr.cpp.

References clang::ASTContext::getIntWidth(), clang::ASTContext::IntTy, clang::Type::isDependentType(), clang::QualType::isNull(), and clang::Type::isPromotableIntegerType().

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

## ◆ isPlaceholderToRemoveAsArg()

static bool isPlaceholderToRemoveAsArg | ( | QualType | type | ) |
| static

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

Definition at line 5149 of file SemaExpr.cpp.

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

Referenced by checkArgsForPlaceholders().

## ◆ IsReadonlyMessage()

static bool IsReadonlyMessage | ( | Expr * | E,
|  | Sema & | S
| ) |  |
| static

Definition at line 10904 of file SemaExpr.cpp.

References clang::MemberExpr::getBase(), clang::MemberExpr::getMemberDecl(), clang::ObjCMessageExpr::getMethodDecl(), clang::Expr::IgnoreImplicit(), and clang::Expr::IgnoreParenImpCasts().

Referenced by CheckForModifiableLvalue().

## ◆ isReferenceToNonConstCapture()

static NonConstCaptureKind isReferenceToNonConstCapture | ( | Sema & | S,
|  | Expr * | E
| ) |  |
| static

Definition at line 10918 of file SemaExpr.cpp.

References clang::Sema::CurContext, clang::DeclRefExpr::getDecl(), clang::Decl::getDeclContext(), clang::DeclContext::getParent(), clang::Expr::getType(), clang::ValueDecl::getType(), clang::VarDecl::hasLocalStorage(), clang::Expr::IgnoreParens(), clang::QualType::isConstQualified(), clang::VarDecl::isInitCapture(), clang::Expr::isLValue(), NCCK_Block, NCCK_Lambda, NCCK_None, and clang::DeclRefExpr::refersToEnclosingVariableOrCapture().

Referenced by CheckForModifiableLvalue().

## ◆ isScopedEnumerationType()

static bool isScopedEnumerationType | ( | QualType | T | ) |
| static

Definition at line 9415 of file SemaExpr.cpp.

References clang::Type::getAs().

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

## ◆ IsTypeModifiable()

static bool IsTypeModifiable | ( | QualType | Ty,
|  | bool | IsDereference
| ) |  |
| static

Definition at line 10954 of file SemaExpr.cpp.

References clang::QualType::getNonReferenceType(), clang::Type::getPointeeType(), clang::QualType::isConstQualified(), and clang::Type::isPointerType().

Referenced by DiagnoseConstAssignment().

## ◆ isVariableAlreadyCapturedInScopeInfo()

static bool isVariableAlreadyCapturedInScopeInfo | ( | CapturingScopeInfo * | CSI,
|  | VarDecl * | Var,
|  | bool & | SubCapturesAreNested,
|  | QualType & | CaptureType,
|  | QualType & | DeclRefType
| ) |  |
| static

Definition at line 14828 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().

## ◆ isVariableCapturable()

static bool isVariableCapturable | ( | CapturingScopeInfo * | CSI,
|  | VarDecl * | Var,
|  | SourceLocation | Loc,
|  | const bool | Diagnose,
|  | Sema & | S
| ) |  |
| static

Definition at line 14874 of file SemaExpr.cpp.

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

## ◆ IsVariableNonDependentAndAConstantExpression()

static bool IsVariableNonDependentAndAConstantExpression | ( | VarDecl * | Var,
|  | ASTContext & | Context
| ) |  |
| inline static

Definition at line 15496 of file SemaExpr.cpp.

Referenced by DoMarkVarDeclReferenced(), and clang::Sema::UpdateMarkingForLValueToRValue().

## ◆ isVector()

static bool isVector | ( | QualType | QT,
|  | QualType | ElementType
| ) |  |
| static

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

Definition at line 7787 of file SemaExpr.cpp.

References clang::Type::getAs().

Referenced by clang::Sema::CreateBuiltinBinOp(), and needsConversionOfHalfVec().

## ◆ MarkExprReferenced()

static void MarkExprReferenced | ( | Sema & | SemaRef,
|  | SourceLocation | Loc,
|  | Decl * | D,
|  | Expr * | E,
|  | bool | MightBeOdrUse
| ) |  |
| static

Definition at line 15701 of file SemaExpr.cpp.

References clang::Sema::checkDeclIsAllowedInOpenMPTarget(), DoMarkVarDeclReferenced(), clang::MemberExpr::getBase(), clang::CXXMethodDecl::getDevirtualizedMethod(), clang::Sema::getLangOpts(), clang::MemberExpr::getMemberDecl(), clang::Sema::isInOpenMPDeclareTargetContext(), clang::CXXMethodDecl::isVirtual(), clang::Sema::MarkAnyDeclReferenced(), and clang::MemberExpr::performsVirtualDispatch().

Referenced by clang::Sema::MarkDeclRefReferenced(), and clang::Sema::MarkMemberReferenced().

## ◆ maybeDiagnoseAssignmentToFunction()

static bool maybeDiagnoseAssignmentToFunction | ( | Sema & | S,
|  | QualType | DstType,
|  | const Expr * | SrcExpr
| ) |  |
| static

Definition at line 13954 of file SemaExpr.cpp.

## ◆ maybeRebuildARCConsumingStmt()

static Expr* maybeRebuildARCConsumingStmt | ( | Stmt * | Statement | ) |
| static

Given the last statement in a statement-expression, check whether the result is a producing expression (like a call to an ns_returns_retained function) and, if so, rebuild it to hoist the release out of the full-expression.

Otherwise, return null. Cannot fail.

Definition at line 13175 of file SemaExpr.cpp.

References clang::cast(), clang::CastExpr::getCastKind(), clang::FullExpr::getSubExpr(), clang::CastExpr::getSubExpr(), clang::Expr::getType(), clang::Expr::getValueKind(), and clang::FullExpr::setSubExpr().

## ◆ needsConversionOfHalfVec()

static bool needsConversionOfHalfVec | ( | bool | OpRequiresConversion,
|  | ASTContext & | Ctx,
|  | QualType | SrcType
| ) |  |
| static

Returns true if conversion between vectors of halfs and vectors of floats is needed.

Definition at line 12232 of file SemaExpr.cpp.

References clang::ASTContext::getLangOpts(), clang::ASTContext::getTargetInfo(), clang::ASTContext::HalfTy, isVector(), and clang::TargetInfo::useFP16ConversionIntrinsics().

## ◆ OpenCLArithmeticConversions()

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

Simple conversion between integer and floating point types.

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

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

Definition at line 6820 of file SemaExpr.cpp.

References clang::Sema::Context, clang::Sema::DefaultFunctionArrayLvalueConversion(), clang::Sema::Diag(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::ASTContext::getCanonicalType(), handleFloatConversion(), clang::Type::isIntegerType(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), and clang::Type::isRealFloatingType().

Referenced by OpenCLConvertScalarsToVectors().

## ◆ OpenCLCheckVectorConditional()

static QualType OpenCLCheckVectorConditional | ( | Sema & | S,
|  | ExprResult & | Cond,
|  | ExprResult & | LHS,
|  | ExprResult & | RHS,
|  | SourceLocation | QuestionLoc
| ) |  |
| 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 6957 of file SemaExpr.cpp.

References checkOpenCLConditionVector(), clang::Sema::CheckVectorOperands(), checkVectorResult(), clang::Sema::DefaultFunctionArrayLvalueConversion(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::QualType::isNull(), and OpenCLConvertScalarsToVectors().

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

## ◆ OpenCLConvertScalarsToVectors()

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

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

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

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

Definition at line 6875 of file SemaExpr.cpp.

References clang::Sema::Context, clang::Sema::Diag(), clang::ActionResult< PtrTy, CompressInvalid >::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().

## ◆ rebuildUnknownAnyFunction()

static ExprResult rebuildUnknownAnyFunction | ( | Sema & | S,
|  | Expr * | FunctionExpr
| ) |  |
| static

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

Definition at line 16243 of file SemaExpr.cpp.

## ◆ RecordModifiableNonNullParam()

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

Definition at line 11943 of file SemaExpr.cpp.

References clang::Sema::getCurFunction(), clang::DeclRefExpr::getDecl(), clang::Decl::getDeclContext(), and clang::Decl::hasAttr().

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

## ◆ recoverFromMSUnqualifiedLookup()

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

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

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

Definition at line 2026 of file SemaExpr.cpp.

## ◆ rewriteBuiltinFunctionDecl()

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

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

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

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

Definition at line 5225 of file SemaExpr.cpp.

## ◆ ShouldLookupResultBeMultiVersionOverload()

static bool ShouldLookupResultBeMultiVersionOverload | ( | const LookupResult & | R | ) |
| static

Definition at line 2777 of file SemaExpr.cpp.

References clang::LookupResult::getFoundDecl(), and clang::LookupResult::isSingleResult().

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

## ◆ SuggestParentheses()

static void SuggestParentheses | ( | Sema & | Self,
|  | SourceLocation | Loc,
|  | const PartialDiagnostic & | Note,
|  | SourceRange | ParenRange
| ) |  |
| static

SuggestParentheses - Emit a note with a fixit hint that wraps ParenRange in parentheses.

Definition at line 7280 of file SemaExpr.cpp.

References clang::FixItHint::CreateInsertion(), clang::Sema::Diag(), clang::SourceRange::getBegin(), clang::SourceRange::getEnd(), clang::Sema::getLocForEndOfToken(), clang::SourceLocation::isFileID(), and clang::SourceLocation::isValid().

Referenced by DiagnoseAdditionInShift(), DiagnoseBitwiseOpInBitwiseOp(), DiagnoseBitwisePrecedence(), DiagnoseConditionalPrecedence(), DiagnoseShiftCompare(), and EmitDiagnosticForLogicalAndInLogicalOr().

## ◆ tryGCCVectorConvertAndSplat()

static bool tryGCCVectorConvertAndSplat | ( | Sema & | S,
|  | ExprResult * | Scalar,
|  | ExprResult * | Vector
| ) |  |
| 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 8577 of file SemaExpr.cpp.

References canConvertIntToOtherIntTy(), canConvertIntTyToFloatTy(), clang::Sema::Context, clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Type::getAs(), clang::VectorType::getElementType(), clang::ASTContext::getFloatingTypeOrder(), clang::ASTContext::getFloatTypeSemantics(), clang::ASTContext::getIntegerTypeOrder(), clang::Sema::ImpCastExprToType(), clang::Type::isArithmeticType(), clang::Type::isIntegralType(), and clang::Type::isRealFloatingType().

## ◆ tryImplicitlyCaptureThisIfImplicitMemberFunctionAccessWithDependentArgs()

static void tryImplicitlyCaptureThisIfImplicitMemberFunctionAccessWithDependentArgs | ( | Sema & | S,
|  | const UnresolvedMemberExpr *const | UME,
|  | SourceLocation | CallLoc
| ) |  |
| static

Definition at line 5366 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().

## ◆ TryTypoCorrectionForCall()

static TypoCorrection TryTypoCorrectionForCall | ( | Sema & | S,
|  | Expr * | Fn,
|  | FunctionDecl * | FDecl,
|  | ArrayRef< Expr *> | Args
| ) |  |
| static

Definition at line 4821 of file SemaExpr.cpp.

## ◆ tryVectorConvertAndSplat()

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

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

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

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

Parameters

  scalar | - if non-null, actually perform the conversions

Returns
  true if the operation fails (but without diagnosing the failure)

Definition at line 8429 of file SemaExpr.cpp.

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

## ◆ unsupportedTypeConversion()

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

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

Helper function of UsualArithmeticConversions().

Definition at line 1091 of file SemaExpr.cpp.

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

## ◆ warnOnSizeofOnArrayDecay()

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

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

Definition at line 3671 of file SemaExpr.cpp.