clang  8.0.0svn
Macros | Enumerations | Functions
SemaChecking.cpp File Reference
#include "clang/AST/APValue.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Attr.h"
#include "clang/AST/AttrIterator.h"
#include "clang/AST/CharUnits.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclarationName.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/NSAPI.h"
#include "clang/AST/NonTrivialTypeVisitor.h"
#include "clang/AST/OperationKinds.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/TemplateBase.h"
#include "clang/AST/Type.h"
#include "clang/AST/TypeLoc.h"
#include "clang/AST/UnresolvedSet.h"
#include "clang/Analysis/Analyses/FormatString.h"
#include "clang/Basic/AddressSpaces.h"
#include "clang/Basic/CharInfo.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/OpenCLOptions.h"
#include "clang/Basic/OperatorKinds.h"
#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/Specifiers.h"
#include "clang/Basic/SyncScope.h"
#include "clang/Basic/TargetBuiltins.h"
#include "clang/Basic/TargetCXXABI.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/TypeTraits.h"
#include "clang/Lex/Lexer.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/Ownership.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/ScopeInfo.h"
#include "clang/Sema/Sema.h"
#include "clang/Sema/SemaInternal.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Triple.h"
#include "llvm/Support/AtomicOrdering.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/Locale.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <limits>
#include <string>
#include <tuple>
#include <utility>
#include "clang/Basic/Builtins.def"
#include "clang/Basic/arm_neon.inc"
#include "clang/Basic/arm_fp16.inc"

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 }
 

Functions

static bool checkArgCount (Sema &S, CallExpr *call, unsigned desiredArgCount)
 Checks that a call expression's argument count is the desired number. More...
 
static bool SemaBuiltinAnnotation (Sema &S, CallExpr *TheCall)
 Check that the first argument to __builtin_annotation is an integer and the second argument is a non-wide string literal. More...
 
static bool SemaBuiltinMSVCAnnotation (Sema &S, CallExpr *TheCall)
 
static bool SemaBuiltinAddressof (Sema &S, CallExpr *TheCall)
 Check that the argument to __builtin_addressof is a glvalue, and set the result type to the corresponding pointer type. More...
 
static bool SemaBuiltinOverflow (Sema &S, CallExpr *TheCall)
 
static void SemaBuiltinMemChkCall (Sema &S, FunctionDecl *FDecl, CallExpr *TheCall, unsigned SizeIdx, unsigned DstSizeIdx, StringRef LikelyMacroName)
 
static bool SemaBuiltinCallWithStaticChain (Sema &S, CallExpr *BuiltinCall)
 
static bool SemaBuiltinSEHScopeCheck (Sema &SemaRef, CallExpr *TheCall, Scope::ScopeFlags NeededScopeFlags, unsigned DiagID)
 
static bool isBlockPointer (Expr *Arg)
 
static bool checkOpenCLBlockArgs (Sema &S, Expr *BlockArg)
 OpenCL C v2.0, s6.13.17.2 - Checks that the block parameters are all local void*, which is a requirement of device side enqueue. More...
 
static bool checkOpenCLSubgroupExt (Sema &S, CallExpr *Call)
 
static bool SemaOpenCLBuiltinNDRangeAndBlock (Sema &S, CallExpr *TheCall)
 
static bool SemaOpenCLBuiltinKernelWorkGroupSize (Sema &S, CallExpr *TheCall)
 OpenCL C v2.0, s6.13.17.6 - Check the argument to the get_kernel_work_group_size and get_kernel_preferred_work_group_size_multiple builtin functions. More...
 
static bool checkOpenCLEnqueueIntType (Sema &S, Expr *E, const QualType &IntType)
 Diagnose integer type and any valid implicit conversion to it. More...
 
static bool checkOpenCLEnqueueLocalSizeArgs (Sema &S, CallExpr *TheCall, unsigned Start, unsigned End)
 
static bool checkOpenCLEnqueueVariadicArgs (Sema &S, CallExpr *TheCall, Expr *BlockArg, unsigned NumNonVarArgs)
 OpenCL v2.0, s6.13.17.1 - Check that sizes are provided for all 'local void*' parameter of passed block. More...
 
static bool SemaOpenCLBuiltinEnqueueKernel (Sema &S, CallExpr *TheCall)
 OpenCL C v2.0, s6.13.17 - Enqueue kernel function contains four different overload formats specified in Table 6.13.17.1. More...
 
static OpenCLAccessAttr * getOpenCLArgAccess (const Decl *D)
 Returns OpenCL access qual. More...
 
static bool checkOpenCLPipeArg (Sema &S, CallExpr *Call)
 Returns true if pipe element type is different from the pointer. More...
 
static bool checkOpenCLPipePacketType (Sema &S, CallExpr *Call, unsigned Idx)
 Returns true if pipe element type is different from the pointer. More...
 
static bool SemaBuiltinRWPipe (Sema &S, CallExpr *Call)
 
static bool SemaBuiltinReserveRWPipe (Sema &S, CallExpr *Call)
 
static bool SemaBuiltinCommitRWPipe (Sema &S, CallExpr *Call)
 
static bool SemaBuiltinPipePackets (Sema &S, CallExpr *Call)
 
static bool SemaOpenCLBuiltinToAddr (Sema &S, unsigned BuiltinID, CallExpr *Call)
 
static bool CheckBuiltinTargetSupport (Sema &S, unsigned BuiltinID, CallExpr *TheCall, ArrayRef< llvm::Triple::ArchType > SupportedArchs)
 
static unsigned RFT (unsigned t, bool shift=false, bool ForceQuad=false)
 
static QualType getNeonEltType (NeonTypeFlags Flags, ASTContext &Context, bool IsPolyUnsigned, bool IsInt64Long)
 getNeonEltType - Return the QualType corresponding to the elements of the vector type specified by the NeonTypeFlags. More...
 
static bool SemaBuiltinCpuSupports (Sema &S, CallExpr *TheCall)
 SemaBuiltinCpuSupports - Handle __builtin_cpu_supports(char *). More...
 
static bool SemaBuiltinCpuIs (Sema &S, CallExpr *TheCall)
 SemaBuiltinCpuIs - Handle __builtin_cpu_is(char *). More...
 
static bool isX86_32Builtin (unsigned BuiltinID)
 
static bool CheckNonNullExpr (Sema &S, const Expr *Expr)
 Checks if a the given expression 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)
 checkBuiltinArgument - Given a call to a builtin function, perform normal type-checking on the given argument, updating the call in place. More...
 
static bool checkVAStartABI (Sema &S, unsigned BuiltinID, Expr *Fn)
 Check that the user is calling the appropriate va_start builtin for the target and calling convention. More...
 
