clang
6.0.0
|
#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/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"
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) |
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 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 | 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 CXXRecordDecl * | getContainedDynamicClass (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 Expr * | getSizeOfExprArg (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 Expr * | ignoreLiteralAdditions (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 Expr * | getStrlenExprArg (const Expr *E) |
static const Expr * | EvalVal (const Expr *E, SmallVectorImpl< const DeclRefExpr * > &refVars, const Decl *ParentDecl) |
EvalVal - This function is complements EvalAddr in the mutual recursion. More... | |
static const Expr * | EvalAddr (const Expr *E, SmallVectorImpl< const DeclRefExpr * > &refVars, const Decl *ParentDecl) |
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. More... | |
static void | CheckReturnStackAddr (Sema &S, Expr *RetValExp, QualType lhsType, SourceLocation ReturnLoc) |
CheckReturnStackAddr - Check if a return statement returns the address of a stack variable. More... | |
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 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) |
CheckBoolLikeConversion - 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 Expr * | findCapturingExpr (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) |
#define ATOMIC_BUILTIN | ( | ID, | |
TYPE, | |||
ATTRS | |||
) |
#define BUILTIN | ( | ID, | |
TYPE, | |||
ATTRS | |||
) |
#define BUILTIN_ROW | ( | x | ) |
Referenced by checkBuiltinArgument().
#define GET_NEON_IMMEDIATE_CHECK |
#define GET_NEON_OVERLOAD_CHECK |
enum AbsoluteValueKind |
Enumerator | |
---|---|
AVK_Integer | |
AVK_Floating | |
AVK_Complex |
Definition at line 6914 of file SemaChecking.cpp.
Definition at line 4742 of file SemaChecking.cpp.
|
static |
Analyze the given simple or compound assignment for warning-worthy operations.
Definition at line 9168 of file SemaChecking.cpp.
References AnalyzeBitFieldAssignment(), AnalyzeImplicitConversions(), clang::BinaryOperator::getLHS(), clang::BinaryOperator::getOperatorLoc(), clang::BinaryOperator::getRHS(), clang::Expr::getSourceBitField(), and clang::Expr::IgnoreParenImpCasts().
|
static |
Analyzes an attempt to assign the given value to a bitfield.
Returns true if there was something fishy about the attempt.
Definition at line 9037 of file SemaChecking.cpp.
References clang::Sema::Context, clang::Sema::Diag(), clang::Expr::EvaluateAsInt(), clang::Type::getAs(), clang::FieldDecl::getBitWidth(), clang::FieldDecl::getBitWidthValue(), clang::Expr::getExprLoc(), clang::EnumDecl::getIntegerTypeSourceInfo(), clang::Sema::getLangOpts(), clang::NamedDecl::getNameAsString(), clang::EnumDecl::getNumNegativeBits(), clang::EnumDecl::getNumPositiveBits(), clang::TypeLoc::getSourceRange(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::ValueDecl::getType(), clang::TypeSourceInfo::getTypeLoc(), clang::DeclaratorDecl::getTypeSourceInfo(), clang::DeclaratorDecl::getTypeSpecStartLoc(), clang::Expr::IgnoreParenImpCasts(), clang::FieldDecl::isBitField(), clang::Type::isBooleanType(), clang::Type::isEnumeralType(), clang::Decl::isInvalidDecl(), clang::Type::isSignedIntegerType(), clang::Expr::isTypeDependent(), clang::Expr::isValueDependent(), max(), and clang::Expr::SE_AllowSideEffects.
Referenced by AnalyzeAssignment().
|
static |
Implements -Wsign-compare.
E | the binary operator to check for warnings |
Definition at line 8923 of file SemaChecking.cpp.
References AnalyzeImpConvsInComparison(), AnalyzeImplicitConversions(), CheckTautologicalComparison(), clang::Sema::Context, clang::Sema::DiagRuntimeBehavior(), GetExprRange(), clang::ASTContext::getIntWidth(), clang::Sema::getLangOpts(), clang::BinaryOperator::getLHS(), clang::BinaryOperator::getOperatorLoc(), clang::BinaryOperator::getRHS(), clang::Expr::getType(), clang::ASTContext::hasSameUnqualifiedType(), clang::Type::hasSignedIntegerRepresentation(), clang::Type::hasUnsignedIntegerRepresentation(), clang::Expr::IgnoreParenImpCasts(), clang::BinaryOperator::isEqualityOp(), clang::Expr::isIntegerConstantExpr(), clang::Type::isIntegralType(), clang::Expr::isValueDependent(), and clang::T.
|
static |
Analyze the operands of the given comparison.
Implements the fallback case from AnalyzeComparison.
Definition at line 8915 of file SemaChecking.cpp.
References AnalyzeImplicitConversions(), clang::BinaryOperator::getLHS(), clang::BinaryOperator::getOperatorLoc(), and clang::BinaryOperator::getRHS().
Referenced by AnalyzeComparison().
|
static |
AnalyzeImplicitConversions - Find and report any interesting implicit conversions in the given expression.
There are a couple of competing diagnostics here, -Wconversion and -Wsign-compare.
Definition at line 9848 of file SemaChecking.cpp.
References clang::Expr::getType(), clang::Expr::IgnoreParenImpCasts(), clang::Expr::isTypeDependent(), and clang::Expr::isValueDependent().
Referenced by AnalyzeAssignment(), AnalyzeComparison(), AnalyzeImpConvsInComparison(), CheckConditionalOperand(), CheckConditionalOperator(), and IsSameFloatAfterCast().
|
static |
Definition at line 6933 of file SemaChecking.cpp.
References AVK_Complex, AVK_Floating, and AVK_Integer.
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 109 of file SemaChecking.cpp.
Referenced by SemaBuiltinCommitRWPipe(), SemaBuiltinPipePackets(), and SemaBuiltinReserveRWPipe().
|
static |
CheckBoolLikeConversion - Check conversion of given expression to boolean.
Input argument E is a logical expression.
Definition at line 9839 of file SemaChecking.cpp.
References clang::ASTContext::BoolTy, CheckImplicitConversion(), clang::Sema::Context, clang::Sema::getLangOpts(), and clang::Expr::IgnoreParenImpCasts().
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 3330 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::CallExpr::getCallee(), clang::DeclRefExpr::getDecl(), clang::CallExpr::getDirectCallee(), clang::CallExpr::getLocEnd(), clang::DeclRefExpr::getLocStart(), 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::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().
|
static |
Definition at line 9797 of file SemaChecking.cpp.
References AnalyzeImplicitConversions(), CheckConditionalOperator(), CheckImplicitConversion(), clang::Expr::getType(), clang::Expr::IgnoreParenImpCasts(), and clang::T.
Referenced by CheckConditionalOperator().
|
static |
Definition at line 9809 of file SemaChecking.cpp.
References AnalyzeImplicitConversions(), CheckConditionalOperand(), CheckImplicitConversion(), clang::Sema::Diags, clang::ConditionalOperator::getCond(), clang::ConditionalOperator::getFalseExpr(), clang::AbstractConditionalOperator::getQuestionLoc(), clang::ConditionalOperator::getTrueExpr(), clang::Expr::getType(), clang::Expr::IgnoreParenImpCasts(), clang::DiagnosticsEngine::isIgnored(), and clang::T.
Referenced by CheckConditionalOperand().
|
static |
Definition at line 6728 of file SemaChecking.cpp.
References clang::Sema::Context, clang::Sema::FST_FreeBSDKPrintf, clang::Sema::FST_NSString, clang::Sema::FST_OSLog, clang::Sema::FST_OSTrace, clang::Sema::FST_Printf, clang::Sema::FST_Scanf, clang::ASTContext::getAsConstantArrayType(), clang::Sema::getLangOpts(), clang::ConstantArrayType::getSize(), clang::Stmt::getSourceRange(), clang::ASTContext::getTargetInfo(), max(), min(), clang::analyze_format_string::ParsePrintfString(), clang::analyze_format_string::ParseScanfString(), clang::Sema::PDiag(), and clang::T.
Referenced by sumOffsets().
|
static |
Definition at line 4859 of file SemaChecking.cpp.
References clang::Sema::Context, clang::Stmt::getStmtClass(), clang::Expr::IgnoreParenCasts(), clang::Expr::isNullPointerConstant(), clang::Expr::isTypeDependent(), clang::Expr::isValueDependent(), and clang::Expr::NPC_ValueDependentIsNotNull.
Referenced by clang::Sema::GetFormatStringType().
|
static |
Definition at line 9959 of file SemaChecking.cpp.
References clang::Sema::Context, clang::Sema::Diag(), clang::CallExpr::getCallReturnType(), clang::CallExpr::getDirectCallee(), clang::Expr::getExprLoc(), clang::Decl::getLocation(), clang::Expr::IgnoreParenImpCasts(), and clang::Type::isReferenceType().
Referenced by clang::Sema::DiagnoseAlwaysNonNullPointer().
|
static |
Definition at line 9330 of file SemaChecking.cpp.
References DiagnoseImpCast(), clang::CallExpr::getArg(), clang::CallExpr::getNumArgs(), clang::Expr::getType(), clang::Expr::IgnoreParenImpCasts(), and IsImplicitBoolFloatConversion().
|
static |
Definition at line 9525 of file SemaChecking.cpp.
References clang::Sema::Context, DiagnoseImpCast(), clang::ASTContext::getCanonicalType(), clang::Expr::getType(), clang::CanQual< T >::getTypePtr(), clang::Type::isDependentType(), clang::SourceLocation::isInvalid(), clang::Type::isSpecificBuiltinType(), clang::Expr::isTypeDependent(), and clang::Expr::isValueDependent().
Referenced by CheckBoolLikeConversion(), CheckConditionalOperand(), CheckConditionalOperator(), and checkOpenCLEnqueueIntType().
|
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 7274 of file SemaChecking.cpp.
Referenced by getSizeOfArgType(), and getStrlenExprArg().
|
static |
Definition at line 2551 of file SemaChecking.cpp.
References CheckNonNullExpr(), clang::Sema::DiagRuntimeBehavior(), clang::Stmt::getSourceRange(), and clang::Sema::PDiag().
Referenced by CheckNonNullArguments().
|
static |
Definition at line 2619 of file SemaChecking.cpp.
References CheckNonNullArgument(), clang::Sema::isValidPointerAttrType(), clang::NonNull, and clang::Decl::specific_attrs().
Checks if a the given expression evaluates to null.
Returns true if the value evaluates to null.
Definition at line 2526 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 |
Check an Objective-C array literal being converted to the given target type.
Definition at line 9442 of file SemaChecking.cpp.
References clang::Type::getAs(), clang::ObjCInterfaceDecl::getCanonicalDecl(), clang::ObjCObjectPointerType::getTypeArgs(), and clang::Sema::NSArrayDecl.
Referenced by checkObjCCollectionLiteralElement(), and DiagnoseNullConversion().
|
static |
Check a single element within a collection literal against the target element type.
Definition at line 9410 of file SemaChecking.cpp.
References checkObjCArrayLiteral(), checkObjCDictionaryLiteral(), clang::Sema::CheckSingleAssignmentConstraints(), clang::Sema::Compatible, clang::Sema::Diag(), clang::Type::getAs(), clang::Stmt::getLocStart(), clang::Stmt::getSourceRange(), and clang::Expr::getType().
|
static |
Check an Objective-C dictionary literal being converted to the given target type.
Definition at line 9471 of file SemaChecking.cpp.
References clang::Type::getAs(), clang::ObjCInterfaceDecl::getCanonicalDecl(), clang::ObjCObjectPointerType::getTypeArgs(), and clang::Sema::NSDictionaryDecl.
Referenced by checkObjCCollectionLiteralElement(), and DiagnoseNullConversion().
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 345 of file SemaChecking.cpp.
Referenced by SemaOpenCLBuiltinEnqueueKernel().
Diagnose integer type and any valid implicit conversion to it.
Diagnose integer type and any valid implicit convertion to it.
Definition at line 9943 of file SemaChecking.cpp.
References CheckImplicitConversion(), clang::Sema::Diag(), clang::Stmt::getLocStart(), clang::Expr::getType(), and clang::Type::isIntegerType().
|
static |
Definition at line 434 of file SemaChecking.cpp.
Referenced by checkOpenCLEnqueueVariadicArgs().
|
static |
OpenCL v2.0, s6.13.17.1 - Check that sizes are provided for all 'local void*' parameter of passed block.
Definition at line 445 of file SemaChecking.cpp.
References checkOpenCLEnqueueLocalSizeArgs(), clang::Sema::Diag(), clang::Type::getAs(), clang::QualType::getCanonicalType(), clang::CallExpr::getLocStart(), clang::CallExpr::getNumArgs(), clang::BlockPointerType::getPointeeType(), and clang::Expr::getType().
Referenced by SemaOpenCLBuiltinEnqueueKernel().
Returns true if pipe element type is different from the pointer.
Definition at line 617 of file SemaChecking.cpp.
References clang::Sema::Diag(), clang::CallExpr::getArg(), clang::FunctionDecl::getBuiltinID(), clang::CallExpr::getDirectCallee(), clang::Stmt::getLocStart(), clang::CallExpr::getLocStart(), getOpenCLArgAccess(), clang::Stmt::getSourceRange(), clang::Expr::getType(), and clang::Type::isPipeType().
Referenced by SemaBuiltinCommitRWPipe(), SemaBuiltinReserveRWPipe(), and SemaBuiltinRWPipe().
Returns true if pipe element type is different from the pointer.
Definition at line 667 of file SemaChecking.cpp.
References clang::Sema::Context, clang::Sema::Diag(), clang::CallExpr::getArg(), clang::Type::getAs(), clang::Type::getCanonicalTypeInternal(), clang::CallExpr::getDirectCallee(), clang::PipeType::getElementType(), clang::CallExpr::getLocStart(), clang::PointerType::getPointeeType(), clang::ASTContext::getPointerType(), clang::Stmt::getSourceRange(), clang::Expr::getType(), and clang::ASTContext::hasSameType().
Referenced by SemaBuiltinRWPipe().
Definition at line 378 of file SemaChecking.cpp.
|
static |
CheckReturnStackAddr - Check if a return statement returns the address of a stack variable.
Definition at line 7751 of file SemaChecking.cpp.
References clang::Sema::Diag(), EvalAddr(), EvalVal(), clang::NamedDecl::getDeclName(), clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::Stmt::getLocStart(), clang::tooling::fixit::internal::getSourceRange(), clang::Stmt::getSourceRange(), clang::Type::isBlockPointerType(), clang::Type::isPointerType(), and clang::Type::isReferenceType().
|
static |
Definition at line 8817 of file SemaChecking.cpp.
References clang::Sema::Context, clang::Type::getAs(), clang::Expr::getType(), clang::ASTContext::hasSameUnqualifiedType(), clang::Expr::IgnoreParenImpCasts(), clang::Sema::inTemplateInstantiation(), clang::Type::isBooleanType(), clang::Type::isEnumeralType(), and clang::Expr::isKnownToHaveBooleanValue().
Referenced by AnalyzeComparison().
|
static |
Definition at line 11622 of file SemaChecking.cpp.
References clang::Sema::CheckLiteralKind(), clang::Sema::Diag(), clang::Stmt::getSourceRange(), clang::Expr::IgnoreParenImpCasts(), clang::Sema::LK_None, and clang::Sema::LK_String.
Referenced by checkUnsafeAssignObject().
|
static |
Definition at line 11643 of file SemaChecking.cpp.
References clang::cast(), checkUnsafeAssignLiteral(), clang::Sema::Diag(), clang::Stmt::getSourceRange(), clang::Qualifiers::OCL_ExplicitNone, and clang::Qualifiers::OCL_Weak.
Referenced by clang::Sema::checkUnsafeAssigns(), and clang::Sema::checkUnsafeExprAssigns().
Check that the user is calling the appropriate va_start builtin for the target and calling convention.
Definition at line 3846 of file SemaChecking.cpp.
References clang::CC_C, clang::CC_Win64, clang::CC_X86_64SysV, clang::Sema::Context, clang::Sema::Diag(), clang::Sema::getCurFunctionDecl(), clang::Stmt::getLocStart(), clang::ASTContext::getTargetInfo(), and clang::TargetInfo::getTriple().
Referenced by checkVAStartIsInVariadicFunction().
|
static |
Definition at line 3880 of file SemaChecking.cpp.
References clang::CallExpr::arg_end(), checkBuiltinArgument(), checkVAStartABI(), clang::Sema::CurContext, Diag(), clang::Sema::Diag(), clang::CallExpr::getArg(), clang::Type::getAs(), clang::CallExpr::getCallee(), clang::CallExpr::getLocEnd(), clang::Stmt::getLocStart(), clang::CallExpr::getNumArgs(), clang::Stmt::getSourceRange(), clang::Expr::IgnoreParenCasts(), clang::Type::isEnumeralType(), clang::Type::isPromotableIntegerType(), clang::Type::isReferenceType(), clang::Type::isSpecificBuiltinType(), and clang::SC_Register.
|
static |
Definition at line 8803 of file SemaChecking.cpp.
Consider whether capturing the given variable can possibly lead to a retain cycle.
Definition at line 11185 of file SemaChecking.cpp.
References clang::QualType::getObjCLifetime(), clang::ValueDecl::getType(), and clang::Qualifiers::OCL_Strong.
Referenced by clang::Sema::checkRetainCycles(), and findRetainCycleOwner().
|
static |
Definition at line 5929 of file SemaChecking.cpp.
|
static |
Definition at line 10776 of file SemaChecking.cpp.
References clang::Sema::Context, clang::Sema::Diag(), clang::ASTContext::getAsArrayType(), clang::ArrayType::getElementType(), clang::ArrayType::getSizeModifier(), clang::Type::isVariablyModifiedType(), and clang::ArrayType::Star.
Referenced by clang::Sema::CheckParmsForFunctionDef().
|
static |
Diagnose use of s directive in an NSString which is being passed as formatting string to formatting method.
Definition at line 2572 of file SemaChecking.cpp.
References clang::NamedDecl::getObjCFStringFormattingFamily(), and clang::SFF_CFString.
|
static |
Diagnose an implicit cast from a floating point value to an integer value.
Definition at line 9210 of file SemaChecking.cpp.
References clang::Expr::IgnoreParenImpCasts(), clang::Sema::inTemplateInstantiation(), and clang::Type::isSpecificBuiltinType().
|
static |
Diagnose an implicit cast; purely a helper for CheckImplicitConversion.
Definition at line 9187 of file SemaChecking.cpp.
References clang::Sema::DiagRuntimeBehavior(), and clang::Expr::getExprLoc().
Referenced by CheckImplicitArgumentConversions(), CheckImplicitConversion(), and DiagnoseImpCast().
|
static |
Diagnose an implicit cast; purely a helper for CheckImplicitConversion.
Definition at line 9202 of file SemaChecking.cpp.
References DiagnoseImpCast(), clang::Expr::getType(), and clang::T.
|
static |
Definition at line 9351 of file SemaChecking.cpp.
References checkObjCArrayLiteral(), checkObjCDictionaryLiteral(), clang::Sema::Context, clang::FixItHint::CreateReplacement(), clang::Sema::Diag(), clang::Sema::Diags, clang::SourceRange::getBegin(), clang::Expr::getExprLoc(), clang::SourceManager::getFileID(), clang::Sema::getFixItZeroLiteralForType(), clang::SourceManager::getImmediateExpansionRange(), clang::SourceManager::getImmediateMacroCallerLoc(), clang::Lexer::getImmediateMacroNameForDiagnostics(), clang::Sema::getLangOpts(), clang::Stmt::getSourceRange(), clang::Type::isAnyPointerType(), clang::Type::isBlockPointerType(), clang::DiagnosticsEngine::isIgnored(), clang::SourceManager::isMacroArgExpansion(), clang::SourceLocation::isMacroID(), clang::Type::isMemberPointerType(), clang::Expr::isNullPointerConstant(), clang::Type::isNullPtrType(), clang::Type::isScalarType(), clang::Expr::NPC_ValueDependentIsNotNull, clang::Expr::NPCK_CXX11_nullptr, clang::Expr::NPCK_GNUNull, and clang::Sema::SourceMgr.
Definition at line 11369 of file SemaChecking.cpp.
References clang::Sema::Diag(), clang::Expr::getExprLoc(), and clang::Stmt::getSourceRange().
Referenced by clang::Sema::checkRetainCycles().
|
static |
Definition at line 7030 of file SemaChecking.cpp.
References clang::Sema::Context, clang::IdentifierTable::get(), clang::Sema::getLangOpts(), clang::Sema::getStdNamespace(), clang::ASTContext::Idents, clang::Type::isAnyComplexType(), clang::Type::isIntegralOrEnumerationType(), clang::Type::isRealFloatingType(), clang::Sema::LookupAnyName, clang::Sema::LookupQualifiedName(), and clang::LookupResult::suppressDiagnostics().
|
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:
Definition at line 7848 of file SemaChecking.cpp.
References clang::Stmt::getStmtClass(), clang::Expr::getType(), clang::Expr::IgnoreParens(), clang::Type::isAnyPointerType(), clang::Type::isBlockPointerType(), clang::Type::isObjCQualifiedIdType(), and clang::Expr::isTypeDependent().
Referenced by CheckReturnStackAddr().
|
static |
EvalVal - This function is complements EvalAddr in the mutual recursion.
See the comments for EvalAddr for more details.
Definition at line 8003 of file SemaChecking.cpp.
References clang::Stmt::getStmtClass(), and clang::Expr::IgnoreParens().
Referenced by CheckReturnStackAddr().
Check whether the given argument is a block which captures a variable.
Definition at line 11334 of file SemaChecking.cpp.
References clang::BlockDecl::capturesVariable(), clang::Sema::Context, clang::CallExpr::getArg(), clang::BlockExpr::getBlockDecl(), clang::BlockDecl::getBody(), clang::CallExpr::getCalleeDecl(), clang::NamedDecl::getIdentifier(), clang::Selector::getNameForSlot(), clang::CallExpr::getNumArgs(), clang::Expr::IgnoreParenCasts(), clang::IdentifierInfo::isStr(), and clang::Selector::isUnarySelector().
Referenced by clang::Sema::checkRetainCycles().
Definition at line 11198 of file SemaChecking.cpp.
References clang::cast(), considerVariable(), clang::ObjCPropertyRefExpr::getBase(), clang::Sema::getCurMethodDecl(), clang::ObjCPropertyRefExpr::getExplicitProperty(), clang::ObjCPropertyRefExpr::getLocation(), clang::QualType::getObjCLifetime(), clang::ObjCMethodDecl::getSelfDecl(), clang::Stmt::getSourceRange(), clang::ValueDecl::getType(), clang::Expr::IgnoreParens(), clang::ObjCPropertyRefExpr::isImplicitProperty(), clang::ObjCPropertyRefExpr::isSuperReceiver(), and clang::Qualifiers::OCL_Strong.
Referenced by clang::Sema::checkRetainCycles().
|
static |
Given a type tag expression find the type tag itself.
TypeExpr | Type tag expression, as it appears in user's code. |
VD | Declaration of an identifier that appears in a type tag. |
MagicValue | Type tag magic value. |
Definition at line 12112 of file SemaChecking.cpp.
References clang::Expr::EvaluateAsBooleanCondition(), clang::AbstractConditionalOperator::getCond(), clang::DeclRefExpr::getDecl(), clang::AbstractConditionalOperator::getFalseExpr(), clang::UnaryOperator::getOpcode(), clang::BinaryOperator::getOpcode(), clang::BinaryOperator::getRHS(), clang::Stmt::getStmtClass(), clang::UnaryOperator::getSubExpr(), clang::AbstractConditionalOperator::getTrueExpr(), clang::APIntStorage::getValue(), clang::Expr::IgnoreParenCasts(), and clang::Expr::IgnoreParenImpCasts().
Referenced by GetMatchingCType().
|
static |
Definition at line 6873 of file SemaChecking.cpp.
|
static |
Definition at line 6997 of file SemaChecking.cpp.
References clang::FunctionDecl::getBuiltinID(), and clang::NamedDecl::getIdentifier().
Referenced by IsStdFunction().
|
static |
Definition at line 6920 of file SemaChecking.cpp.
References AVK_Complex, AVK_Floating, AVK_Integer, clang::Type::isAnyComplexType(), clang::Type::isIntegralOrEnumerationType(), and clang::Type::isRealFloatingType().
|
static |
Definition at line 6895 of file SemaChecking.cpp.
|
static |
Determine whether the given type is or contains a dynamic class type (e.g., whether it has a vtable).
Definition at line 7303 of file SemaChecking.cpp.
References clang::RecordDecl::fields(), clang::Type::getAsCXXRecordDecl(), clang::Type::getBaseElementTypeUnsafe(), clang::CXXRecordDecl::getDefinition(), clang::CXXRecordDecl::isDynamicClass(), and clang::Decl::isInvalidDecl().
|
static |
A helper function to get the alignment of a Decl referred to by DeclRefExpr or MemberExpr.
Definition at line 10880 of file SemaChecking.cpp.
Referenced by clang::CodeGen::CodeGenFunction::EmitCXXGlobalVarDeclInit(), clang::CodeGen::CodeGenModule::EmitOMPThreadPrivateDecl(), clang::CodeGen::CodeGenFunction::EmitParmDecl(), clang::ASTContext::getTypeAlign(), clang::CodeGen::CodeGenModule::isTypeConstant(), and clang::CodeGen::CodeGenModule::maybeSetTrivialComdat().
|
static |
Pseudo-evaluate the given integer expression, estimating the range of values it might take.
MaxWidth | - the width to which the value will be truncated |
Definition at line 8382 of file SemaChecking.cpp.
References clang::Expr::EvaluateAsRValue(), GetExprType(), GetValueRange(), clang::Expr::IgnoreParens(), min(), and clang::Expr::EvalResult::Val.
Referenced by AnalyzeComparison(), and GetExprRange().
|
static |
Definition at line 8602 of file SemaChecking.cpp.
References GetExprRange(), GetExprType(), and clang::ASTContext::getIntWidth().
Definition at line 8371 of file SemaChecking.cpp.
References clang::Type::getAs(), and clang::Expr::getType().
Referenced by GetExprRange().
|
static |
Definition at line 6823 of file SemaChecking.cpp.
|
static |
Retrieve the C type corresponding to type tag TypeExpr.
TypeExpr | Expression that specifies a type tag. |
MagicValues | Registered magic values. |
FoundWrongKind | Set to true if a type tag was found, but of a wrong kind. |
TypeInfo | Information about the corresponding C type. |
Definition at line 12188 of file SemaChecking.cpp.
References FindTypeTagExpr().
Referenced by IsSameCharType().
|
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 1311 of file SemaChecking.cpp.
|
static |
Definition at line 11402 of file SemaChecking.cpp.
References clang::NSAPI::ClassId_NSMutableArray, clang::ObjCMessageExpr::getReceiverInterface(), clang::ObjCMessageExpr::getSelector(), clang::Sema::NSAPIObj, clang::NSAPI::NSMutableArr_addObject, clang::NSAPI::NSMutableArr_insertObjectAtIndex, clang::NSAPI::NSMutableArr_replaceObjectAtIndex, and clang::NSAPI::NSMutableArr_setObjectAtIndexedSubscript.
Referenced by GetNSSetArgumentIndex().
|
static |
Definition at line 11437 of file SemaChecking.cpp.
References clang::NSAPI::ClassId_NSMutableDictionary, clang::ObjCMessageExpr::getReceiverInterface(), clang::ObjCMessageExpr::getSelector(), clang::Sema::NSAPIObj, clang::NSAPI::NSMutableDict_setObjectForKey, clang::NSAPI::NSMutableDict_setObjectForKeyedSubscript, and clang::NSAPI::NSMutableDict_setValueForKey.
Referenced by GetNSSetArgumentIndex().
|
static |
Definition at line 11469 of file SemaChecking.cpp.
References clang::NSAPI::ClassId_NSMutableOrderedSet, clang::NSAPI::ClassId_NSMutableSet, Diag(), clang::ObjCMessageExpr::getArg(), clang::SourceRange::getBegin(), clang::ObjCMessageExpr::getInstanceReceiver(), clang::Decl::getLocation(), clang::NamedDecl::getName(), GetNSMutableArrayArgumentIndex(), GetNSMutableDictionaryArgumentIndex(), clang::ObjCMessageExpr::getReceiverInterface(), clang::ObjCMessageExpr::getReceiverKind(), clang::ObjCMessageExpr::getSelector(), clang::Stmt::getSourceRange(), clang::Expr::IgnoreImpCasts(), clang::ObjCMessageExpr::isInstanceMessage(), clang::Sema::NSAPIObj, clang::NSAPI::NSMutableSet_addObject, clang::NSAPI::NSOrderedSet_insertObjectAtIndex, clang::NSAPI::NSOrderedSet_replaceObjectAtIndexWithObject, clang::NSAPI::NSOrderedSet_setObjectAtIndex, clang::NSAPI::NSOrderedSet_setObjectAtIndexedSubscript, and clang::ObjCMessageExpr::SuperInstance.
|
static |
Returns OpenCL access qual.
Definition at line 612 of file SemaChecking.cpp.
References clang::Decl::getAttr().
Referenced by checkOpenCLPipeArg().
If E is a sizeof expression, returns its argument type.
Definition at line 7344 of file SemaChecking.cpp.
References CheckMemorySizeofForComparison(), clang::CallExpr::getArg(), clang::Type::getAs(), clang::Expr::getExprLoc(), clang::CallExpr::getLocStart(), clang::CallExpr::getNumArgs(), clang::Type::getPointeeType(), clang::CallExpr::getRParenLoc(), getSizeOfExprArg(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Expr::IgnoreParenImpCasts(), clang::Type::isVoidType(), clang::Stmt::Profile(), and clang::UETT_SizeOf.
If E is a sizeof expression, returns its argument expression, otherwise returns NULL.
Definition at line 7334 of file SemaChecking.cpp.
References clang::Expr::IgnoreParenImpCasts(), and clang::UETT_SizeOf.
Referenced by getSizeOfArgType(), and getStrlenExprArg().
Definition at line 7644 of file SemaChecking.cpp.
References CheckMemorySizeofForComparison(), clang::CallExpr::getArg(), clang::SourceRange::getBegin(), clang::SourceRange::getEnd(), clang::Stmt::getLocStart(), clang::CallExpr::getLocStart(), clang::FunctionDecl::getMemoryFunctionKind(), clang::CallExpr::getNumArgs(), clang::CallExpr::getRParenLoc(), getSizeOfExprArg(), clang::Stmt::getSourceRange(), clang::SourceManager::getSpellingLoc(), clang::Expr::getType(), clang::Expr::IgnoreParenCasts(), isConstantSizeArrayWithMoreThanOneElement(), clang::SourceManager::isMacroArgExpansion(), referToTheSameDecl(), and SM.
|
static |
Definition at line 8329 of file SemaChecking.cpp.
Referenced by GetExprRange(), and GetValueRange().
|
static |
Definition at line 8342 of file SemaChecking.cpp.
References clang::APValue::getComplexIntReal(), clang::APValue::getInt(), GetValueRange(), clang::APValue::getVectorElt(), clang::APValue::getVectorLength(), clang::APValue::isComplexInt(), clang::APValue::isInt(), and clang::APValue::isVector().
Definition at line 8791 of file SemaChecking.cpp.
References clang::Expr::getType(), and clang::Type::isEnumeralType().
|
static |
Definition at line 7532 of file SemaChecking.cpp.
References clang::BinaryOperator::getLHS(), clang::BinaryOperator::getRHS(), clang::Expr::IgnoreParenCasts(), and clang::BinaryOperator::isAdditiveOp().
Definition at line 339 of file SemaChecking.cpp.
References clang::Expr::getType(), and clang::Type::isBlockPointerType().
Referenced by computeCopyInfoForBlockCapture(), inferARCWriteback(), and SemaOpenCLBuiltinEnqueueKernel().
|
static |
Definition at line 7554 of file SemaChecking.cpp.
Referenced by getStrlenExprArg().
Definition at line 8646 of file SemaChecking.cpp.
References clang::Stmt::getLocStart(), clang::Expr::IgnoreParenImpCasts(), and clang::SourceLocation::isMacroID().
Definition at line 9311 of file SemaChecking.cpp.
References clang::Sema::Context, clang::ASTContext::getCanonicalType(), clang::Expr::getType(), clang::Expr::IgnoreParenImpCasts(), clang::Type::isDependentType(), and clang::BuiltinType::isFloatingPoint().
Referenced by CheckImplicitArgumentConversions().
|
static |
Definition at line 9992 of file SemaChecking.cpp.
References clang::SourceManager::getImmediateMacroCallerLoc(), clang::SourceLocation::isInvalid(), clang::SourceManager::isMacroBodyExpansion(), and clang::SourceLocation::isMacroID().
Referenced by clang::Sema::DiagnoseAlwaysNonNullPointer().
Definition at line 8660 of file SemaChecking.cpp.
References compare(), clang::Expr::getType(), clang::Expr::IgnoreParenImpCasts(), clang::Type::isIntegerType(), clang::Type::isSignedIntegerType(), and clang::None.
|
static |
Check if two types are layout-compatible in C++11 sense.
Definition at line 12068 of file SemaChecking.cpp.
References clang::QualType::getCanonicalType(), clang::Type::getTypeClass(), clang::QualType::getUnqualifiedType(), clang::ASTContext::hasSameType(), clang::QualType::isNull(), and clang::Type::isStandardLayoutType().
Referenced by clang::Sema::DiagnoseSelfMove(), isLayoutCompatible(), and isLayoutCompatibleStruct().
|
static |
Check if two enumeration types are layout-compatible.
Definition at line 11955 of file SemaChecking.cpp.
References clang::EnumDecl::getIntegerType(), clang::ASTContext::hasSameType(), and clang::EnumDecl::isComplete().
|
static |
Check if two fields are layout-compatible.
Definition at line 11964 of file SemaChecking.cpp.
References clang::FieldDecl::getBitWidthValue(), clang::ValueDecl::getType(), clang::FieldDecl::isBitField(), and isLayoutCompatible().
|
static |
Definition at line 12056 of file SemaChecking.cpp.
References isLayoutCompatibleStruct(), isLayoutCompatibleUnion(), and clang::TagDecl::isUnion().
|
static |
Check if two standard-layout structs are layout-compatible.
(C++11 [class.mem] p17)
Definition at line 11986 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().
|
static |
Check if two standard-layout unions are layout-compatible.
(C++11 [class.mem] p18)
Definition at line 12030 of file SemaChecking.cpp.
References clang::RecordDecl::fields().
Referenced by isLayoutCompatible().
|
static |
Determine whether the given type has a non-null nullability annotation.
Definition at line 2612 of file SemaChecking.cpp.
References clang::Type::getNullability(), and clang::NonNull.
Definition at line 12245 of file SemaChecking.cpp.
References Diag(), clang::Type::getAs(), clang::BuiltinType::getKind(), and GetMatchingCType().
|
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 8609 of file SemaChecking.cpp.
Referenced by IsSameFloatAfterCast().
|
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 8626 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().
|
static |
Definition at line 9500 of file SemaChecking.cpp.
References clang::SourceManager::getCharacterData(), clang::Sema::getSourceManager(), clang::Expr::IgnoreParenImpCasts(), clang::Type::isCharType(), and clang::SourceLocation::isValid().
Check for a keyword selector that starts with the word 'add' or 'set'.
Definition at line 11382 of file SemaChecking.cpp.
References clang::Selector::getNameForSlot(), clang::Selector::getNumArgs(), clang::isLowercase(), and clang::Selector::isUnarySelector().
Referenced by clang::Sema::checkRetainCycles().
|
static |
Definition at line 7113 of file SemaChecking.cpp.
References getAbsoluteValueFunctionKind(), clang::CallExpr::getArg(), clang::NamedDecl::getIdentifier(), clang::CallExpr::getNumArgs(), clang::Expr::getType(), clang::Expr::IgnoreParenImpCasts(), clang::Decl::isInStdNamespace(), clang::IdentifierInfo::isStr(), and clang::Type::isUnsignedIntegerType().
|
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 10948 of file SemaChecking.cpp.
References clang::TypeLoc::getAs(), clang::Decl::getDeclContext(), clang::Expr::getExprLoc(), clang::Decl::getNextDeclInContext(), clang::Type::getPointeeOrArrayElementType(), clang::Expr::getType(), clang::TypeSourceInfo::getTypeLoc(), clang::DeclaratorDecl::getTypeSourceInfo(), clang::TypedefNameDecl::getTypeSourceInfo(), clang::Expr::IgnoreParenCasts(), clang::Expr::IgnoreParenImpCasts(), clang::SourceLocation::isMacroID(), clang::TagDecl::isUnion(), and clang::Expr::isValueDependent().
|
static |
Definition at line 2894 of file SemaChecking.cpp.
References Diag(), clang::ExprError(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::QualType::getAddressSpace(), clang::CallExpr::getArg(), clang::Type::getAs(), clang::CallExpr::getCallee(), clang::CallExpr::getLocEnd(), clang::Stmt::getLocStart(), clang::CallExpr::getNumArgs(), clang::Type::getPointeeType(), clang::PointerType::getPointeeType(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Expr::IgnoreParenCasts(), clang::Type::isAtomicType(), clang::QualType::isConstQualified(), clang::Type::isIntegerType(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::Type::isPointerType(), clang::QualType::isTriviallyCopyableType(), clang::opencl_constant, and clang::ast_matchers::pointerType.
|
static |
Definition at line 9301 of file SemaChecking.cpp.
Check if two expressions refer to the same declaration.
Definition at line 7637 of file SemaChecking.cpp.
Referenced by getStrlenExprArg().
Definition at line 6203 of file SemaChecking.cpp.
References clang::Stmt::getStmtClass(), and clang::Expr::IgnoreImpCasts().
Definition at line 1278 of file SemaChecking.cpp.
References clang::NeonTypeFlags::Float16, clang::NeonTypeFlags::Float32, clang::NeonTypeFlags::Float64, clang::NeonTypeFlags::getEltType(), clang::NeonTypeFlags::Int16, clang::NeonTypeFlags::Int32, clang::NeonTypeFlags::Int64, clang::NeonTypeFlags::Int8, clang::NeonTypeFlags::isQuad(), clang::NeonTypeFlags::Poly128, clang::NeonTypeFlags::Poly16, clang::NeonTypeFlags::Poly64, clang::NeonTypeFlags::Poly8, and true.
Check that the argument to __builtin_addressof is a glvalue, and set the result type to the corresponding pointer type.
Definition at line 179 of file SemaChecking.cpp.
Check that the first argument to __builtin_annotation is an integer and the second argument is a non-wide string literal.
Definition at line 129 of file SemaChecking.cpp.
Definition at line 254 of file SemaChecking.cpp.
Definition at line 774 of file SemaChecking.cpp.
References checkArgCount(), checkOpenCLPipeArg(), clang::Sema::Context, clang::Sema::Diag(), clang::CallExpr::getArg(), clang::CallExpr::getDirectCallee(), clang::CallExpr::getLocStart(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Type::isReserveIDT(), and clang::ASTContext::OCLReserveIDTy.
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 1933 of file SemaChecking.cpp.
References clang::Sema::Context, Diag(), clang::Sema::Diag(), clang::CallExpr::getArg(), clang::CallExpr::getLocStart(), clang::Stmt::getSourceRange(), clang::ASTContext::getTargetInfo(), clang::Expr::IgnoreParenImpCasts(), clang::Expr::isTypeDependent(), clang::Expr::isValueDependent(), SemaBuiltinCpuSupports(), and clang::TargetInfo::validateCpuIs().
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 1913 of file SemaChecking.cpp.
References clang::Sema::Context, clang::Sema::Diag(), clang::CallExpr::getArg(), clang::CallExpr::getLocStart(), clang::Stmt::getSourceRange(), clang::ASTContext::getTargetInfo(), clang::Expr::IgnoreParenImpCasts(), and clang::TargetInfo::validateCpuSupports().
Referenced by SemaBuiltinCpuIs().
|
static |
Definition at line 226 of file SemaChecking.cpp.
Definition at line 155 of file SemaChecking.cpp.
Definition at line 193 of file SemaChecking.cpp.
Definition at line 797 of file SemaChecking.cpp.
References checkArgCount(), clang::Sema::Diag(), clang::CallExpr::getArg(), clang::CallExpr::getDirectCallee(), clang::CallExpr::getLocStart(), clang::Stmt::getSourceRange(), clang::Expr::getType(), and clang::Type::isPipeType().
Definition at line 745 of file SemaChecking.cpp.
References checkArgCount(), checkOpenCLPipeArg(), clang::Sema::Context, clang::Sema::Diag(), clang::CallExpr::getArg(), clang::CallExpr::getDirectCallee(), clang::CallExpr::getLocStart(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Type::isIntegerType(), clang::Type::isUnsignedIntegerType(), clang::ASTContext::OCLReserveIDTy, clang::Expr::setType(), and clang::ASTContext::UnsignedIntTy.
Definition at line 690 of file SemaChecking.cpp.
References checkOpenCLPipeArg(), checkOpenCLPipePacketType(), clang::Sema::Context, clang::Sema::Diag(), clang::CallExpr::getArg(), clang::CallExpr::getDirectCallee(), clang::CallExpr::getLocStart(), clang::CallExpr::getNumArgs(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Type::isIntegerType(), clang::Type::isReserveIDT(), clang::Type::isUnsignedIntegerType(), clang::ASTContext::OCLReserveIDTy, and clang::ASTContext::UnsignedIntTy.
|
static |
Definition at line 317 of file SemaChecking.cpp.
References clang::Sema::inTemplateInstantiation().
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 493 of file SemaChecking.cpp.
References checkOpenCLBlockArgs(), checkOpenCLEnqueueVariadicArgs(), clang::Sema::Context, clang::Sema::Diag(), clang::CallExpr::getArg(), clang::Type::getAs(), clang::QualType::getAsString(), clang::QualType::getCanonicalType(), clang::CallExpr::getDirectCallee(), clang::Stmt::getLocStart(), clang::CallExpr::getLocStart(), 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.
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 416 of file SemaChecking.cpp.
Definition at line 387 of file SemaChecking.cpp.
Definition at line 816 of file SemaChecking.cpp.
References clang::Sema::Context, clang::Sema::Diag(), clang::CallExpr::getArg(), clang::CallExpr::getDirectCallee(), clang::CallExpr::getLocStart(), clang::CallExpr::getNumArgs(), clang::ASTContext::getPointerType(), clang::ASTContext::getQualifiedType(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::opencl_constant, clang::opencl_global, clang::opencl_local, clang::opencl_private, and clang::Expr::setType().
|
static |
Definition at line 11743 of file SemaChecking.cpp.
References clang::SourceManager::getPresumedLineNumber(), clang::NullStmt::getSemiLoc(), clang::SourceManager::getSpellingLineNumber(), and clang::NullStmt::hasLeadingEmptyMacro().
Referenced by clang::Sema::DiagnoseEmptyLoopBody(), and clang::Sema::DiagnoseEmptyStmtBody().
|
static |
Definition at line 6240 of file SemaChecking.cpp.
|
static |
Definition at line 4750 of file SemaChecking.cpp.
References CheckFormatString(), clang::StringLiteral::getByteLength(), clang::StringLiteral::getCharByteWidth(), getKind(), clang::StringLiteral::getKind(), clang::StringLiteral::getLength(), clang::StringLiteral::getLocationOfByte(), clang::StringLiteral::getLocEnd(), clang::StringLiteral::getLocStart(), clang::SourceLocation::getLocWithOffset(), clang::StringLiteral::getString(), clang::Expr::getType(), clang::StringLiteral::isAscii(), clang::StringLiteral::isPascal(), clang::StringLiteral::isUTF16(), clang::StringLiteral::isUTF32(), clang::StringLiteral::isUTF8(), clang::StringLiteral::isWide(), max(), and SM.