clang  3.7.0
Macros | Typedefs | Enumerations | Functions
SemaExpr.cpp File Reference
#include "clang/Sema/SemaInternal.h"
#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/RecursiveASTVisitor.h"
#include "clang/AST/TypeLoc.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/ParsedTemplate.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/ScopeInfo.h"
#include "clang/Sema/SemaFixItUtils.h"
#include "clang/Sema/Template.h"
#include "llvm/Support/ConvertUTF.h"
#include "clang/AST/DeclNodes.inc"
#include "clang/AST/BuiltinTypes.def"
#include "clang/AST/TypeNodes.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 PLACEHOLDER_TYPE(ID, SINGLETON_ID)
 
#define BUILTIN_TYPE(ID, SINGLETON_ID)   case BuiltinType::ID:
 
#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 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 }
 
enum  
 

Functions

static void DiagnoseUnusedOfDecl (Sema &S, NamedDecl *D, SourceLocation Loc)
 
static bool HasRedeclarationWithoutAvailabilityInCategory (const Decl *D)
 
static AvailabilityResult DiagnoseAvailabilityOfDecl (Sema &S, NamedDecl *D, SourceLocation Loc, const ObjCInterfaceDecl *UnknownObjCClass, bool ObjCPropertyAccess)
 
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. Helper function of UsualArithmeticConversions() More...
 
static QualType handleComplexFloatConversion (Sema &S, ExprResult &LHS, ExprResult &RHS, QualType LHSType, QualType RHSType, bool IsCompAssign)
 Handle arithmetic conversion with complex types. Helper function of UsualArithmeticConversions() More...
 
static QualType handleIntToFloatConversion (Sema &S, ExprResult &FloatExpr, ExprResult &IntExpr, QualType FloatTy, QualType IntTy, bool ConvertFloat, bool ConvertInt)
 Hande arithmetic conversion from integer to float. Helper function of UsualArithmeticConversions() More...
 
static QualType handleFloatConversion (Sema &S, ExprResult &LHS, ExprResult &RHS, QualType LHSType, QualType RHSType, bool IsCompAssign)
 Handle arithmethic conversion with floating point types. Helper function of UsualArithmeticConversions() 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. Helper function of UsualArithmeticConversions() More...
 
static QualType handleComplexIntConversion (Sema &S, ExprResult &LHS, ExprResult &RHS, QualType LHSType, QualType RHSType, bool IsCompAssign)
 Handle conversions with GCC complex int extension. Helper function of UsualArithmeticConversions() More...
 
static SourceLocation getUDSuffixLoc (Sema &S, SourceLocation TokLoc, unsigned Offset)
 
static ExprResult BuildCookedLiteralOperatorCall (Sema &S, Scope *Scope, IdentifierInfo *UDSuffix, SourceLocation UDSuffixLoc, ArrayRef< Expr * > Args, SourceLocation LitEndLoc)
 
static void emitEmptyLookupTypoDiagnostic (const TypoCorrection &TC, Sema &SemaRef, const CXXScopeSpec &SS, DeclarationName Typo, SourceLocation TypoLoc, ArrayRef< Expr * > Args, unsigned DiagnosticID, unsigned DiagnosticSuggestID)
 
static ExprrecoverFromMSUnqualifiedLookup (Sema &S, ASTContext &Context, DeclarationNameInfo &NameInfo, SourceLocation TemplateKWLoc, const TemplateArgumentListInfo *TemplateArgs)
 
static bool CheckDeclInExpr (Sema &S, SourceLocation Loc, NamedDecl *D)
 
static void ConvertUTF8ToWideString (unsigned CharByteWidth, StringRef Source, SmallString< 32 > &Target)
 
static ExprBuildFloatingLiteral (Sema &S, NumericLiteralParser &Literal, QualType Ty, SourceLocation Loc)
 
static bool CheckVecStepTraitOperandType (Sema &S, QualType T, SourceLocation Loc, SourceRange ArgRange)
 
static bool 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)
 
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 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)
 
static bool isPlaceholderToRemoveAsArg (QualType type)
 
