clang  3.7.0
Macros | Enumerations | Functions
SemaChecking.cpp File Reference
#include "clang/Sema/SemaInternal.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/CharUnits.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/EvaluatedExprVisitor.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprObjC.h"
#include "clang/AST/StmtCXX.h"
#include "clang/AST/StmtObjC.h"
#include "clang/Analysis/Analyses/FormatString.h"
#include "clang/Basic/CharInfo.h"
#include "clang/Basic/TargetBuiltins.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Lex/Lexer.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/ScopeInfo.h"
#include "clang/Sema/Sema.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/raw_ostream.h"
#include <limits>
#include "clang/Basic/Builtins.def"
#include "clang/Basic/arm_neon.inc"
Include dependency graph for SemaChecking.cpp:

Go to the source code of this file.

Macros

#define BUILTIN(ID, TYPE, ATTRS)
 
#define ATOMIC_BUILTIN(ID, TYPE, ATTRS)
 
#define GET_NEON_OVERLOAD_CHECK
 
#define GET_NEON_IMMEDIATE_CHECK
 
#define BUILTIN_ROW(x)
 

Enumerations

enum  StringLiteralCheckType
 
enum  AbsoluteValueKind { AVK_Integer, AVK_Floating, AVK_Complex }
 
enum  { AddressOf, FunctionPointer, ArrayPointer }
 

Functions

static bool checkArgCount (Sema &S, CallExpr *call, unsigned desiredArgCount)
 
static bool SemaBuiltinAnnotation (Sema &S, CallExpr *TheCall)
 
static bool SemaBuiltinAddressof (Sema &S, CallExpr *TheCall)
 
static void SemaBuiltinMemChkCall (Sema &S, FunctionDecl *FDecl, CallExpr *TheCall, unsigned SizeIdx, unsigned DstSizeIdx)
 
static bool SemaBuiltinCallWithStaticChain (Sema &S, CallExpr *BuiltinCall)
 
static bool SemaBuiltinSEHScopeCheck (Sema &SemaRef, CallExpr *TheCall, Scope::ScopeFlags NeededScopeFlags, unsigned DiagID)
 
static unsigned RFT (unsigned t, bool shift=false, bool ForceQuad=false)
 
static QualType getNeonEltType (NeonTypeFlags Flags, ASTContext &Context, bool IsPolyUnsigned, bool IsInt64Long)
 
static bool CheckNonNullExpr (Sema &S, const Expr *Expr)
 Returns true if the value evaluates to null. More...
 
static void CheckNonNullArgument (Sema &S, const Expr *ArgExpr, SourceLocation CallSiteLoc)
 
static void DiagnoseCStringFormatDirectiveInCFAPI (Sema &S, const NamedDecl *FDecl, Expr **Args, unsigned NumArgs)
 Diagnose use of s directive in an NSString which is being passed as formatting string to formatting method. More...
 
static bool isNonNullType (ASTContext &ctx, QualType type)
 Determine whether the given type has a non-null nullability annotation. More...
 
static void CheckNonNullArguments (Sema &S, const NamedDecl *FDecl, const FunctionProtoType *Proto, ArrayRef< const Expr * > Args, SourceLocation CallSiteLoc)
 
static bool isValidOrderingForOp (int64_t Ordering, AtomicExpr::AtomicOp Op)
 
static bool checkBuiltinArgument (Sema &S, CallExpr *E, unsigned ArgIndex)
 
static StringLiteralCheckType checkFormatStringExpr (Sema &S, const Expr *E, ArrayRef< const Expr * > Args, bool HasVAListArg, unsigned format_idx, unsigned firstDataArg, Sema::FormatStringType Type, Sema::VariadicCallType CallType, bool InFunctionCall, llvm::SmallBitVector &CheckedVarArgs)
 
template<typename MemberKind >
static llvm::SmallPtrSet
< MemberKind *, 1 > 
CXXRecordMembersNamed (StringRef Name, Sema &S, QualType Ty)
 