static bool checkVAStartIsInVariadicFunction (Sema &S, Expr *Fn, ParmVarDecl **LastParam=nullptr)
 
static void sumOffsets (llvm::APSInt &Offset, llvm::APSInt Addend, BinaryOperatorKind BinOpKind, bool AddendIsRight)
 
static void CheckFormatString (Sema &S, const FormatStringLiteral *FExpr, const Expr *OrigFormatExpr, ArrayRef< const Expr *> Args, bool HasVAListArg, unsigned format_idx, unsigned firstDataArg, Sema::FormatStringType Type, bool inFunctionCall, Sema::VariadicCallType CallType, llvm::SmallBitVector &CheckedVarArgs, UncoveredArgHandler &UncoveredArg)
 
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, UncoveredArgHandler &UncoveredArg, llvm::APSInt Offset)
 
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)
 
template<std::size_t StrLen>
static bool IsStdFunction (const FunctionDecl *FDecl, const char(&Str)[StrLen])
 
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 UnaryExprOrTypeTraitExprgetAsSizeOfExpr (const Expr *E)
 
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 bool doesExprLikelyComputeSize (const Expr *SizeofExpr)
 Detect if SizeofExpr is likely to calculate the sizeof an object. More...
 
static bool isArgumentExpandedFromMacro (SourceManager &SM, SourceLocation CallLoc, SourceLocation ArgLoc)
 Check if the ArgLoc originated from a macro passed to the call at CallLoc. More...
 
static void CheckMemaccessSize (Sema &S, unsigned BId, const CallExpr *Call)
 Diagnose cases like 'memset(buf, sizeof(buf), 0)', which should have the last two arguments transposed. 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 IntRange GetValueRange (ASTContext &C, llvm::APSInt &value, unsigned MaxWidth)
 
static IntRange GetValueRange (ASTContext &C, APValue &result, QualType Ty, unsigned MaxWidth)
 
static QualType GetExprType (const Expr *E)
 
static IntRange GetExprRange (ASTContext &C, const Expr *E, unsigned MaxWidth)
 Pseudo-evaluate the given integer expression, estimating the range of values it might take. More...
 
static IntRange GetExprRange (ASTContext &C, const Expr *E)
 
static bool IsSameFloatAfterCast (const llvm::APFloat &value, const llvm::fltSemantics &Src, const llvm::fltSemantics &Tgt)
 Checks whether the given value, which currently has the given source semantics, has the same value when coerced through the target semantics. More...
 
static bool IsSameFloatAfterCast (const APValue &value, const llvm::fltSemantics &Src, const llvm::fltSemantics &Tgt)
 Checks whether the given value, which currently has the given source semantics, has the same value when coerced through the target semantics. More...
 
static void AnalyzeImplicitConversions (Sema &S, Expr *OrigE, SourceLocation CC)
 AnalyzeImplicitConversions - Find and report any interesting implicit conversions in the given expression. More...
 
static bool IsEnumConstOrFromMacro (Sema &S, Expr *E)
 
static bool isKnownToHaveUnsignedValue (Expr *E)
 
static bool HasEnumType (Expr *E)
 
static int classifyConstantValue (Expr *Constant)
 
static bool CheckTautologicalComparison (Sema &S, BinaryOperator *E, Expr *Constant, Expr *Other, const llvm::APSInt &Value, bool RhsConstant)
 
static void AnalyzeImpConvsInComparison (Sema &S, BinaryOperator *E)
 Analyze the operands of the given comparison. More...
 
static void AnalyzeComparison (Sema &S, BinaryOperator *E)
 Implements -Wsign-compare. More...
 
static bool AnalyzeBitFieldAssignment (Sema &S, FieldDecl *Bitfield, Expr *Init, SourceLocation InitLoc)
 Analyzes an attempt to assign the given value to a bitfield. More...
 
static void AnalyzeAssignment (Sema &S, BinaryOperator *E)
 Analyze the given simple or compound assignment for warning-worthy operations. More...
 
static void DiagnoseImpCast (Sema &S, Expr *E, QualType SourceType, QualType T, SourceLocation CContext, unsigned diag, bool pruneControlFlow=false)
 Diagnose an implicit cast; purely a helper for CheckImplicitConversion. More...
 
static void DiagnoseImpCast (Sema &S, Expr *E, QualType T, SourceLocation CContext, unsigned diag, bool pruneControlFlow=false)
 Diagnose an implicit cast; purely a helper for CheckImplicitConversion. More...
 
static void DiagnoseFloatingImpCast (Sema &S, Expr *E, QualType T, SourceLocation CContext)
 Diagnose an implicit cast from a floating point value to an integer value. More...
 
static void AnalyzeCompoundAssignment (Sema &S, BinaryOperator *E)
 Analyze the given compound assignment for the possible losing of floating-point precision. More...
 
static std::string PrettyPrintInRange (const llvm::APSInt &Value, IntRange Range)
 
static bool IsImplicitBoolFloatConversion (Sema &S, Expr *Ex, bool ToBool)
 
static void CheckImplicitArgumentConversions (Sema &S, CallExpr *TheCall, SourceLocation CC)
 
static void DiagnoseNullConversion (Sema &S, Expr *E, QualType T, SourceLocation CC)
 
static void checkObjCArrayLiteral (Sema &S, QualType TargetType, ObjCArrayLiteral *ArrayLiteral)
 Check an Objective-C array literal being converted to the given target type. More...
 
static void checkObjCDictionaryLiteral (Sema &S, QualType TargetType, ObjCDictionaryLiteral *DictionaryLiteral)
 Check an Objective-C dictionary literal being converted to the given target type. More...
 
static void checkObjCCollectionLiteralElement (Sema &S, QualType TargetElementType, Expr *Element, unsigned ElementKind)
 Check a single element within a collection literal against the target element type. More...
 
static bool isSameWidthConstantConversion (Sema &S, Expr *E, QualType T, SourceLocation CC)
 
static void CheckImplicitConversion (Sema &S, Expr *E, QualType T, SourceLocation CC, bool *ICContext=nullptr)
 
static void CheckConditionalOperator (Sema &S, ConditionalOperator *E, SourceLocation CC, QualType T)
 
static void CheckConditionalOperand (Sema &S, Expr *E, QualType T, SourceLocation CC, bool &ICContext)
 
static void CheckBoolLikeConversion (Sema &S, Expr *E, SourceLocation CC)
 Check conversion of given expression to boolean. More...
 
static bool CheckForReference (Sema &SemaRef, const Expr *E, const PartialDiagnostic &PD)
 