static bool checkArgsForPlaceholders (Sema &S, MultiExprArg args)
 
static FunctionDeclrewriteBuiltinFunctionDecl (Sema *Sema, ASTContext &Context, const FunctionDecl *FDecl, MultiExprArg ArgExprs)
 
static bool breakDownVectorType (QualType type, uint64_t &len, QualType &eltType)
 
static bool VectorTypesMatch (Sema &S, QualType srcTy, QualType destTy)
 
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 void SuggestParentheses (Sema &Self, SourceLocation Loc, const PartialDiagnostic &Note, SourceRange ParenRange)
 
static bool IsArithmeticOp (BinaryOperatorKind Opc)
 
static bool IsArithmeticBinaryExpr (Expr *E, BinaryOperatorKind *Opcode, Expr **RHSExprs)
 
static bool IsLogicOp (BinaryOperatorKind Opc)
 
static bool ExprLooksBoolean (Expr *E)
 
static void DiagnoseConditionalPrecedence (Sema &Self, SourceLocation OpLoc, Expr *Condition, Expr *LHSExpr, Expr *RHSExpr)
 
static Sema::AssignConvertType checkPointerTypesForAssignment (Sema &S, QualType LHSType, QualType RHSType)
 
static Sema::AssignConvertType checkBlockPointerTypesForAssignment (Sema &S, QualType LHSType, QualType RHSType)
 
static Sema::AssignConvertType checkObjCPointerTypesForAssignment (Sema &S, QualType LHSType, QualType RHSType)
 
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)
 
static void checkArithmeticNull (Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompare)
 
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 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. pointer operands. More...
 
static void diagnoseStringPlusInt (Sema &Self, SourceLocation OpLoc, Expr *LHSExpr, Expr *RHSExpr)
 
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, unsigned Opc, QualType LHSType)
 
static QualType checkOpenCLVectorShift (Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign)
 Return the resulting type when an OpenCL vector is shifted by a scalar or vector shift amount. More...
 
static bool IsWithinTemplateSpecialization (Decl *D)
 
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 diagnoseLogicalNotOnLHSofComparison (Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, unsigned OpaqueOpc)
 
static ValueDeclgetCompareDecl (Expr *E)
 
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)
 
static bool CheckForModifiableLvalue (Expr *E, SourceLocation Loc, Sema &S)
 
static void CheckIdentityFieldAssignment (Expr *LHSExpr, Expr *RHSExpr, SourceLocation Loc, Sema &Sema)
 
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)
 
static ValueDeclgetPrimaryDecl (Expr *E)
 
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)
 
static void checkObjCPointerIntrospection (Sema &S, ExprResult &L, ExprResult &R, SourceLocation OpLoc)
 
static NamedDeclgetDeclFromExpr (Expr *E)
 
static void DiagnoseBitwisePrecedence (Sema &Self, BinaryOperatorKind Opc, SourceLocation OpLoc, Expr *LHSExpr, Expr *RHSExpr)
 
static void EmitDiagnosticForBitwiseAndInBitwiseOr (Sema &Self, SourceLocation OpLoc, BinaryOperator *Bop)
 It accepts a '&' expr that is inside a '|' one. Emit a diagnostic together with a fixit hint that wraps the '&' expression in parentheses. More...
 
static void EmitDiagnosticForLogicalAndInLogicalOr (Sema &Self, SourceLocation OpLoc, BinaryOperator *Bop)
 It accepts a '&&' expr that is inside a '||' one. Emit a diagnostic together with a fixit hint that wraps the '&&' expression in parentheses. 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 DiagnoseBitwiseAndInBitwiseOr (Sema &S, SourceLocation OpLoc, Expr *OrArg)
 Look for '&' in the left or right hand of a '|' expr. 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)
 
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 isQualifiedMemberAccess (Expr *E)
 Determine whether the given expression is a qualified member access expression, of a form that could be turned into a pointer to member with the address-of operator. More...
 
static ExprmaybeRebuildARCConsumingStmt (Stmt *Statement)
 
static bool IsPotentiallyEvaluatedContext (Sema &SemaRef)
 