static bool requiresParensToAddCast (const Expr *E)
 
static std::pair< QualType,
StringRef > 
shouldNotPrintDirectly (const ASTContext &Context, QualType IntendedTy, const Expr *E)
 
static unsigned getLargerAbsoluteValueFunction (unsigned AbsFunction)
 
static QualType getAbsoluteValueArgumentType (ASTContext &Context, unsigned AbsType)
 
static unsigned getBestAbsFunction (ASTContext &Context, QualType ArgType, unsigned AbsFunctionKind)
 
static AbsoluteValueKind getAbsoluteValueKind (QualType T)
 
static unsigned changeAbsFunction (unsigned AbsKind, AbsoluteValueKind ValueKind)
 
static unsigned getAbsoluteValueFunctionKind (const FunctionDecl *FDecl)
 
static void emitReplacement (Sema &S, SourceLocation Loc, SourceRange Range, unsigned AbsKind, QualType ArgType)
 
static bool IsFunctionStdAbs (const FunctionDecl *FDecl)
 
static bool CheckMemorySizeofForComparison (Sema &S, const Expr *E, IdentifierInfo *FnName, SourceLocation FnLoc, SourceLocation RParenLoc)
 Takes the expression passed to the size_t parameter of functions such as memcmp, strncat, etc and warns if it's a comparison. More...
 
static const CXXRecordDeclgetContainedDynamicClass (QualType T, bool &IsContained)
 Determine whether the given type is or contains a dynamic class type (e.g., whether it has a vtable). More...
 
static const ExprgetSizeOfExprArg (const Expr *E)
 If E is a sizeof expression, returns its argument expression, otherwise returns NULL. More...
 
static QualType getSizeOfArgType (const Expr *E)
 If E is a sizeof expression, returns its argument type. More...
 
static const ExprignoreLiteralAdditions (const Expr *Ex, ASTContext &Ctx)
 
static bool isConstantSizeArrayWithMoreThanOneElement (QualType Ty, ASTContext &Context)
 
static bool referToTheSameDecl (const Expr *E1, const Expr *E2)
 Check if two expressions refer to the same declaration. More...
 
static const ExprgetStrlenExprArg (const Expr *E)
 
static ExprEvalVal (Expr *E, SmallVectorImpl< DeclRefExpr * > &refVars, Decl *ParentDecl)
 
static ExprEvalAddr (Expr *E, SmallVectorImpl< DeclRefExpr * > &refVars, Decl *ParentDecl)
 
static void CheckReturnStackAddr (Sema &S, Expr *RetValExp, QualType lhsType, SourceLocation ReturnLoc)
 
static bool CheckForReference (Sema &SemaRef, const Expr *E, PartialDiagnostic PD)
 
static bool IsInAnyMacroBody (const SourceManager &SM, SourceLocation Loc)
 
static void diagnoseArrayStarInParamType (Sema &S, QualType PType, SourceLocation Loc)
 
static const TypegetElementType (const Expr *BaseExpr)
 
static bool IsTailPaddedMemberArray (Sema &S, llvm::APInt Size, const NamedDecl *ND)
 Check whether this array fits the idiom of a size-one tail padded array member of a struct. More...
 
static bool considerVariable (VarDecl *var, Expr *ref, RetainCycleOwner &owner)
 
static bool findRetainCycleOwner (Sema &S, Expr *e, RetainCycleOwner &owner)
 
static ExprfindCapturingExpr (Sema &S, Expr *e, RetainCycleOwner &owner)
 
static void diagnoseRetainCycle (Sema &S, Expr *capturer, RetainCycleOwner &owner)
 
static bool isSetterLikeSelector (Selector sel)
 
static Optional< int > GetNSMutableArrayArgumentIndex (Sema &S, ObjCMessageExpr *Message)
 
static Optional< int > GetNSMutableDictionaryArgumentIndex (Sema &S, ObjCMessageExpr *Message)
 
static Optional< int > GetNSSetArgumentIndex (Sema &S, ObjCMessageExpr *Message)
 