static bool IsInAnyMacroBody (const SourceManager &SM, SourceLocation Loc)
 
static void diagnoseArrayStarInParamType (Sema &S, QualType PType, SourceLocation Loc)
 
static CharUnits getDeclAlign (Expr *E, CharUnits TypeAlign, ASTContext &Context)
 A helper function to get the alignment of a Decl referred to by DeclRefExpr or MemberExpr. More...
 
static bool IsTailPaddedMemberArray (Sema &S, const 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)
 Consider whether capturing the given variable can possibly lead to a retain cycle. More...
 
static bool findRetainCycleOwner (Sema &S, Expr *e, RetainCycleOwner &owner)
 
static ExprfindCapturingExpr (Sema &S, Expr *e, RetainCycleOwner &owner)
 Check whether the given argument is a block which captures a variable. More...
 
static void diagnoseRetainCycle (Sema &S, Expr *capturer, RetainCycleOwner &owner)
 
static bool isSetterLikeSelector (Selector sel)
 Check for a keyword selector that starts with the word 'add' or 'set'. More...
 
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)
 
static bool ShouldDiagnoseEmptyStmtBody (const SourceManager &SourceMgr, SourceLocation StmtLoc, const NullStmt *Body)
 
static bool isLayoutCompatible (ASTContext &C, QualType T1, QualType T2)
 Check if two types are layout-compatible in C++11 sense. More...
 
static bool isLayoutCompatible (ASTContext &C, EnumDecl *ED1, EnumDecl *ED2)
 Check if two enumeration types are layout-compatible. More...
 
static bool isLayoutCompatible (ASTContext &C, FieldDecl *Field1, FieldDecl *Field2)
 Check if two fields are layout-compatible. More...
 
static bool isLayoutCompatibleStruct (ASTContext &C, RecordDecl *RD1, RecordDecl *RD2)
 Check if two standard-layout structs are layout-compatible. More...
 
static bool isLayoutCompatibleUnion (ASTContext &C, RecordDecl *RD1, RecordDecl *RD2)
 Check if two standard-layout unions are layout-compatible. More...
 
static bool isLayoutCompatible (ASTContext &C, RecordDecl *RD1, RecordDecl *RD2)
 
static bool FindTypeTagExpr (const Expr *TypeExpr, const ASTContext &Ctx, const ValueDecl **VD, uint64_t *MagicValue)
 Given a type tag expression find the type tag itself. More...
 
static bool GetMatchingCType (const IdentifierInfo *ArgumentKind, const Expr *TypeExpr, const ASTContext &Ctx, const llvm::DenseMap< Sema::TypeTagMagicValue, Sema::TypeTagData > *MagicValues, bool &FoundWrongKind, Sema::TypeTagData &TypeInfo)
 Retrieve the C type corresponding to type tag TypeExpr. More...
 
static bool IsSameCharType (QualType T1, QualType T2)
 

Macro Definition Documentation

◆ ATOMIC_BUILTIN

#define ATOMIC_BUILTIN (   ID,
  TYPE,
  ATTRS 
)
Value:
case Builtin::BI##ID: \
return SemaAtomicOpsOverloaded(TheCallResult, AtomicExpr::AO##ID);

◆ BUILTIN

#define BUILTIN (   ID,
  TYPE,
  ATTRS 
)

◆ BUILTIN_ROW

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

Referenced by checkBuiltinArgument().

◆ GET_NEON_IMMEDIATE_CHECK

#define GET_NEON_IMMEDIATE_CHECK

◆ GET_NEON_OVERLOAD_CHECK

#define GET_NEON_OVERLOAD_CHECK

Enumeration Type Documentation

◆ AbsoluteValueKind

Enumerator
AVK_Integer 
AVK_Floating 
AVK_Complex 

Definition at line 8258 of file SemaChecking.cpp.

◆ StringLiteralCheckType

Definition at line 6085 of file SemaChecking.cpp.

Function Documentation

◆ AnalyzeAssignment()

static void AnalyzeAssignment ( Sema S,
BinaryOperator E 
)
static

◆ AnalyzeBitFieldAssignment()

static bool AnalyzeBitFieldAssignment ( Sema S,
FieldDecl Bitfield,
Expr Init,
SourceLocation  InitLoc 
)
static

◆ AnalyzeComparison()

static void AnalyzeComparison ( Sema S,
BinaryOperator E 
)
static

◆ AnalyzeCompoundAssignment()

static void AnalyzeCompoundAssignment ( Sema S,
BinaryOperator E 
)
static

◆ AnalyzeImpConvsInComparison()

static void AnalyzeImpConvsInComparison ( Sema S,
BinaryOperator E 
)
static

Analyze the operands of the given comparison.

Implements the fallback case from AnalyzeComparison.

Definition at line 10047 of file SemaChecking.cpp.

References AnalyzeImplicitConversions(), clang::BinaryOperator::getLHS(), clang::BinaryOperator::getOperatorLoc(), and clang::BinaryOperator::getRHS().

Referenced by AnalyzeComparison().

◆ AnalyzeImplicitConversions()

static void AnalyzeImplicitConversions ( Sema S,
Expr OrigE,
SourceLocation  CC 
)
static

◆ changeAbsFunction()

static unsigned changeAbsFunction ( unsigned  AbsKind,
AbsoluteValueKind  ValueKind 
)
static

Definition at line 8277 of file SemaChecking.cpp.

References AVK_Complex, AVK_Floating, and AVK_Integer.

◆ checkArgCount()

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 110 of file SemaChecking.cpp.

Referenced by SemaBuiltinCommitRWPipe(), SemaBuiltinPipePackets(), and SemaBuiltinReserveRWPipe().

◆ CheckBoolLikeConversion()

static void CheckBoolLikeConversion ( Sema S,
Expr E,
SourceLocation  CC 
)
static

◆ checkBuiltinArgument()

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 4659 of file SemaChecking.cpp.