static void diagnoseUncapturableValueReference (Sema &S, SourceLocation loc, VarDecl *var, DeclContext *DC)
 
static bool isVariableAlreadyCapturedInScopeInfo (CapturingScopeInfo *CSI, VarDecl *Var, bool &SubCapturesAreNested, QualType &CaptureType, QualType &DeclRefType)
 
static DeclContextgetParentOfCapturingContextOrNull (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, VarDecl *Var, 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 OdrUse)
 
static ExprResult diagnoseUnknownAnyExpr (Sema &S, Expr *E)
 

Macro Definition Documentation

#define ABSTRACT_DECL (   kind)
#define ABSTRACT_TYPE (   Class,
  Base 
)
#define BUILTIN_TYPE (   ID,
  SINGLETON_ID 
)    case BuiltinType::ID:
#define BUILTIN_TYPE (   Id,
  SingletonId 
)    case BuiltinType::Id:
#define DECL (   type,
  base 
)    case Decl::type:
#define DEPENDENT_TYPE (   Class,
  Base 
)    case Type::Class:
#define NON_CANONICAL_TYPE (   Class,
  Base 
)
#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE (   Class,
  Base 
)
#define PLACEHOLDER_TYPE (   ID,
  SINGLETON_ID 
)
#define PLACEHOLDER_TYPE (   Id,
  SingletonId 
)
#define TYPE (   Class,
  Base 
)
#define VALUE (   type,
  base 
)

Typedef Documentation

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

Definition at line 1128 of file SemaExpr.cpp.

Enumeration Type Documentation

anonymous enum

Definition at line 9629 of file SemaExpr.cpp.

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

Function Documentation

static void addAsFieldToClosureType ( Sema S,
LambdaScopeInfo LSI,
VarDecl Var,
QualType  FieldType,
QualType  DeclRefType,
SourceLocation  Loc,
bool  RefersToCapturedVariable 
)
static
static bool breakDownVectorType ( QualType  type,
uint64_t &  len,
QualType eltType 
)
static
static ExprResult BuildCookedLiteralOperatorCall ( Sema S,
Scope Scope,
IdentifierInfo UDSuffix,
SourceLocation  UDSuffixLoc,
ArrayRef< Expr * >  Args,
SourceLocation  LitEndLoc 
)
static
static Expr* BuildFloatingLiteral ( Sema S,
NumericLiteralParser Literal,
QualType  Ty,
SourceLocation  Loc 
)
static
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 10492 of file SemaExpr.cpp.

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

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

static bool captureInBlock ( BlockScopeInfo BSI,
VarDecl Var,
SourceLocation  Loc,
const bool  BuildAndDiagnose,
QualType CaptureType,
QualType DeclRefType,
const bool  Nested,
Sema S 
)
static
static bool captureInCapturedRegion ( CapturedRegionScopeInfo RSI,
VarDecl Var,
SourceLocation  Loc,
const bool  BuildAndDiagnose,
QualType CaptureType,
QualType DeclRefType,
const bool  RefersToCapturedVariable,
Sema S 
)
static
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
static bool CheckAlignOfExpr ( Sema S,
Expr E 
)
static
static bool checkArgsForPlaceholders ( Sema S,
MultiExprArg  args 
)
static
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 7588 of file SemaExpr.cpp.

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

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

static bool checkArithmeticIncompletePointerType ( Sema S,
SourceLocation  Loc,
Expr Operand 
)
static
static void checkArithmeticNull ( Sema S,
ExprResult LHS,
ExprResult RHS,
SourceLocation  Loc,
bool  IsCompare 
)
static
static bool checkArithmeticOnObjCPointer ( Sema S,
SourceLocation  opLoc,
Expr op 
)
static
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 7556 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 clang::Sema::CheckAdditionOperands(), CheckIncrementDecrementOperand(), and clang::Sema::CheckSubtractionOperands().

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

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

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

static QualType CheckCommaOperands ( Sema S,
ExprResult LHS,
ExprResult RHS,
SourceLocation  Loc 
)
static
static bool checkCondition ( Sema S,
Expr Cond,
SourceLocation  QuestionLoc 
)
static

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