static bool checkUnsafeAssignLiteral (Sema &S, SourceLocation Loc, Expr *RHS, bool isProperty)
 
static bool checkUnsafeAssignObject (Sema &S, SourceLocation Loc, Qualifiers::ObjCLifetime LT, Expr *RHS, bool isProperty)
 

Macro Definition Documentation

#define ATOMIC_BUILTIN (   ID,
  TYPE,
  ATTRS 
)
Value:
case Builtin::BI##ID: \
return SemaAtomicOpsOverloaded(TheCallResult, AtomicExpr::AO##ID);
ID
Defines the set of possible language-specific address spaces.
Definition: AddressSpaces.h:27
return(x >> y)|(x<< (32-y))
#define BUILTIN (   ID,
  TYPE,
  ATTRS 
)
#define BUILTIN_ROW (   x)
Value:
{ Builtin::BI##x##_1, Builtin::BI##x##_2, Builtin::BI##x##_4, \
Builtin::BI##x##_8, Builtin::BI##x##_16 }
#define GET_NEON_IMMEDIATE_CHECK
#define GET_NEON_OVERLOAD_CHECK

Enumeration Type Documentation

anonymous enum
Enumerator
AddressOf 
FunctionPointer 
ArrayPointer 

Definition at line 7375 of file SemaChecking.cpp.

Enumerator
AVK_Integer 
AVK_Floating 
AVK_Complex 

Definition at line 4673 of file SemaChecking.cpp.

Definition at line 2840 of file SemaChecking.cpp.

Function Documentation

static unsigned changeAbsFunction ( unsigned  AbsKind,
AbsoluteValueKind  ValueKind 
)
static

Definition at line 4692 of file SemaChecking.cpp.

References AVK_Complex, AVK_Floating, and AVK_Integer.

static bool checkArgCount ( Sema S,
CallExpr call,
unsigned  desiredArgCount 
)
static

Checks that a call expression's argument count is the desired number. This is useful when doing custom type-checking. Returns true on error.

Definition at line 52 of file SemaChecking.cpp.

References clang::Sema::Diag(), clang::CallExpr::getArg(), clang::CallExpr::getLocEnd(), and clang::CallExpr::getNumArgs().

Referenced by SemaBuiltinAddressof(), SemaBuiltinAnnotation(), and SemaBuiltinCallWithStaticChain().

static bool checkBuiltinArgument ( Sema S,
CallExpr E,
unsigned  ArgIndex 
)
static

checkBuiltinArgument - Given a call to a builtin function, perform normal type-checking on the given argument, updating the call in place. This is useful when a builtin function requires custom type-checking for some of its arguments but not necessarily all of them.

Returns true on error.

Definition at line 1827 of file SemaChecking.cpp.

References clang::Sema::Context, clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::CallExpr::getArg(), clang::CallExpr::getDirectCallee(), clang::FunctionDecl::getParamDecl(), clang::InitializedEntity::InitializeParameter(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::Sema::PerformCopyInitialization(), and clang::CallExpr::setArg().

static StringLiteralCheckType checkFormatStringExpr ( Sema S,
const Expr E,
ArrayRef< const Expr * >  Args,
bool  HasVAListArg,
unsigned  format_idx,
unsigned  firstDataArg,
Sema::FormatStringType  Type,
Sema::VariadicCallType  CallType,
bool  InFunctionCall,
llvm::SmallBitVector &  CheckedVarArgs 
)
static
static bool CheckForReference ( Sema SemaRef,
const Expr E,
PartialDiagnostic  PD 
)
static
static bool CheckMemorySizeofForComparison ( Sema S,
const Expr E,
IdentifierInfo FnName,
SourceLocation  FnLoc,
SourceLocation  RParenLoc 
)
static

Takes the expression passed to the size_t parameter of functions such as memcmp, strncat, etc and warns if it's a comparison.

This is to catch typos like if (memcmp(&a, &b, sizeof(a) > 0)).

Definition at line 4968 of file SemaChecking.cpp.

References clang::FixItHint::CreateInsertion(), clang::FixItHint::CreateRemoval(), clang::Sema::Diag(), clang::SourceRange::getBegin(), clang::SourceRange::getEnd(), clang::BinaryOperator::getLHS(), clang::Sema::getLocForEndOfToken(), clang::BinaryOperator::getOperatorLoc(), clang::BinaryOperator::isComparisonOp(), clang::BinaryOperator::isEqualityOp(), and clang::BinaryOperator::isLogicalOp().

static void CheckNonNullArgument ( Sema S,
const Expr ArgExpr,
SourceLocation  CallSiteLoc 
)
static

Definition at line 1144 of file SemaChecking.cpp.

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

Referenced by CheckNonNullArguments().

static void CheckNonNullArguments ( Sema S,
const NamedDecl FDecl,
const FunctionProtoType Proto,
ArrayRef< const Expr * >  Args,
SourceLocation  CallSiteLoc 
)
static
static bool CheckNonNullExpr ( Sema S,
const Expr Expr 
)
static

Returns true if the value evaluates to null.

Checks if a the given expression evaluates to null.

Definition at line 1118 of file SemaChecking.cpp.

References clang::Sema::Context, clang::Expr::EvaluateAsBooleanCondition(), clang::Type::getAsUnionType(), clang::Type::getNullability(), clang::Expr::getType(), clang::Expr::IgnoreImplicit(), clang::Expr::isValueDependent(), and clang::NonNull.

Referenced by CheckNonNullArgument().

static void CheckReturnStackAddr ( Sema S,
Expr RetValExp,
QualType  lhsType,
SourceLocation  ReturnLoc 
)
static

CheckReturnStackAddr - Check if a return statement returns the address of a stack variable.

Definition at line 5435 of file SemaChecking.cpp.

References clang::Sema::Diag(), EvalAddr(), EvalVal(), clang::NamedDecl::getDeclName(), clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::Type::isBlockPointerType(), clang::Type::isPointerType(), and clang::Type::isReferenceType().

static bool checkUnsafeAssignLiteral ( Sema S,
SourceLocation  Loc,
Expr RHS,
bool  isProperty 
)
static
static bool checkUnsafeAssignObject ( Sema S,
SourceLocation  Loc,
Qualifiers::ObjCLifetime  LT,
Expr RHS,
bool  isProperty 
)
static
static bool considerVariable ( VarDecl var,
Expr ref,
RetainCycleOwner &  owner 
)
static

Consider whether capturing the given variable can possibly lead to a retain cycle.

Definition at line 8514 of file SemaChecking.cpp.

References clang::QualType::getObjCLifetime(), clang::ValueDecl::getType(), and clang::Qualifiers::OCL_Strong.

Referenced by clang::Sema::checkRetainCycles(), and findRetainCycleOwner().

template<typename MemberKind >
static llvm::SmallPtrSet<MemberKind*, 1> CXXRecordMembersNamed ( StringRef  Name,
Sema S,
QualType  Ty 
)
static
static void diagnoseArrayStarInParamType ( Sema S,
QualType  PType,
SourceLocation  Loc 
)
static
static void DiagnoseCStringFormatDirectiveInCFAPI ( Sema S,
const NamedDecl FDecl,
Expr **  Args,
unsigned  NumArgs 
)
static
static void diagnoseRetainCycle ( Sema S,
Expr capturer,
RetainCycleOwner &  owner 
)
static

Definition at line 8695 of file SemaChecking.cpp.

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

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

static void emitReplacement ( Sema S,
SourceLocation  Loc,
SourceRange  Range,
unsigned  AbsKind,
QualType  ArgType 
)
static
static Expr * EvalAddr ( Expr E,
SmallVectorImpl< DeclRefExpr * > &  refVars,
Decl ParentDecl 
)
static

EvalAddr - EvalAddr and EvalVal are mutually recursive functions that check if the expression in a return statement evaluates to an address to a location on the stack, a local block, an address of a label, or a reference to local temporary. The recursion is used to traverse the AST of the return expression, with recursion backtracking when we encounter a subexpression that (1) clearly does not lead to one of the above problematic expressions (2) is something we cannot determine leads to a problematic expression based on such local checking.

Both EvalAddr and EvalVal follow through reference variables to evaluate the expression that they point to. Such variables are added to the 'refVars' vector so that we know what the reference variable "trail" was.

EvalAddr processes expressions that are pointers that are used as references (and not L-values). EvalVal handles all other values. At the base case of the recursion is a check for the above problematic expressions.

This implementation handles:

  • pointer-to-pointer casts
  • implicit conversions from array references to pointers
  • taking the address of fields
  • arbitrary interplay between "&" and "*" operators
  • pointer arithmetic from an address of a stack variable
  • taking the address of an array element where the array is on the stack

Definition at line 5521 of file SemaChecking.cpp.

References clang::BO_Add, clang::BO_Sub, AttributeLangSupport::C, clang::CK_AnyPointerToBlockPointerCast, clang::CK_ArrayToPointerDecay, clang::CK_BaseToDerived, clang::CK_BitCast, clang::CK_BlockPointerToObjCPointerCast, clang::CK_CPointerToObjCPointerCast, clang::CK_DerivedToBase, clang::CK_Dynamic, clang::CK_LValueToRValue, clang::CK_NoOp, clang::CK_UncheckedDerivedToBase, EvalVal(), clang::DeclRefExpr::getDecl(), clang::BinaryOperator::getLHS(), clang::ConditionalOperator::getLHS(), clang::UnaryOperator::getOpcode(), clang::BinaryOperator::getOpcode(), clang::BinaryOperator::getRHS(), clang::ConditionalOperator::getRHS(), clang::UnaryOperator::getSubExpr(), clang::Expr::getType(), clang::Expr::IgnoreParens(), clang::Type::isAnyPointerType(), clang::Type::isBlockPointerType(), clang::Type::isObjCQualifiedIdType(), clang::Type::isPointerType(), clang::Expr::isTypeDependent(), clang::Type::isVoidType(), clang::DeclRefExpr::refersToEnclosingVariableOrCapture(), and clang::UO_AddrOf.

Referenced by CheckReturnStackAddr(), and EvalVal().

static Expr * EvalVal ( Expr E,
SmallVectorImpl< DeclRefExpr * > &  refVars,
Decl ParentDecl 
)
static
static Expr* findCapturingExpr ( Sema S,
Expr e,
RetainCycleOwner &  owner 
)
static
static bool findRetainCycleOwner ( Sema S,
Expr e,
RetainCycleOwner &  owner 
)
static
static QualType getAbsoluteValueArgumentType ( ASTContext Context,
unsigned  AbsType 
)
static
static unsigned getAbsoluteValueFunctionKind ( const FunctionDecl FDecl)
static
static AbsoluteValueKind getAbsoluteValueKind ( QualType  T)
static
static unsigned getBestAbsFunction ( ASTContext Context,
QualType  ArgType,
unsigned  AbsFunctionKind 
)
static
static const CXXRecordDecl* getContainedDynamicClass ( QualType  T,
bool IsContained 
)
static

Determine whether the given type is or contains a dynamic class type (e.g., whether it has a vtable).

Definition at line 4997 of file SemaChecking.cpp.

References clang::RecordDecl::fields(), clang::Type::getAsCXXRecordDecl(), clang::Type::getBaseElementTypeUnsafe(), clang::CXXRecordDecl::getDefinition(), and clang::CXXRecordDecl::isDynamicClass().

static const Type* getElementType ( const Expr BaseExpr)
static

Definition at line 8280 of file SemaChecking.cpp.

References clang::Type::getBaseElementTypeUnsafe(), clang::Type::getPointeeType(), clang::Expr::getType(), clang::QualType::getTypePtr(), clang::Type::isAnyPointerType(), and clang::Type::isArrayType().

Referenced by addAssociatedClassesAndNamespaces(), clang::Sema::BuildVectorLiteral(), clang::Sema::CheckAssignmentConstraints(), clang::Sema::CheckExtVectorCast(), CheckIncrementDecrementOperand(), computeCachedProperties(), computeLinkageInfo(), convertToComplexValue(), clang::CodeGen::CodeGenTypes::ConvertType(), clang::Sema::CreateBuiltinUnaryOp(), CreateCoercedLoad(), CreateCoercedStore(), DeduceTemplateArgumentsByTypeMatch(), emitARCLoadOperation(), emitARCStoreOperation(), clang::CodeGen::CodeGenFunction::EmitARCStoreStrongCall(), clang::CodeGen::CodeGenFunction::emitArrayLength(), clang::CodeGen::CodeGenFunction::emitByrefStructureInit(), clang::CodeGen::CodeGenFunction::EmitCall(), clang::CodeGen::CodeGenFunction::EmitComplexPrePostIncDec(), clang::CodeGen::CodeGenFunction::EmitCXXDeleteExpr(), clang::CodeGen::CodeGenFunction::EmitFunctionProlog(), clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), clang::CodeGen::CodeGenFunction::EmitMustTailThunk(), clang::CodeGen::CodeGenFunction::EmitObjCMessageExpr(), clang::CodeGen::CodeGenFunction::EmitUnaryOpLValue(), clang::CodeGen::CodeGenFunction::EmitVariablyModifiedType(), emitWriteback(), clang::CodeGen::CodeGenFunction::FinallyInfo::enter(), EnterStructPointerForCoercedAccess(), EvalAndBitcastToAPInt(), findSubobject(), clang::CodeGen::CodeGenFunction::GetAddressOfDirectBaseInCompleteClass(), clang::Type::getArrayElementTypeNoTypeQual(), clang::QualType::getBaseTypeIdentifier(), getNullForVariable(), handleIntegerToComplexFloatConversion(), InitCatchParam(), clang::Type::isIncompleteType(), IsPossiblyOpaquelyQualifiedType(), IsStructurallyEquivalent(), MarkUsedTemplateParameters(), clang::Sema::MaybeBindToTemporary(), clang::Sema::PerformImplicitConversion(), clang::Sema::PrepareScalarCast(), clang::APValue::printPretty(), clang::Sema::SemaBuiltinShuffleVector(), and clang::Sema::tryCaptureVariable().

static unsigned getLargerAbsoluteValueFunction ( unsigned  AbsFunction)
static

Definition at line 4582 of file SemaChecking.cpp.

Referenced by getBestAbsFunction().

static QualType getNeonEltType ( NeonTypeFlags  Flags,
ASTContext Context,
bool  IsPolyUnsigned,
bool  IsInt64Long 
)
static
static Optional<int> GetNSMutableArrayArgumentIndex ( Sema S,
ObjCMessageExpr Message 
)
static
static Optional<int> GetNSMutableDictionaryArgumentIndex ( Sema S,
ObjCMessageExpr Message 
)
static
static Optional<int> GetNSSetArgumentIndex ( Sema S,
ObjCMessageExpr Message 
)
static
static QualType getSizeOfArgType ( const Expr E)
static

If E is a sizeof expression, returns its argument type.

Definition at line 5038 of file SemaChecking.cpp.

References clang::UETT_SizeOf.

static const Expr* getSizeOfExprArg ( const Expr E)
static

If E is a sizeof expression, returns its argument expression, otherwise returns NULL.

Definition at line 5028 of file SemaChecking.cpp.

References clang::Expr::IgnoreParenImpCasts(), and clang::UETT_SizeOf.

static const Expr* getStrlenExprArg ( const Expr E)
static

Definition at line 5330 of file SemaChecking.cpp.

References clang::FunctionDecl::getMemoryFunctionKind().

static const Expr* ignoreLiteralAdditions ( const Expr Ex,
ASTContext Ctx 
)
static
static bool isConstantSizeArrayWithMoreThanOneElement ( QualType  Ty,
ASTContext Context 
)
static
static bool IsFunctionStdAbs ( const FunctionDecl FDecl)
static
static bool IsInAnyMacroBody ( const SourceManager SM,
SourceLocation  Loc 
)
static
static bool isNonNullType ( ASTContext ctx,
QualType  type 
)
static

Determine whether the given type has a non-null nullability annotation.

Definition at line 1203 of file SemaChecking.cpp.

References clang::Type::getNullability(), and clang::NonNull.

Referenced by CheckNonNullArguments().

static bool isSetterLikeSelector ( Selector  sel)
static

Check for a keyword selector that starts with the word 'add' or 'set'.

Definition at line 8708 of file SemaChecking.cpp.

References clang::Selector::getNameForSlot(), clang::Selector::getNumArgs(), clang::isLowercase(), and clang::Selector::isUnarySelector().

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

static bool IsTailPaddedMemberArray ( Sema S,
llvm::APInt  Size,
const NamedDecl ND 
)
static

Check whether this array fits the idiom of a size-one tail padded array member of a struct.

We avoid emitting out-of-bounds access warnings for such arrays as they are commonly used to emulate flexible arrays in C89 code.

Definition at line 8294 of file SemaChecking.cpp.

References clang::TypeLoc::getAs(), clang::Decl::getDeclContext(), clang::Expr::getExprLoc(), clang::Decl::getNextDeclInContext(), clang::TypeSourceInfo::getTypeLoc(), clang::DeclaratorDecl::getTypeSourceInfo(), clang::TypedefNameDecl::getTypeSourceInfo(), clang::SourceLocation::isMacroID(), and clang::TagDecl::isUnion().

static bool isValidOrderingForOp ( int64_t  Ordering,
AtomicExpr::AtomicOp  Op 
)
static
static bool referToTheSameDecl ( const Expr E1,
const Expr E2 
)
static

Check if two expressions refer to the same declaration.

Definition at line 5323 of file SemaChecking.cpp.

static bool requiresParensToAddCast ( const Expr E)
static

Definition at line 3967 of file SemaChecking.cpp.

References clang::Expr::IgnoreImpCasts().

static unsigned RFT ( unsigned  t,
bool  shift = false,
bool  ForceQuad = false 
)
static
static bool SemaBuiltinAddressof ( Sema S,
CallExpr TheCall 
)
static

Check that the argument to __builtin_addressof is a glvalue, and set the result type to the corresponding pointer type.

Definition at line 100 of file SemaChecking.cpp.

References clang::Sema::CheckAddressOfOperand(), checkArgCount(), clang::CallExpr::getArg(), clang::CallExpr::getLocStart(), clang::CallExpr::setArg(), and clang::Expr::setType().

static bool SemaBuiltinAnnotation ( Sema S,
CallExpr TheCall 
)
static

Check that the first argument to __builtin_annotation is an integer and the second argument is a non-wide string literal.

Definition at line 72 of file SemaChecking.cpp.

References checkArgCount(), clang::Sema::Diag(), clang::CallExpr::getArg(), clang::Expr::getType(), clang::Expr::IgnoreParenCasts(), clang::StringLiteral::isAscii(), clang::Type::isIntegerType(), and clang::Expr::setType().

static bool SemaBuiltinCallWithStaticChain ( Sema S,
CallExpr BuiltinCall 
)
static
static void SemaBuiltinMemChkCall ( Sema S,
FunctionDecl FDecl,
CallExpr TheCall,
unsigned  SizeIdx,
unsigned  DstSizeIdx 
)
static
static bool SemaBuiltinSEHScopeCheck ( Sema SemaRef,
CallExpr TheCall,
Scope::ScopeFlags  NeededScopeFlags,
unsigned  DiagID 
)
static
static std::pair<QualType, StringRef> shouldNotPrintDirectly ( const ASTContext Context,
QualType  IntendedTy,
const Expr E 
)
static