References BUILTIN_ROW, clang::Sema::Context, Diag(), clang::ExprError(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::CallExpr::getArg(), clang::Type::getAs(), clang::DeclRefExpr::getBeginLoc(), clang::CallExpr::getCallee(), clang::DeclRefExpr::getDecl(), clang::CallExpr::getDirectCallee(), clang::CallExpr::getEndLoc(), clang::CallExpr::getNumArgs(), clang::QualType::getObjCLifetime(), clang::FunctionDecl::getParamDecl(), clang::PointerType::getPointeeType(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::QualType::getUnqualifiedType(), clang::Expr::IgnoreParenCasts(), clang::InitializedEntity::InitializeParameter(), clang::Type::isAnyPointerType(), clang::Type::isBlockPointerType(), clang::QualType::isConstQualified(), clang::Type::isIntegerType(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::Qualifiers::OCL_Autoreleasing, clang::Qualifiers::OCL_ExplicitNone, clang::Qualifiers::OCL_None, clang::Qualifiers::OCL_Strong, clang::Qualifiers::OCL_Weak, clang::Sema::PerformCopyInitialization(), clang::ast_matchers::pointerType, and clang::CallExpr::setArg().

Referenced by checkVAStartIsInVariadicFunction().

◆ CheckBuiltinTargetSupport()

static bool CheckBuiltinTargetSupport ( Sema S,
unsigned  BuiltinID,
CallExpr TheCall,
ArrayRef< llvm::Triple::ArchType >  SupportedArchs 
)
static

◆ CheckConditionalOperand()

static void CheckConditionalOperand ( Sema S,
Expr E,
QualType  T,
SourceLocation  CC,
bool ICContext 
)
static

◆ CheckConditionalOperator()

static void CheckConditionalOperator ( Sema S,
ConditionalOperator E,
SourceLocation  CC,
QualType  T 
)
static

◆ CheckFormatString()

static void CheckFormatString ( Sema S,
const FormatStringLiteral *  FExpr,
const Expr OrigFormatExpr,
ArrayRef< const Expr *>  Args,
bool  HasVAListArg,
unsigned  format_idx,
unsigned  firstDataArg,
Sema::FormatStringType  Type,
bool  inFunctionCall,
Sema::VariadicCallType  CallType,
llvm::SmallBitVector &  CheckedVarArgs,
UncoveredArgHandler &  UncoveredArg 
)
static

◆ checkFormatStringExpr()

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,
UncoveredArgHandler &  UncoveredArg,
llvm::APSInt  Offset 
)
static

◆ CheckForReference()

static bool CheckForReference ( Sema SemaRef,
const Expr E,
const PartialDiagnostic PD 
)
static

◆ CheckImplicitArgumentConversions()

static void CheckImplicitArgumentConversions ( Sema S,
CallExpr TheCall,
SourceLocation  CC 
)
static

◆ CheckImplicitConversion()

static void CheckImplicitConversion ( Sema S,
Expr E,
QualType  T,
SourceLocation  CC,
bool ICContext = nullptr 
)
static

Definition at line 10702 of file SemaChecking.cpp.

References clang::Type::canDecayToPointerType(), CheckConditionalOperator(), checkObjCArrayLiteral(), checkObjCDictionaryLiteral(), clang::Sema::Context, clang::Sema::Diag(), clang::Sema::DiagnoseAlwaysNonNullPointer(), DiagnoseFloatingImpCast(), DiagnoseImpCast(), DiagnoseNullConversion(), clang::Sema::DiagRuntimeBehavior(), clang::Sema::DiscardMisalignedMemberAddress(), clang::Expr::EvaluateAsInt(), clang::Expr::EvaluateAsRValue(), clang::CallExpr::getArg(), clang::Type::getAs(), clang::ASTContext::getCanonicalType(), clang::Expr::getExprLoc(), GetExprRange(), clang::ASTContext::getFloatTypeSemantics(), clang::ASTContext::getIntWidth(), clang::BuiltinType::getKind(), clang::Sema::getLangOpts(), clang::CallExpr::getNumArgs(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::ASTContext::getTypeDeclType(), clang::CanQual< T >::getTypePtr(), clang::ASTContext::getTypeSize(), clang::Expr::IgnoreParenImpCasts(), clang::Type::isAtomicType(), clang::Type::isBooleanType(), clang::Type::isDependentType(), clang::BuiltinType::isFloatingPoint(), clang::SourceManager::isInSystemMacro(), clang::Type::isIntegerType(), clang::SourceLocation::isInvalid(), clang::Type::isPointerType(), IsSameFloatAfterCast(), isSameWidthConstantConversion(), clang::Type::isSignedIntegerType(), clang::Type::isSpecificBuiltinType(), clang::Expr::isTypeDependent(), clang::Type::isUnsignedIntegerType(), clang::Expr::isValueDependent(), clang::Expr::NPCK_NotNull, clang::Sema::PDiag(), PrettyPrintInRange(), clang::Expr::SE_AllowSideEffects, clang::Sema::SourceMgr, MultiVersioning::Target, and clang::Expr::EvalResult::Val.

Referenced by AnalyzeImplicitConversions(), CheckBoolLikeConversion(), CheckConditionalOperand(), CheckConditionalOperator(), and checkOpenCLEnqueueIntType().

◆ CheckMemaccessSize()

static void CheckMemaccessSize ( Sema S,
unsigned  BId,
const CallExpr Call 
)
static

◆ CheckMemorySizeofForComparison()

static bool CheckMemorySizeofForComparison ( Sema S,
const Expr E,
IdentifierInfo FnName,
SourceLocation  FnLoc,
SourceLocation  RParenLoc 
)
static

◆ CheckNonNullArgument()

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

◆ CheckNonNullArguments()

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

◆ CheckNonNullExpr()

static bool CheckNonNullExpr ( Sema S,
const Expr Expr 
)
static

Checks if a the given expression evaluates to null.

Returns true if the value evaluates to null.

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

◆ checkObjCArrayLiteral()

static void checkObjCArrayLiteral ( Sema S,
QualType  TargetType,
ObjCArrayLiteral ArrayLiteral 
)
static

◆ checkObjCCollectionLiteralElement()

static void checkObjCCollectionLiteralElement ( Sema S,
QualType  TargetElementType,
Expr Element,
unsigned  ElementKind 
)
static

◆ checkObjCDictionaryLiteral()

static void checkObjCDictionaryLiteral ( Sema S,
QualType  TargetType,
ObjCDictionaryLiteral DictionaryLiteral 
)
static

◆ checkOpenCLBlockArgs()

static bool checkOpenCLBlockArgs ( Sema S,
Expr BlockArg 
)
static

OpenCL C v2.0, s6.13.17.2 - Checks that the block parameters are all local void*, which is a requirement of device side enqueue.

Definition at line 368 of file SemaChecking.cpp.

Referenced by SemaOpenCLBuiltinEnqueueKernel().

◆ checkOpenCLEnqueueIntType()

static bool checkOpenCLEnqueueIntType ( Sema S,
Expr E,
const QualType IntType 
)
static

Diagnose integer type and any valid implicit conversion to it.

Definition at line 11149 of file SemaChecking.cpp.

References CheckImplicitConversion(), clang::Sema::Diag(), clang::Stmt::getBeginLoc(), clang::Expr::getType(), and clang::Type::isIntegerType().

Referenced by checkOpenCLEnqueueLocalSizeArgs().

◆ checkOpenCLEnqueueLocalSizeArgs()

static bool checkOpenCLEnqueueLocalSizeArgs ( Sema S,
CallExpr TheCall,
unsigned  Start,
unsigned  End 
)
static

◆ checkOpenCLEnqueueVariadicArgs()

static bool checkOpenCLEnqueueVariadicArgs ( Sema S,
CallExpr TheCall,
Expr BlockArg,
unsigned  NumNonVarArgs 
)
static

◆ checkOpenCLPipeArg()

static bool checkOpenCLPipeArg ( Sema S,
CallExpr Call 
)
static

◆ checkOpenCLPipePacketType()

static bool checkOpenCLPipePacketType ( Sema S,
CallExpr Call,
unsigned  Idx 
)
static

◆ checkOpenCLSubgroupExt()

static bool checkOpenCLSubgroupExt ( Sema S,
CallExpr Call 
)
static

Definition at line 401 of file SemaChecking.cpp.

◆ CheckTautologicalComparison()

static bool CheckTautologicalComparison ( Sema S,
BinaryOperator E,
Expr Constant,
Expr Other,
const llvm::APSInt &  Value,
bool  RhsConstant 
)
static

◆ checkUnsafeAssignLiteral()

static bool checkUnsafeAssignLiteral ( Sema S,
SourceLocation  Loc,
Expr RHS,
bool  isProperty 
)
static

◆ checkUnsafeAssignObject()

static bool checkUnsafeAssignObject ( Sema S,
SourceLocation  Loc,
Qualifiers::ObjCLifetime  LT,
Expr RHS,
bool  isProperty 
)
static

◆ checkVAStartABI()

static bool checkVAStartABI ( Sema S,
unsigned  BuiltinID,
Expr Fn 
)
static

Check that the user is calling the appropriate va_start builtin for the target and calling convention.

Definition at line 5183 of file SemaChecking.cpp.

References clang::CC_C, clang::CC_Win64, clang::CC_X86_64SysV, clang::Sema::Context, clang::Sema::Diag(), clang::Stmt::getBeginLoc(), clang::Sema::getCurFunctionDecl(), clang::ASTContext::getTargetInfo(), and clang::TargetInfo::getTriple().

Referenced by checkVAStartIsInVariadicFunction().

◆ checkVAStartIsInVariadicFunction()

static bool checkVAStartIsInVariadicFunction ( Sema S,
Expr Fn,
ParmVarDecl **  LastParam = nullptr 
)
static

◆ classifyConstantValue()

static int classifyConstantValue ( Expr Constant)
static

Definition at line 9935 of file SemaChecking.cpp.

◆ considerVariable()

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 12395 of file SemaChecking.cpp.

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

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

◆ CXXRecordMembersNamed()

template<typename MemberKind >
static llvm::SmallPtrSet<MemberKind*, 1> CXXRecordMembersNamed ( StringRef  Name,
Sema S,
QualType  Ty 
)
static

Definition at line 7275 of file SemaChecking.cpp.

◆ diagnoseArrayStarInParamType()

static void diagnoseArrayStarInParamType ( Sema S,
QualType  PType,
SourceLocation  Loc 
)
static

◆ DiagnoseCStringFormatDirectiveInCFAPI()

static void DiagnoseCStringFormatDirectiveInCFAPI ( Sema S,
const NamedDecl FDecl,
Expr **  Args,
unsigned  NumArgs 
)
static

◆ DiagnoseFloatingImpCast()

static void DiagnoseFloatingImpCast ( Sema S,
Expr E,
QualType  T,
SourceLocation  CContext 
)
static

◆ DiagnoseImpCast() [1/2]

static void DiagnoseImpCast ( Sema S,
Expr E,
QualType  SourceType,
QualType  T,
SourceLocation  CContext,
unsigned  diag,
bool  pruneControlFlow = false 
)
static

◆ DiagnoseImpCast() [2/2]

static void DiagnoseImpCast ( Sema S,
Expr E,
QualType  T,
SourceLocation  CContext,
unsigned  diag,
bool  pruneControlFlow = false 
)
static

Diagnose an implicit cast; purely a helper for CheckImplicitConversion.

Definition at line 10338 of file SemaChecking.cpp.

References DiagnoseImpCast(), and clang::Expr::getType().

◆ DiagnoseNullConversion()

static void DiagnoseNullConversion ( Sema S,
Expr E,
QualType  T,
SourceLocation  CC 
)
static

◆ diagnoseRetainCycle()

static void diagnoseRetainCycle ( Sema S,
Expr capturer,
RetainCycleOwner &  owner 
)
static

◆ doesExprLikelyComputeSize()

static bool doesExprLikelyComputeSize ( const Expr SizeofExpr)
static

Detect if SizeofExpr is likely to calculate the sizeof an object.

Definition at line 8793 of file SemaChecking.cpp.

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

Referenced by CheckMemaccessSize().

◆ emitReplacement()

static void emitReplacement ( Sema S,
SourceLocation  Loc,
SourceRange  Range,
unsigned  AbsKind,
QualType  ArgType 
)
static

◆ findCapturingExpr()

static Expr* findCapturingExpr ( Sema S,
Expr e,
RetainCycleOwner &  owner 
)
static

◆ findRetainCycleOwner()

static bool findRetainCycleOwner ( Sema S,
Expr e,
RetainCycleOwner &  owner 
)
static

◆ FindTypeTagExpr()

static bool FindTypeTagExpr ( const Expr TypeExpr,
const ASTContext Ctx,
const ValueDecl **  VD,
uint64_t *  MagicValue 
)
static

◆ getAbsoluteValueArgumentType()

static QualType getAbsoluteValueArgumentType ( ASTContext Context,
unsigned  AbsType 
)
static

Definition at line 8217 of file SemaChecking.cpp.

◆ getAbsoluteValueFunctionKind()

static unsigned getAbsoluteValueFunctionKind ( const FunctionDecl FDecl)
static

◆ getAbsoluteValueKind()

static AbsoluteValueKind getAbsoluteValueKind ( QualType  T)
static

◆ getAsSizeOfExpr()

static const UnaryExprOrTypeTraitExpr* getAsSizeOfExpr ( const Expr E)
static

Definition at line 8677 of file SemaChecking.cpp.

References clang::UETT_SizeOf.

Referenced by doesExprLikelyComputeSize(), getSizeOfArgType(), and getSizeOfExprArg().

◆ getBestAbsFunction()

static unsigned getBestAbsFunction ( ASTContext Context,
QualType  ArgType,
unsigned  AbsFunctionKind 
)
static

Definition at line 8239 of file SemaChecking.cpp.

◆ getContainedDynamicClass()

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 8648 of file SemaChecking.cpp.

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

◆ getDeclAlign()

static CharUnits getDeclAlign ( Expr E,
CharUnits  TypeAlign,
ASTContext Context 
)
static

◆ GetExprRange() [1/2]

static IntRange GetExprRange ( ASTContext C,
const Expr E,
unsigned  MaxWidth 
)
static

Pseudo-evaluate the given integer expression, estimating the range of values it might take.

Parameters
MaxWidth- the width to which the value will be truncated

Definition at line 9514 of file SemaChecking.cpp.

References clang::Expr::EvaluateAsRValue(), GetExprType(), clang::ASTContext::getIntWidth(), clang::Expr::getSourceBitField(), GetValueRange(), clang::Expr::IgnoreParens(), log2, min(), and clang::Expr::EvalResult::Val.

Referenced by AnalyzeComparison(), CheckImplicitConversion(), and GetExprRange().

◆ GetExprRange() [2/2]

static IntRange GetExprRange ( ASTContext C,
const Expr E 
)
static

◆ GetExprType()

static QualType GetExprType ( const Expr E)
static

Definition at line 9503 of file SemaChecking.cpp.

References clang::Type::getAs(), and clang::Expr::getType().

Referenced by GetExprRange().

◆ getLargerAbsoluteValueFunction()

static unsigned getLargerAbsoluteValueFunction ( unsigned  AbsFunction)
static

Definition at line 8167 of file SemaChecking.cpp.

◆ GetMatchingCType()

static bool GetMatchingCType ( const IdentifierInfo ArgumentKind,
const Expr TypeExpr,
const ASTContext Ctx,
const llvm::DenseMap< Sema::TypeTagMagicValue, Sema::TypeTagData > *  MagicValues,
bool FoundWrongKind,
Sema::TypeTagData TypeInfo 
)
static

Retrieve the C type corresponding to type tag TypeExpr.

Parameters
TypeExprExpression that specifies a type tag.
MagicValuesRegistered magic values.
FoundWrongKindSet to true if a type tag was found, but of a wrong kind.
TypeInfoInformation about the corresponding C type.
Returns
true if the corresponding C type was found.

Definition at line 13396 of file SemaChecking.cpp.

References FindTypeTagExpr(), clang::Decl::getAttr(), clang::Sema::TypeTagData::LayoutCompatible, clang::Sema::TypeTagData::MustBeNull, and clang::Sema::TypeTagData::Type.

Referenced by IsSameCharType().

◆ getNeonEltType()

static QualType getNeonEltType ( NeonTypeFlags  Flags,
ASTContext Context,
bool  IsPolyUnsigned,
bool  IsInt64Long 
)
static

getNeonEltType - Return the QualType corresponding to the elements of the vector type specified by the NeonTypeFlags.

This is used to check the pointer arguments for Neon load/store intrinsics.

Definition at line 1457 of file SemaChecking.cpp.

◆ GetNSMutableArrayArgumentIndex()

static Optional<int> GetNSMutableArrayArgumentIndex ( Sema S,
ObjCMessageExpr Message 
)
static

◆ GetNSMutableDictionaryArgumentIndex()

static Optional<int> GetNSMutableDictionaryArgumentIndex ( Sema S,
ObjCMessageExpr Message 
)
static

◆ GetNSSetArgumentIndex()

static Optional<int> GetNSSetArgumentIndex ( Sema S,
ObjCMessageExpr Message 
)
static

◆ getOpenCLArgAccess()

static OpenCLAccessAttr* getOpenCLArgAccess ( const Decl D)
static

Returns OpenCL access qual.

Definition at line 632 of file SemaChecking.cpp.

References clang::Decl::getAttr().

Referenced by checkOpenCLPipeArg().

◆ getSizeOfArgType()

static QualType getSizeOfArgType ( const Expr E)
static

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

Definition at line 8694 of file SemaChecking.cpp.

References getAsSizeOfExpr().

Referenced by CheckMemaccessSize().

◆ getSizeOfExprArg()

static const Expr* getSizeOfExprArg ( const Expr E)
static

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

Definition at line 8686 of file SemaChecking.cpp.

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

Referenced by CheckMemaccessSize(), and getStrlenExprArg().

◆ getStrlenExprArg()

static const Expr* getStrlenExprArg ( const Expr E)
static

◆ GetValueRange() [1/2]

static IntRange GetValueRange ( ASTContext C,
llvm::APSInt &  value,
unsigned  MaxWidth 
)
static

Definition at line 9461 of file SemaChecking.cpp.

Referenced by GetExprRange(), and GetValueRange().

◆ GetValueRange() [2/2]

static IntRange GetValueRange ( ASTContext C,
APValue result,
QualType  Ty,
unsigned  MaxWidth 
)
static

◆ HasEnumType()

static bool HasEnumType ( Expr E)
static

Definition at line 9923 of file SemaChecking.cpp.

References clang::Expr::getType(), and clang::Type::isEnumeralType().

◆ ignoreLiteralAdditions()

static const Expr* ignoreLiteralAdditions ( const Expr Ex,
ASTContext Ctx 
)
static

◆ isArgumentExpandedFromMacro()

static bool isArgumentExpandedFromMacro ( SourceManager SM,
SourceLocation  CallLoc,
SourceLocation  ArgLoc 
)
static

Check if the ArgLoc originated from a macro passed to the call at CallLoc.

#define MACRO 0
foo(MACRO);
foo(0);

This should return true for the first call to foo, but not for the second (regardless of whether foo is a macro or function).

Definition at line 8817 of file SemaChecking.cpp.

References clang::SourceManager::getFileID(), clang::SourceManager::getImmediateMacroCallerLoc(), and clang::SourceLocation::isMacroID().

Referenced by CheckMemaccessSize().

◆ isBlockPointer()

static bool isBlockPointer ( Expr Arg)
inlinestatic

◆ isConstantSizeArrayWithMoreThanOneElement()

static bool isConstantSizeArrayWithMoreThanOneElement ( QualType  Ty,
ASTContext Context 
)
static

Definition at line 9095 of file SemaChecking.cpp.

Referenced by getStrlenExprArg().

◆ IsEnumConstOrFromMacro()

static bool IsEnumConstOrFromMacro ( Sema S,
Expr E 
)
static

◆ IsImplicitBoolFloatConversion()

static bool IsImplicitBoolFloatConversion ( Sema S,
Expr Ex,
bool  ToBool 
)
static

◆ IsInAnyMacroBody()

static bool IsInAnyMacroBody ( const SourceManager SM,
SourceLocation  Loc 
)
static

◆ isKnownToHaveUnsignedValue()

static bool isKnownToHaveUnsignedValue ( Expr E)
static

◆ isLayoutCompatible() [1/4]

static bool isLayoutCompatible ( ASTContext C,
QualType  T1,
QualType  T2 
)
static

◆ isLayoutCompatible() [2/4]

static bool isLayoutCompatible ( ASTContext C,
EnumDecl ED1,
EnumDecl ED2 
)
static

Check if two enumeration types are layout-compatible.

Definition at line 13163 of file SemaChecking.cpp.

References clang::EnumDecl::getIntegerType(), clang::ASTContext::hasSameType(), and clang::EnumDecl::isComplete().

◆ isLayoutCompatible() [3/4]

static bool isLayoutCompatible ( ASTContext C,
FieldDecl Field1,
FieldDecl Field2 
)
static

Check if two fields are layout-compatible.

Definition at line 13172 of file SemaChecking.cpp.

References clang::FieldDecl::getBitWidthValue(), clang::ValueDecl::getType(), clang::FieldDecl::isBitField(), and isLayoutCompatible().

◆ isLayoutCompatible() [4/4]

static bool isLayoutCompatible ( ASTContext C,
RecordDecl RD1,
RecordDecl RD2 
)
static

◆ isLayoutCompatibleStruct()

static bool isLayoutCompatibleStruct ( ASTContext C,
RecordDecl RD1,
RecordDecl RD2 
)
static

Check if two standard-layout structs are layout-compatible.

(C++11 [class.mem] p17)

Definition at line 13194 of file SemaChecking.cpp.

References clang::CXXRecordDecl::bases_begin(), clang::RecordDecl::field_begin(), clang::RecordDecl::field_end(), clang::CXXRecordDecl::getNumBases(), and isLayoutCompatible().

Referenced by isLayoutCompatible().

◆ isLayoutCompatibleUnion()

static bool isLayoutCompatibleUnion ( ASTContext C,
RecordDecl RD1,
RecordDecl RD2 
)
static

Check if two standard-layout unions are layout-compatible.

(C++11 [class.mem] p18)

Definition at line 13238 of file SemaChecking.cpp.

References clang::RecordDecl::fields(), and isLayoutCompatible().

Referenced by isLayoutCompatible().

◆ isNonNullType()

static bool isNonNullType ( ASTContext ctx,
QualType  type 
)
static

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

Definition at line 3907 of file SemaChecking.cpp.

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

Referenced by CheckNonNullArguments().

◆ IsSameCharType()

static bool IsSameCharType ( QualType  T1,
QualType  T2 
)
static

◆ IsSameFloatAfterCast() [1/2]

static bool IsSameFloatAfterCast ( const llvm::APFloat &  value,
const llvm::fltSemantics &  Src,
const llvm::fltSemantics &  Tgt 
)
static

Checks whether the given value, which currently has the given source semantics, has the same value when coerced through the target semantics.

Definition at line 9741 of file SemaChecking.cpp.

Referenced by CheckImplicitConversion(), and IsSameFloatAfterCast().

◆ IsSameFloatAfterCast() [2/2]

static bool IsSameFloatAfterCast ( const APValue value,
const llvm::fltSemantics &  Src,
const llvm::fltSemantics &  Tgt 
)
static

Checks whether the given value, which currently has the given source semantics, has the same value when coerced through the target semantics.

The value might be a vector of floats (or a complex number).

Definition at line 9758 of file SemaChecking.cpp.

References AnalyzeImplicitConversions(), clang::APValue::getComplexFloatImag(), clang::APValue::getComplexFloatReal(), clang::APValue::getFloat(), clang::APValue::getVectorElt(), clang::APValue::getVectorLength(), clang::APValue::isComplexFloat(), clang::APValue::isFloat(), IsSameFloatAfterCast(), and clang::APValue::isVector().

◆ isSameWidthConstantConversion()

static bool isSameWidthConstantConversion ( Sema S,
Expr E,
QualType  T,
SourceLocation  CC 
)
static

◆ isSetterLikeSelector()

static bool isSetterLikeSelector ( Selector  sel)
static

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

Definition at line 12592 of file SemaChecking.cpp.

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

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

◆ IsStdFunction()

template<std::size_t StrLen>
static bool IsStdFunction ( const FunctionDecl FDecl,
const char(&)  Str[StrLen] 
)
static

◆ IsTailPaddedMemberArray()

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

◆ isValidOrderingForOp()

static bool isValidOrderingForOp ( int64_t  Ordering,
AtomicExpr::AtomicOp  Op 
)
static

◆ isX86_32Builtin()

static bool isX86_32Builtin ( unsigned  BuiltinID)
static

Definition at line 3426 of file SemaChecking.cpp.

References SemaBuiltinCpuIs(), and SemaBuiltinCpuSupports().

◆ PrettyPrintInRange()

static std::string PrettyPrintInRange ( const llvm::APSInt &  Value,
IntRange  Range 
)
static

Definition at line 10482 of file SemaChecking.cpp.

Referenced by CheckImplicitConversion().

◆ referToTheSameDecl()

static bool referToTheSameDecl ( const Expr E1,
const Expr E2 
)
static

Check if two expressions refer to the same declaration.

Definition at line 9178 of file SemaChecking.cpp.

Referenced by getStrlenExprArg().

◆ requiresParensToAddCast()

static bool requiresParensToAddCast ( const Expr E)
static

◆ RFT()

static unsigned RFT ( unsigned  t,
bool  shift = false,
bool  ForceQuad = false 
)
static

◆ SemaBuiltinAddressof()

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 180 of file SemaChecking.cpp.

◆ SemaBuiltinAnnotation()

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 130 of file SemaChecking.cpp.

◆ SemaBuiltinCallWithStaticChain()

static bool SemaBuiltinCallWithStaticChain ( Sema S,
CallExpr BuiltinCall 
)
static

Definition at line 277 of file SemaChecking.cpp.

◆ SemaBuiltinCommitRWPipe()

static bool SemaBuiltinCommitRWPipe ( Sema S,
CallExpr Call 
)
static

◆ SemaBuiltinCpuIs()

static bool SemaBuiltinCpuIs ( Sema S,
CallExpr TheCall 
)
static

SemaBuiltinCpuIs - Handle __builtin_cpu_is(char *).

This checks that the target supports __builtin_cpu_is and that the string argument is constant and valid.

Definition at line 3104 of file SemaChecking.cpp.

References clang::Sema::Context, Diag(), clang::Sema::Diag(), clang::CallExpr::getArg(), clang::CallExpr::getBeginLoc(), clang::Stmt::getSourceRange(), clang::ASTContext::getTargetInfo(), clang::Expr::IgnoreParenImpCasts(), clang::Expr::isTypeDependent(), clang::Expr::isValueDependent(), and clang::TargetInfo::validateCpuIs().

Referenced by isX86_32Builtin().

◆ SemaBuiltinCpuSupports()

static bool SemaBuiltinCpuSupports ( Sema S,
CallExpr TheCall 
)
static

SemaBuiltinCpuSupports - Handle __builtin_cpu_supports(char *).

This checks that the target supports __builtin_cpu_supports and that the string argument is constant and valid.

Definition at line 3084 of file SemaChecking.cpp.

References clang::Sema::Context, clang::Sema::Diag(), clang::CallExpr::getArg(), clang::CallExpr::getBeginLoc(), clang::Stmt::getSourceRange(), clang::ASTContext::getTargetInfo(), clang::Expr::IgnoreParenImpCasts(), and clang::TargetInfo::validateCpuSupports().

Referenced by isX86_32Builtin().

◆ SemaBuiltinMemChkCall()

static void SemaBuiltinMemChkCall ( Sema S,
FunctionDecl FDecl,
CallExpr TheCall,
unsigned  SizeIdx,
unsigned  DstSizeIdx,
StringRef  LikelyMacroName 
)
static

Definition at line 239 of file SemaChecking.cpp.

◆ SemaBuiltinMSVCAnnotation()

static bool SemaBuiltinMSVCAnnotation ( Sema S,
CallExpr TheCall 
)
static

Definition at line 156 of file SemaChecking.cpp.

◆ SemaBuiltinOverflow()

static bool SemaBuiltinOverflow ( Sema S,
CallExpr TheCall 
)
static

Definition at line 194 of file SemaChecking.cpp.

◆ SemaBuiltinPipePackets()

static bool SemaBuiltinPipePackets ( Sema S,
CallExpr Call 
)
static

◆ SemaBuiltinReserveRWPipe()

static bool SemaBuiltinReserveRWPipe ( Sema S,
CallExpr Call 
)
static

◆ SemaBuiltinRWPipe()

static bool SemaBuiltinRWPipe ( Sema S,
CallExpr Call 
)
static

◆ SemaBuiltinSEHScopeCheck()

static bool SemaBuiltinSEHScopeCheck ( Sema SemaRef,
CallExpr TheCall,
Scope::ScopeFlags  NeededScopeFlags,
unsigned  DiagID 
)
static

Definition at line 340 of file SemaChecking.cpp.

References clang::Sema::inTemplateInstantiation().

◆ SemaOpenCLBuiltinEnqueueKernel()

static bool SemaOpenCLBuiltinEnqueueKernel ( Sema S,
CallExpr TheCall 
)
static

OpenCL C v2.0, s6.13.17 - Enqueue kernel function contains four different overload formats specified in Table 6.13.17.1.

int enqueue_kernel(queue_t queue, kernel_enqueue_flags_t flags, const ndrange_t ndrange, void (^block)(void)) int enqueue_kernel(queue_t queue, kernel_enqueue_flags_t flags, const ndrange_t ndrange, uint num_events_in_wait_list, clk_event_t event_wait_list, clk_event_t *event_ret, void (^block)(void)) int enqueue_kernel(queue_t queue, kernel_enqueue_flags_t flags, const ndrange_t ndrange, void (^block)(local void, ...), uint size0, ...) int enqueue_kernel(queue_t queue, kernel_enqueue_flags_t flags, const ndrange_t ndrange, uint num_events_in_wait_list, clk_event_t event_wait_list, clk_event_t *event_ret, void (^block)(local void, ...), uint size0, ...)

Definition at line 513 of file SemaChecking.cpp.

References checkOpenCLBlockArgs(), checkOpenCLEnqueueVariadicArgs(), clang::Sema::Context, clang::Sema::Diag(), clang::CallExpr::getArg(), clang::Type::getAs(), clang::QualType::getAsString(), clang::Stmt::getBeginLoc(), clang::CallExpr::getBeginLoc(), clang::QualType::getCanonicalType(), clang::CallExpr::getDirectCallee(), clang::CallExpr::getNumArgs(), clang::Type::getPointeeOrArrayElementType(), clang::Type::getPointeeType(), clang::BlockPointerType::getPointeeType(), clang::ASTContext::getPointerType(), clang::Expr::getType(), clang::QualType::getUnqualifiedType(), isBlockPointer(), clang::Type::isClkEventT(), clang::Type::isIntegerType(), clang::Expr::isNullPointerConstant(), clang::Type::isPointerType(), clang::Type::isQueueT(), clang::Expr::NPC_ValueDependentIsNotNull, clang::ASTContext::OCLClkEventTy, and clang::ASTContext::OCLQueueTy.

◆ SemaOpenCLBuiltinKernelWorkGroupSize()

static bool SemaOpenCLBuiltinKernelWorkGroupSize ( Sema S,
CallExpr TheCall 
)
static

OpenCL C v2.0, s6.13.17.6 - Check the argument to the get_kernel_work_group_size and get_kernel_preferred_work_group_size_multiple builtin functions.

Definition at line 437 of file SemaChecking.cpp.

◆ SemaOpenCLBuiltinNDRangeAndBlock()

static bool SemaOpenCLBuiltinNDRangeAndBlock ( Sema S,
CallExpr TheCall 
)
static

Definition at line 410 of file SemaChecking.cpp.

◆ SemaOpenCLBuiltinToAddr()

static bool SemaOpenCLBuiltinToAddr ( Sema S,
unsigned  BuiltinID,
CallExpr Call 
)
static

◆ ShouldDiagnoseEmptyStmtBody()

static bool ShouldDiagnoseEmptyStmtBody ( const SourceManager SourceMgr,
SourceLocation  StmtLoc,
const NullStmt Body 
)
static

◆ shouldNotPrintDirectly()

static std::pair<QualType, StringRef> shouldNotPrintDirectly ( const ASTContext Context,
QualType  IntendedTy,
const Expr E 
)
static

Definition at line 7585 of file SemaChecking.cpp.

◆ sumOffsets()

static void sumOffsets ( llvm::APSInt &  Offset,
llvm::APSInt  Addend,
BinaryOperatorKind  BinOpKind,
bool  AddendIsRight 
)
static