Definition at line 5710 of file SemaExpr.cpp.

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

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

static QualType checkConditionalBlockPointerCompatibility ( Sema S,
ExprResult LHS,
ExprResult RHS,
SourceLocation  Loc 
)
static
static bool checkConditionalNullPointer ( Sema S,
ExprResult NullExpr,
QualType  PointerTy 
)
static
static QualType checkConditionalObjectPointersCompatibility ( Sema S,
ExprResult LHS,
ExprResult RHS,
SourceLocation  Loc 
)
static
static QualType checkConditionalPointerCompatibility ( Sema S,
ExprResult LHS,
ExprResult RHS,
SourceLocation  Loc 
)
static
static QualType checkConditionalVoidType ( Sema S,
ExprResult LHS,
ExprResult RHS 
)
static
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 2744 of file SemaExpr.cpp.

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

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

static void checkEnumComparison ( Sema S,
SourceLocation  Loc,
Expr LHS,
Expr RHS 
)
static
static bool CheckExtensionTraitOperandType ( Sema S,
QualType  T,
SourceLocation  Loc,
SourceRange  ArgRange,
UnaryExprOrTypeTrait  TraitKind 
)
static
static bool CheckForModifiableLvalue ( Expr E,
SourceLocation  Loc,
Sema S 
)
static
static void CheckForNullPointerDereference ( Sema S,
Expr E 
)
static
static void CheckIdentityFieldAssignment ( Expr LHSExpr,
Expr RHSExpr,
SourceLocation  Loc,
Sema Sema 
)
static
static QualType CheckIncrementDecrementOperand ( Sema S,
Expr Op,
ExprValueKind VK,
ExprObjectKind OK,
SourceLocation  OpLoc,
bool  IsInc,
bool  IsPrefix 
)
static
static QualType CheckIndirectionOperand ( Sema S,
Expr Op,
ExprValueKind VK,
SourceLocation  OpLoc 
)
static
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 10023 of file SemaExpr.cpp.

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

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

static Sema::AssignConvertType checkObjCPointerTypesForAssignment ( Sema S,
QualType  LHSType,
QualType  RHSType 
)
static
static bool CheckObjCTraitOperandConstraints ( Sema S,
QualType  T,
SourceLocation  Loc,
SourceRange  ArgRange,
UnaryExprOrTypeTrait  TraitKind 
)
static
static bool checkOpenCLConditionVector ( Sema S,
Expr Cond,
SourceLocation  QuestionLoc 
)
static

Return false if this is a valid OpenCL condition vector.

Definition at line 6015 of file SemaExpr.cpp.

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

Referenced by OpenCLCheckVectorConditional().

static QualType checkOpenCLVectorShift ( Sema S,
ExprResult LHS,
ExprResult RHS,
SourceLocation  Loc,
bool  IsCompAssign 
)
static
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 5896 of file SemaExpr.cpp.

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

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

static Sema::AssignConvertType checkPointerTypesForAssignment ( Sema S,
QualType  LHSType,
QualType  RHSType 
)
static
static QualType CheckRealImagOperand ( Sema S,
ExprResult V,
SourceLocation  Loc,
bool  IsReal 
)
static
static bool CheckVecStepTraitOperandType ( Sema S,
QualType  T,
SourceLocation  Loc,
SourceRange  ArgRange 
)
static
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 6035 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().

static void ConstructTransparentUnion ( Sema S,
ASTContext C,
ExprResult EResult,
QualType  UnionType,
FieldDecl Field 
)
static
static bool convertPointersToCompositeType ( Sema S,
SourceLocation  Loc,
ExprResult LHS,
ExprResult RHS 
)
static
static UnaryOperatorKind ConvertTokenKindToUnaryOpcode ( tok::TokenKind  Kind)
inlinestatic
static void ConvertUTF8ToWideString ( unsigned  CharByteWidth,
StringRef  Source,
SmallString< 32 > &  Target 
)
static

Definition at line 3006 of file SemaExpr.cpp.

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

static void DiagnoseAdditionInShift ( Sema S,
SourceLocation  OpLoc,
Expr SubExpr,
StringRef  Shift 
)
static
static void diagnoseAddressOfInvalidType ( Sema S,
SourceLocation  Loc,
Expr E,
unsigned  Type 
)
static

Diagnose invalid operand for address of operations.

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

Definition at line 9640 of file SemaExpr.cpp.

References clang::Sema::Diag().

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

static void diagnoseArithmeticOnFunctionPointer ( Sema S,
SourceLocation  Loc,
Expr Pointer 
)
static
static void diagnoseArithmeticOnTwoFunctionPointers ( Sema S,
SourceLocation  Loc,
Expr LHS,
Expr RHS 
)
static
static void diagnoseArithmeticOnTwoVoidPointers ( Sema S,
SourceLocation  Loc,
Expr LHSExpr,
Expr RHSExpr 
)
static

Diagnose invalid arithmetic on two void pointers.

Definition at line 7486 of file SemaExpr.cpp.

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

Referenced by checkArithmeticBinOpPointerOperands().

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

Diagnose invalid arithmetic on a void pointer.

Definition at line 7496 of file SemaExpr.cpp.

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

Referenced by checkArithmeticBinOpPointerOperands(), and checkArithmeticOpPointerOperand().

static AvailabilityResult DiagnoseAvailabilityOfDecl ( Sema S,
NamedDecl D,
SourceLocation  Loc,
const ObjCInterfaceDecl UnknownObjCClass,
bool  ObjCPropertyAccess 
)
static
static void DiagnoseBadShiftValues ( Sema S,
ExprResult LHS,
ExprResult RHS,
SourceLocation  Loc,
unsigned  Opc,
QualType  LHSType 
)
static
static void DiagnoseBinOpPrecedence ( Sema Self,
BinaryOperatorKind  Opc,
SourceLocation  OpLoc,
Expr LHSExpr,
Expr RHSExpr 
)
static
static void DiagnoseBitwiseAndInBitwiseOr ( Sema S,
SourceLocation  OpLoc,
Expr OrArg 
)
static

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

Definition at line 10393 of file SemaExpr.cpp.

References clang::BO_And, and EmitDiagnosticForBitwiseAndInBitwiseOr().

Referenced by DiagnoseBinOpPrecedence().

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

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

Referenced by DiagnoseBinOpPrecedence().

static void DiagnoseCalleeStaticArrayParam ( Sema S,
ParmVarDecl PVD 
)
static
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 6446 of file SemaExpr.cpp.

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

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

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

References clang::Sema::Diag(), clang::SourceRange::getBegin(), clang::Sema::getFunctionLevelDeclContext(), clang::Decl::getLocation(), clang::FunctionDecl::getReturnType(), clang::FunctionDecl::getReturnTypeSourceRange(), clang::Expr::IgnoreParenImpCasts(), and IsTypeModifiable().

Referenced by CheckForModifiableLvalue().

static void DiagnoseDirectIsaAccess ( Sema S,
const ObjCIvarRefExpr OIRE,
SourceLocation  AssignLoc,
const Expr RHS 
)
static
static void diagnoseDistinctPointerComparison ( Sema S,
SourceLocation  Loc,
ExprResult LHS,
ExprResult RHS,
bool  IsError 
)
static

Diagnose bad pointer comparisons.

Definition at line 8163 of file SemaExpr.cpp.

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

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

static void diagnoseFunctionPointerToVoidComparison ( Sema S,
SourceLocation  Loc,
ExprResult LHS,
ExprResult RHS,
bool  IsError 
)
static
static void DiagnoseLogicalAndInLogicalOrLHS ( Sema S,
SourceLocation  OpLoc,
Expr LHSExpr,
Expr RHSExpr 
)
static

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

Definition at line 10356 of file SemaExpr.cpp.

References clang::BO_LAnd, clang::BO_LOr, EmitDiagnosticForLogicalAndInLogicalOr(), EvaluatesAsFalse(), and EvaluatesAsTrue().

Referenced by DiagnoseBinOpPrecedence().

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

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

Definition at line 10378 of file SemaExpr.cpp.

References clang::BO_LAnd, EmitDiagnosticForLogicalAndInLogicalOr(), EvaluatesAsFalse(), and EvaluatesAsTrue().

Referenced by DiagnoseBinOpPrecedence().

static void diagnoseLogicalNotOnLHSofComparison ( Sema S,
ExprResult LHS,
ExprResult RHS,
SourceLocation  Loc,
unsigned  OpaqueOpc 
)
static
static void diagnoseObjCLiteralComparison ( Sema S,
SourceLocation  Loc,
ExprResult LHS,
ExprResult RHS,
BinaryOperator::Opcode  Opc 
)
static
static void diagnosePointerIncompatibility ( Sema S,
SourceLocation  Loc,
Expr LHSExpr,
Expr RHSExpr 
)
static

Emit error when two pointers are incompatible.

Definition at line 7733 of file SemaExpr.cpp.

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

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

static void DiagnoseSelfAssignment ( Sema S,
Expr LHSExpr,
Expr RHSExpr,
SourceLocation  OpLoc 
)
static

DiagnoseSelfAssignment - Emits a warning if a value is assigned to itself. This warning is only emitted for builtin assignment operations. It is also suppressed in the event of macro expansions.

Definition at line 9990 of file SemaExpr.cpp.

References clang::Sema::ActiveTemplateInstantiations, clang::Sema::Diag(), clang::Type::getAs(), clang::Decl::getCanonicalDecl(), clang::DeclRefExpr::getDecl(), clang::DeclRefExpr::getLocation(), clang::Expr::getType(), clang::ValueDecl::getType(), clang::Expr::IgnoreParenImpCasts(), clang::SourceLocation::isInvalid(), clang::SourceLocation::isMacroID(), and clang::QualType::isVolatileQualified().

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

static void DiagnoseShiftCompare ( Sema S,
SourceLocation  OpLoc,
Expr LHSExpr,
Expr RHSExpr 
)
static
static void diagnoseStringPlusChar ( Sema Self,
SourceLocation  OpLoc,
Expr LHSExpr,
Expr RHSExpr 
)
static
static void diagnoseStringPlusInt ( Sema Self,
SourceLocation  OpLoc,
Expr LHSExpr,
Expr RHSExpr 
)
static
static void diagnoseUncapturableValueReference ( Sema S,
SourceLocation  loc,
VarDecl var,
DeclContext DC 
)
static
static ExprResult diagnoseUnknownAnyExpr ( Sema S,
Expr E 
)
static
static void DiagnoseUnusedOfDecl ( Sema S,
NamedDecl D,
SourceLocation  Loc 
)
static
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 256 of file SemaExpr.cpp.

References Current, clang::Sema::Diag(), clang::Sema::getCurFunctionDecl(), clang::NamedDecl::getFormalLinkage(), clang::Sema::getLangOpts(), clang::Sema::getSourceManager(), clang::Decl::hasAttr(), clang::InternalLinkage, clang::NamedDecl::isExternallyVisible(), clang::FunctionDecl::isInlined(), clang::SourceManager::isInMainFile(), and clang::Sema::MaybeSuggestAddingStaticToDecl().

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

static void DoMarkVarDeclReferenced ( Sema SemaRef,
SourceLocation  Loc,
VarDecl Var,
Expr E 
)
static
static void EmitDiagnosticForBitwiseAndInBitwiseOr ( 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 10313 of file SemaExpr.cpp.

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

Referenced by DiagnoseBitwiseAndInBitwiseOr().

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

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

Referenced by DiagnoseLogicalAndInLogicalOrLHS(), and DiagnoseLogicalAndInLogicalOrRHS().

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

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

Definition at line 10349 of file SemaExpr.cpp.

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

Referenced by DiagnoseLogicalAndInLogicalOrLHS(), and DiagnoseLogicalAndInLogicalOrRHS().

static bool EvaluatesAsTrue ( Sema S,
Expr E 
)
static

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

Definition at line 10341 of file SemaExpr.cpp.

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

Referenced by DiagnoseLogicalAndInLogicalOrLHS(), and DiagnoseLogicalAndInLogicalOrRHS().

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

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

Referenced by DiagnoseConditionalPrecedence().

static ValueDecl* getCompareDecl ( Expr E)
static

Definition at line 8424 of file SemaExpr.cpp.

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

static NamedDecl* getDeclFromExpr ( Expr E)
static

Definition at line 10064 of file SemaExpr.cpp.

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

static DeclContext* getParentOfCapturingContextOrNull ( DeclContext DC,
VarDecl Var,
SourceLocation  Loc,
const bool  Diagnose,
Sema S 
)
static
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 9583 of file SemaExpr.cpp.

References clang::UnaryOperator::getOpcode(), clang::UnaryOperator::getSubExpr(), clang::UO_Extension, clang::UO_Imag, and clang::UO_Real.

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

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

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

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

static QualType handleComplexFloatConversion ( Sema S,
ExprResult LHS,
ExprResult RHS,
QualType  LHSType,
QualType  RHSType,
bool  IsCompAssign 
)
static
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 1196 of file SemaExpr.cpp.

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

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

static QualType handleFloatConversion ( Sema S,
ExprResult LHS,
ExprResult RHS,
QualType  LHSType,
QualType  RHSType,
bool  IsCompAssign 
)
static
template<PerformCastFn doLHSCast, PerformCastFn doRHSCast>
static QualType handleIntegerConversion ( Sema S,
ExprResult LHS,
ExprResult RHS,
QualType  LHSType,
QualType  RHSType,
bool  IsCompAssign 
)
static
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 983 of file SemaExpr.cpp.

References clang::CK_FloatingRealToComplex, clang::CK_IntegralComplexToFloatingComplex, clang::CK_IntegralToFloating, clang::ActionResult< PtrTy, CompressInvalid >::get(), getElementType(), clang::Sema::ImpCastExprToType(), clang::Type::isComplexIntegerType(), clang::Type::isComplexType(), clang::Type::isIntegerType(), and clang::Type::isRealFloatingType().

Referenced by handleComplexFloatConversion().

static QualType handleIntToFloatConversion ( Sema S,
ExprResult FloatExpr,
ExprResult IntExpr,
QualType  FloatTy,
QualType  IntTy,
bool  ConvertFloat,
bool  ConvertInt 
)
static
static bool hasAnyExplicitStorageClass ( const FunctionDecl D)
static

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

Definition at line 240 of file SemaExpr.cpp.

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

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

static bool hasIsEqualMethod ( Sema S,
const Expr LHS,
const Expr RHS 
)
static
static bool HasRedeclarationWithoutAvailabilityInCategory ( const Decl D)
static

Definition at line 85 of file SemaExpr.cpp.

References clang::ObjCInterfaceDecl::visible_categories().

Referenced by DiagnoseAvailabilityOfDecl().

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

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

Referenced by DiagnoseConditionalPrecedence().

static bool IsArithmeticOp ( BinaryOperatorKind  Opc)
static

Definition at line 6373 of file SemaExpr.cpp.

References clang::BO_Mul, and clang::BO_Shr.

Referenced by IsArithmeticBinaryExpr().

static bool IsLogicOp ( BinaryOperatorKind  Opc)
static

Definition at line 6420 of file SemaExpr.cpp.

References clang::BO_LAnd, clang::BO_LOr, clang::BO_LT, and clang::BO_NE.

Referenced by ExprLooksBoolean().

static bool isObjCObjectLiteral ( ExprResult E)
static
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 4592 of file SemaExpr.cpp.

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

Referenced by checkArgsForPlaceholders().

static bool IsPotentiallyEvaluatedContext ( Sema SemaRef)
static
static bool isQualifiedMemberAccess ( Expr E)
static

Determine whether the given expression is a qualified member access expression, of a form that could be turned into a pointer to member with the address-of operator.

Definition at line 10760 of file SemaExpr.cpp.

References clang::NamedDecl::isCXXClassMember().

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

static bool IsReadonlyMessage ( Expr E,
Sema S 
)
static
static NonConstCaptureKind isReferenceToNonConstCapture ( Sema S,
Expr E 
)
static
static bool isScopedEnumerationType ( QualType  T)
static
static bool IsTypeModifiable ( QualType  Ty,
bool  IsDereference 
)
static
static bool isVariableAlreadyCapturedInScopeInfo ( CapturingScopeInfo CSI,
VarDecl Var,
bool SubCapturesAreNested,
QualType CaptureType,
QualType DeclRefType 
)
static
static bool isVariableCapturable ( CapturingScopeInfo CSI,
VarDecl Var,
SourceLocation  Loc,
const bool  Diagnose,
Sema S 
)
static
static bool IsVariableNonDependentAndAConstantExpression ( VarDecl Var,
ASTContext Context 
)
inlinestatic
static bool IsWithinTemplateSpecialization ( Decl D)
static

Definition at line 8125 of file SemaExpr.cpp.

References clang::Decl::getDeclContext().

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

static void MarkExprReferenced ( Sema SemaRef,
SourceLocation  Loc,
Decl D,
Expr E,
bool  OdrUse 
)
static
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 10866 of file SemaExpr.cpp.

References clang::CK_ARCConsumeObject, clang::CastExpr::getCastKind(), clang::CastExpr::getSubExpr(), clang::ExprWithCleanups::getSubExpr(), clang::Expr::getType(), clang::Expr::getValueKind(), and clang::ExprWithCleanups::setSubExpr().

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

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 5926 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(), clang::Type::isRealFloatingType(), and S.

Referenced by OpenCLConvertScalarsToVectors().

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

References clang::CK_VectorSplat, 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().

static ExprResult rebuildUnknownAnyFunction ( Sema S,
Expr FunctionExpr 
)
static
static void RecordModifiableNonNullParam ( Sema S,
const Expr Exp 
)
static
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 2025 of file SemaExpr.cpp.

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

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

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, than 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 4660 of file SemaExpr.cpp.

References clang::ASTContext::BuiltinInfo, clang::ParmVarDecl::Create(), clang::FunctionDecl::Create(), clang::Sema::DefaultFunctionArrayLvalueConversion(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Qualifiers::getAddressSpace(), clang::ASTContext::getAddrSpaceQualType(), clang::FunctionDecl::getBuiltinID(), clang::ASTContext::getFunctionType(), clang::NamedDecl::getIdentifier(), clang::Decl::getLocation(), clang::FunctionProtoType::getNumParams(), clang::FunctionProtoType::getParamType(), clang::Type::getPointeeType(), clang::ASTContext::getPointerType(), clang::QualType::getQualifiers(), clang::FunctionType::getReturnType(), clang::ASTContext::getTranslationUnitDecl(), clang::Expr::getType(), clang::ValueDecl::getType(), clang::Qualifiers::hasAddressSpace(), clang::Builtin::Context::hasPtrArgsOrResult(), clang::Type::isPointerType(), clang::FunctionProtoType::isVariadic(), clang::FunctionProtoType::param_types(), clang::SC_Extern, clang::SC_None, and clang::ParmVarDecl::setScopeInfo().

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

static void SuggestParentheses ( Sema Self,
SourceLocation  Loc,
const PartialDiagnostic Note,
SourceRange  ParenRange 
)
static
static TypoCorrection TryTypoCorrectionForCall ( Sema S,
Expr Fn,
FunctionDecl FDecl,
ArrayRef< Expr * >  Args 
)
static
static bool tryVectorConvertAndSplat ( Sema S,
ExprResult scalar,
QualType  scalarTy,
QualType  vectorEltTy,
QualType  vectorTy 
)
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.

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

Definition at line 7235 of file SemaExpr.cpp.

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

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

static bool VectorTypesMatch ( Sema S,
QualType  srcTy,
QualType  destTy 
)
static
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 3558 of file SemaExpr.cpp.

References clang::CK_ArrayToPointerDecay, clang::Sema::Diag(), clang::CastExpr::getCastKind(), clang::CastExpr::getSubExpr(), and clang::Expr::getType().

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