clang  19.0.0git
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/FormatString.h"
#include "clang/AST/IgnoreExpr.h"
#include "clang/AST/NSAPI.h"
#include "clang/AST/NonTrivialTypeVisitor.h"
#include "clang/AST/OperationKinds.h"
#include "clang/AST/RecordLayout.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/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 "clang/Sema/SemaSYCL.h"
#include "clang/Sema/SemaObjC.h"
#include "clang/Sema/SemaRISCV.h"
#include "clang/Sema/SemaX86.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/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/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/StringSwitch.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/SaveAndRestore.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TargetParser/RISCVTargetParser.h"
#include "llvm/TargetParser/Triple.h"
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <limits>
#include <optional>
#include <string>
#include <tuple>
#include <utility>
#include "clang/Basic/Builtins.inc"
#include "clang/Basic/arm_sme_builtins_za_state.inc"
#include "clang/Basic/arm_sme_streaming_attrs.inc"
#include "clang/Basic/arm_sme_sema_rangechecks.inc"
#include "clang/Basic/arm_sve_streaming_attrs.inc"
#include "clang/Basic/arm_sve_sema_rangechecks.inc"
#include "clang/Basic/arm_neon.inc"
#include "clang/Basic/arm_fp16.inc"
#include "clang/Basic/arm_mve_builtin_sema.inc"
#include "clang/Basic/arm_cde_builtin_sema.inc"
#include "clang/Basic/PPCTypes.def"
#include "clang/Basic/BuiltinsPPC.def"

Go to the source code of this file.

Macros

#define BUILTIN(ID, TYPE, ATTRS)
 
#define ATOMIC_BUILTIN(ID, TYPE, ATTRS)
 
#define GET_SME_BUILTIN_GET_STATE
 
#define GET_SME_STREAMING_ATTRS
 
#define GET_SME_IMMEDIATE_CHECK
 
#define GET_SVE_STREAMING_ATTRS
 
#define GET_SVE_IMMEDIATE_CHECK
 
#define GET_NEON_BUILTINS
 
#define TARGET_BUILTIN(id, ...)   case NEON::BI##id:
 
#define BUILTIN(id, ...)   case NEON::BI##id:
 
#define GET_NEON_OVERLOAD_CHECK
 
#define GET_NEON_IMMEDIATE_CHECK
 
#define PPC_VECTOR_TYPE(typeName, Id, size)    case size: Type = Context.Id##Ty; break;
 
#define CUSTOM_BUILTIN(Name, Intr, Types, Acc, Feature)
 
#define PPC_VECTOR_TYPE(Name, Id, Size)   || CoreType == Context.Id##Ty
 
#define BUILTIN_ROW(x)
 

Enumerations

enum  ArmStreamingType { ArmNonStreaming , ArmStreaming , ArmStreamingCompatible , ArmStreamingOrSVE2p1 }
 
enum  ArmSMEState : unsigned {
  ArmNoState = 0 , ArmInZA = 0b01 , ArmOutZA = 0b10 , ArmInOutZA = 0b11 ,
  ArmZAMask = 0b11 , ArmInZT0 = 0b01 << 2 , ArmOutZT0 = 0b10 << 2 , ArmInOutZT0 = 0b11 << 2 ,
  ArmZT0Mask = 0b11 << 2
}
 
enum  AbsoluteValueKind { AVK_Integer , AVK_Floating , AVK_Complex }
 

Functions

static const ExprmaybeConstEvalStringLiteral (ASTContext &Context, const Expr *E)
 
static constexpr unsigned short combineFAPK (Sema::FormatArgumentPassingKind A, Sema::FormatArgumentPassingKind B)
 
static bool convertArgumentToType (Sema &S, Expr *&Value, QualType Ty)
 
static bool BuiltinAnnotation (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 BuiltinMSVCAnnotation (Sema &S, CallExpr *TheCall)
 
static bool BuiltinAddressof (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 BuiltinFunctionStart (Sema &S, CallExpr *TheCall)
 Check that the argument to __builtin_function_start is a function. More...
 
static bool BuiltinPreserveAI (Sema &S, CallExpr *TheCall)
 Check the number of arguments and set the result type to the argument type. More...
 
static bool BuiltinAlignment (Sema &S, CallExpr *TheCall, unsigned ID)
 Check that the value argument for __builtin_is_aligned(value, alignment) and __builtin_aligned_{up,down}(value, alignment) is an integer or a pointer type (but not a function pointer) and that the alignment is a power-of-two. More...
 
static bool BuiltinOverflow (Sema &S, CallExpr *TheCall, unsigned BuiltinID)
 
static ExprResult BuiltinDumpStruct (Sema &S, CallExpr *TheCall)
 
static bool BuiltinCallWithStaticChain (Sema &S, CallExpr *BuiltinCall)
 
static bool ProcessFormatStringLiteral (const Expr *FormatExpr, StringRef &FormatStrRef, size_t &StrLen, ASTContext &Context)
 
static bool BuiltinSEHScopeCheck (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 OpenCLBuiltinNDRangeAndBlock (Sema &S, CallExpr *TheCall)
 
static bool OpenCLBuiltinKernelWorkGroupSize (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 OpenCLBuiltinEnqueueKernel (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 BuiltinRWPipe (Sema &S, CallExpr *Call)
 
static bool BuiltinReserveRWPipe (Sema &S, CallExpr *Call)
 
static bool BuiltinCommitRWPipe (Sema &S, CallExpr *Call)
 
static bool BuiltinPipePackets (Sema &S, CallExpr *Call)
 
static bool OpenCLBuiltinToAddr (Sema &S, unsigned BuiltinID, CallExpr *Call)
 
static bool checkPointerAuthEnabled (Sema &S, Expr *E)
 
static bool checkPointerAuthKey (Sema &S, Expr *&Arg)
 
static bool checkPointerAuthValue (Sema &S, Expr *&Arg, PointerAuthOpKind OpKind)
 
static ExprResult PointerAuthStrip (Sema &S, CallExpr *Call)
 
static ExprResult PointerAuthBlendDiscriminator (Sema &S, CallExpr *Call)
 
static ExprResult PointerAuthSignGenericData (Sema &S, CallExpr *Call)
 
static ExprResult PointerAuthSignOrAuth (Sema &S, CallExpr *Call, PointerAuthOpKind OpKind)
 
static ExprResult PointerAuthAuthAndResign (Sema &S, CallExpr *Call)
 
static ExprResult BuiltinLaunder (Sema &S, CallExpr *TheCall)
 
static bool CheckBuiltinTargetNotInUnsupported (Sema &S, unsigned BuiltinID, CallExpr *TheCall, ArrayRef< llvm::Triple::ObjectFormatType > UnsupportedObjectFormatTypes)
 
static bool CheckBuiltinTargetInSupported (Sema &S, unsigned BuiltinID, CallExpr *TheCall, ArrayRef< llvm::Triple::ArchType > SupportedArchs)
 
static void CheckNonNullArgument (Sema &S, const Expr *ArgExpr, SourceLocation CallSiteLoc)
 
static bool checkMathBuiltinElementType (Sema &S, SourceLocation Loc, QualType ArgTy, int ArgIndex)
 
static bool checkFPMathBuiltinElementType (Sema &S, SourceLocation Loc, QualType ArgTy, int ArgIndex)
 
static bool BuiltinCpu (Sema &S, const TargetInfo &TI, CallExpr *TheCall, const TargetInfo *AuxTI, unsigned BuiltinID)
 BuiltinCpu{Supports|Is} - Handle __builtin_cpu_{supports|is}(char *). More...
 
static bool BuiltinPopcountg (Sema &S, CallExpr *TheCall)
 Checks that __builtin_popcountg was called with a single argument, which is an unsigned integer. More...
 
static bool BuiltinCountZeroBitsGeneric (Sema &S, CallExpr *TheCall)
 Checks that __builtin_{clzg,ctzg} was called with a first argument, which is an unsigned integer, and an optional second argument, which is promoted to an 'int'. More...
 
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 ArmStreamingType getArmStreamingFnType (const FunctionDecl *FD)
 
static void checkArmStreamingBuiltin (Sema &S, CallExpr *TheCall, const FunctionDecl *FD, ArmStreamingType BuiltinType)
 
static bool hasArmZAState (const FunctionDecl *FD)
 
static bool hasArmZT0State (const FunctionDecl *FD)
 
static ArmSMEState getSMEState (unsigned BuiltinID)
 
static bool isValidBPFPreserveFieldInfoArg (Expr *Arg)
 
static bool isValidBPFPreserveTypeInfoArg (Expr *Arg)
 
static bool isValidBPFPreserveEnumValueArg (Expr *Arg)
 
static QualType DecodePPCMMATypeFromStr (ASTContext &Context, const char *&Str, unsigned &Mask)
 DecodePPCMMATypeFromStr - This decodes one PPC MMA type descriptor from Str, advancing the pointer over the consumed characters. More...
 
static bool isPPC_64Builtin (unsigned BuiltinID)
 
bool CheckVectorElementCallArgs (Sema *S, CallExpr *TheCall)
 
bool CheckArgsTypesAreCorrect (Sema *S, CallExpr *TheCall, QualType ExpectedType, llvm::function_ref< bool(clang::QualType PassedType)> Check)
 
bool CheckAllArgsHaveFloatRepresentation (Sema *S, CallExpr *TheCall)
 
bool CheckFloatOrHalfRepresentations (Sema *S, CallExpr *TheCall)
 
bool CheckNoDoubleVectors (Sema *S, CallExpr *TheCall)
 
bool CheckUnsignedIntRepresentation (Sema *S, CallExpr *TheCall)
 
void SetElementTypeAsReturnType (Sema *S, CallExpr *TheCall, QualType ReturnType)
 
static bool checkIntelFPGARegArgument (Sema &S, QualType ArgType, SourceLocation &Loc)
 
static llvm::APSInt getSYCLAllocaDefaultSize (const ASTContext &Ctx, const VarDecl *VD)
 
static bool CheckNonNullExpr (Sema &S, const Expr *Expr)
 Checks if a the given expression evaluates to null. More...
 
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 (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 bool IsShiftedByte (llvm::APSInt Value)
 
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, Sema::FormatArgumentPassingKind APK, unsigned format_idx, unsigned firstDataArg, Sema::FormatStringType Type, bool inFunctionCall, Sema::VariadicCallType CallType, llvm::SmallBitVector &CheckedVarArgs, UncoveredArgHandler &UncoveredArg, bool IgnoreStringsWithoutSpecifiers)
 
static StringLiteralCheckType checkFormatStringExpr (Sema &S, const Expr *E, ArrayRef< const Expr * > Args, Sema::FormatArgumentPassingKind APK, unsigned format_idx, unsigned firstDataArg, Sema::FormatStringType Type, Sema::VariadicCallType CallType, bool InFunctionCall, llvm::SmallBitVector &CheckedVarArgs, UncoveredArgHandler &UncoveredArg, llvm::APSInt Offset, bool IgnoreStringsWithoutSpecifiers=false)
 
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 bool isArithmeticArgumentPromotion (Sema &S, const ImplicitCastExpr *ICE)
 Return true if ICE is an implicit argument promotion of an arithmetic type. More...
 
static analyze_format_string::ArgType::MatchKind handleFormatSignedness (analyze_format_string::ArgType::MatchKind Match, DiagnosticsEngine &Diags, SourceLocation Loc)
 
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, bool InConstantContext, bool Approximate)
 Pseudo-evaluate the given integer expression, estimating the range of values it might take. More...
 
static IntRange GetExprRange (ASTContext &C, const Expr *E, bool InConstantContext, bool Approximate)
 
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, bool IsListInit)
 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 bool isObjCSignedCharBool (Sema &S, QualType Ty)
 
static void adornObjCBoolConversionDiagWithTernaryFixit (Sema &S, Expr *SourceExpr, const Sema::SemaDiagnosticBuilder &Builder)
 
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 const IntegerLiteralgetIntegerLiteral (Expr *E)
 
static void DiagnoseIntInBoolContext (Sema &S, Expr *E)
 
static void CheckImplicitConversion (Sema &S, Expr *E, QualType T, SourceLocation CC, bool *ICContext=nullptr, bool IsListInit=false)
 
static void CheckConditionalOperator (Sema &S, AbstractConditionalOperator *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 void AnalyzeImplicitConversions (Sema &S, AnalyzeImplicitConversionsWorkItem Item, llvm::SmallVectorImpl< AnalyzeImplicitConversionsWorkItem > &WorkList)
 Data recursive variant of AnalyzeImplicitConversions. 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 std::optional< std::pair< CharUnits, CharUnits > > getBaseAlignmentAndOffsetFromPtr (const Expr *E, ASTContext &Ctx)
 This helper function takes a pointer expression and returns the alignment of a VarDecl and a constant offset from the VarDecl. More...
 
static std::pair< CharUnits, CharUnitsgetDerivedToBaseAlignmentAndOffset (const CastExpr *CE, QualType DerivedType, CharUnits BaseAlignment, CharUnits Offset, ASTContext &Ctx)
 Compute the alignment and offset of the base class object given the derived-to-base cast expression and the alignment and offset of the derived class object. More...
 
static std::optional< std::pair< CharUnits, CharUnits > > getAlignmentAndOffsetFromBinAddOrSub (const Expr *PtrE, const Expr *IntE, bool IsSub, ASTContext &Ctx)
 Compute the alignment and offset of a binary additive operator. More...
 
static std::optional< std::pair< CharUnits, CharUnits > > getBaseAlignmentAndOffsetFromLValue (const Expr *E, ASTContext &Ctx)
 This helper function takes an lvalue expression and returns the alignment of a VarDecl and a constant offset from the VarDecl. More...
 
static CharUnits getPresumedAlignmentOfPointer (const Expr *E, Sema &S)
 
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, bool AreUnionMembers=false)
 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, bool isConstantEvaluated)
 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, bool isConstantEvaluated)
 Retrieve the C type corresponding to type tag TypeExpr. More...
 
static bool IsSameCharType (QualType T1, QualType T2)
 
static std::optional< unsignedgetAndVerifyMatrixDimension (Expr *Expr, StringRef Name, Sema &S)
 
static bool CheckWasmBuiltinArgIsTable (Sema &S, CallExpr *E, unsigned ArgIndex, QualType &ElTy)
 Checks the argument at the given index is a WebAssembly table and if it is, sets ElTy to the element type. More...
 
static bool CheckWasmBuiltinArgIsInteger (Sema &S, CallExpr *E, unsigned ArgIndex)
 Checks the argument at the given index is an integer. More...
 

Macro Definition Documentation

◆ ATOMIC_BUILTIN

#define ATOMIC_BUILTIN (   ID,
  TYPE,
  ATTRS 
)
Value:
case Builtin::BI##ID: \
return AtomicOpsOverloaded(TheCallResult, AtomicExpr::AO##ID);
static char ID
Definition: Arena.cpp:183

◆ BUILTIN [1/2]

#define BUILTIN (   ID,
  TYPE,
  ATTRS 
)

◆ BUILTIN [2/2]

#define BUILTIN (   id,
  ... 
)    case NEON::BI##id:

◆ 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 }
__inline void unsigned int _2
Definition: larchintrin.h:181

◆ CUSTOM_BUILTIN

#define CUSTOM_BUILTIN (   Name,
  Intr,
  Types,
  Acc,
  Feature 
)
Value:
case PPC::BI__builtin_##Name: \
return BuiltinPPCMMACall(TheCall, BuiltinID, Types);

◆ GET_NEON_BUILTINS

#define GET_NEON_BUILTINS

◆ GET_NEON_IMMEDIATE_CHECK

#define GET_NEON_IMMEDIATE_CHECK

◆ GET_NEON_OVERLOAD_CHECK

#define GET_NEON_OVERLOAD_CHECK

◆ GET_SME_BUILTIN_GET_STATE

#define GET_SME_BUILTIN_GET_STATE

◆ GET_SME_IMMEDIATE_CHECK

#define GET_SME_IMMEDIATE_CHECK

◆ GET_SME_STREAMING_ATTRS

#define GET_SME_STREAMING_ATTRS

◆ GET_SVE_IMMEDIATE_CHECK

#define GET_SVE_IMMEDIATE_CHECK

◆ GET_SVE_STREAMING_ATTRS

#define GET_SVE_STREAMING_ATTRS

◆ PPC_VECTOR_TYPE [1/2]

#define PPC_VECTOR_TYPE (   Name,
  Id,
  Size 
)    || CoreType == Context.Id##Ty

◆ PPC_VECTOR_TYPE [2/2]

#define PPC_VECTOR_TYPE (   typeName,
  Id,
  size 
)     case size: Type = Context.Id##Ty; break;

◆ TARGET_BUILTIN

#define TARGET_BUILTIN (   id,
  ... 
)    case NEON::BI##id:

Enumeration Type Documentation

◆ AbsoluteValueKind

Enumerator
AVK_Integer 
AVK_Floating 
AVK_Complex 

Definition at line 11902 of file SemaChecking.cpp.

◆ ArmSMEState

Enumerator
ArmNoState 
ArmInZA 
ArmOutZA 
ArmInOutZA 
ArmZAMask 
ArmInZT0 
ArmOutZT0 
ArmInOutZT0 
ArmZT0Mask 

Definition at line 3430 of file SemaChecking.cpp.

◆ ArmStreamingType

Enumerator
ArmNonStreaming 
ArmStreaming 
ArmStreamingCompatible 
ArmStreamingOrSVE2p1 

Definition at line 3423 of file SemaChecking.cpp.

Function Documentation

◆ adornObjCBoolConversionDiagWithTernaryFixit()

static void adornObjCBoolConversionDiagWithTernaryFixit ( Sema S,
Expr SourceExpr,
const Sema::SemaDiagnosticBuilder &  Builder 
)
static

Definition at line 14338 of file SemaChecking.cpp.

◆ AnalyzeAssignment()

static void AnalyzeAssignment ( Sema S,
BinaryOperator E 
)
static

Analyze the given simple or compound assignment for warning-worthy operations.

Definition at line 14289 of file SemaChecking.cpp.

◆ AnalyzeBitFieldAssignment()

static bool AnalyzeBitFieldAssignment ( Sema S,
FieldDecl Bitfield,
Expr Init,
SourceLocation  InitLoc 
)
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 14150 of file SemaChecking.cpp.

◆ AnalyzeComparison()

static void AnalyzeComparison ( Sema S,
BinaryOperator E 
)
static

Implements -Wsign-compare.

Parameters
Ethe binary operator to check for warnings

Definition at line 14033 of file SemaChecking.cpp.

◆ AnalyzeCompoundAssignment()

static void AnalyzeCompoundAssignment ( Sema S,
BinaryOperator E 
)
static

Analyze the given compound assignment for the possible losing of floating-point precision.

Definition at line 14471 of file SemaChecking.cpp.

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

◆ AnalyzeImplicitConversions() [1/2]

static void AnalyzeImplicitConversions ( Sema S,
AnalyzeImplicitConversionsWorkItem  Item,
llvm::SmallVectorImpl< AnalyzeImplicitConversionsWorkItem > &  WorkList 
)
static

Data recursive variant of AnalyzeImplicitConversions.

Subexpressions that should be visited are added to WorkList.

Definition at line 15351 of file SemaChecking.cpp.

◆ AnalyzeImplicitConversions() [2/2]

static void AnalyzeImplicitConversions ( Sema S,
Expr OrigE,
SourceLocation  CC,
bool  IsListInit 
)
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 15520 of file SemaChecking.cpp.

◆ BuiltinAddressof()

static bool BuiltinAddressof ( 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 246 of file SemaChecking.cpp.

◆ BuiltinAlignment()

static bool BuiltinAlignment ( Sema S,
CallExpr TheCall,
unsigned  ID 
)
static

Check that the value argument for __builtin_is_aligned(value, alignment) and __builtin_aligned_{up,down}(value, alignment) is an integer or a pointer type (but not a function pointer) and that the alignment is a power-of-two.

Definition at line 296 of file SemaChecking.cpp.

◆ BuiltinAnnotation()

static bool BuiltinAnnotation ( 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 196 of file SemaChecking.cpp.

◆ BuiltinCallWithStaticChain()

static bool BuiltinCallWithStaticChain ( Sema S,
CallExpr BuiltinCall 
)
static

Definition at line 768 of file SemaChecking.cpp.

◆ BuiltinCommitRWPipe()

static bool BuiltinCommitRWPipe ( Sema S,
CallExpr Call 
)
static

Definition at line 1896 of file SemaChecking.cpp.

◆ BuiltinCountZeroBitsGeneric()

static bool BuiltinCountZeroBitsGeneric ( Sema S,
CallExpr TheCall 
)
static

Checks that __builtin_{clzg,ctzg} was called with a first argument, which is an unsigned integer, and an optional second argument, which is promoted to an 'int'.

Definition at line 2407 of file SemaChecking.cpp.

◆ BuiltinCpu()

static bool BuiltinCpu ( Sema S,
const TargetInfo TI,
CallExpr TheCall,
const TargetInfo AuxTI,
unsigned  BuiltinID 
)
static

BuiltinCpu{Supports|Is} - Handle __builtin_cpu_{supports|is}(char *).

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

Definition at line 2339 of file SemaChecking.cpp.

◆ BuiltinDumpStruct()

static ExprResult BuiltinDumpStruct ( Sema S,
CallExpr TheCall 
)
static

Definition at line 702 of file SemaChecking.cpp.

◆ BuiltinFunctionStart()

static bool BuiltinFunctionStart ( Sema S,
CallExpr TheCall 
)
static

Check that the argument to __builtin_function_start is a function.

Definition at line 261 of file SemaChecking.cpp.

◆ BuiltinLaunder()

static ExprResult BuiltinLaunder ( Sema S,
CallExpr TheCall 
)
static

Definition at line 2163 of file SemaChecking.cpp.

◆ BuiltinMSVCAnnotation()

static bool BuiltinMSVCAnnotation ( Sema S,
CallExpr TheCall 
)
static

Definition at line 222 of file SemaChecking.cpp.

◆ BuiltinOverflow()

static bool BuiltinOverflow ( Sema S,
CallExpr TheCall,
unsigned  BuiltinID 
)
static

Definition at line 374 of file SemaChecking.cpp.

◆ BuiltinPipePackets()

static bool BuiltinPipePackets ( Sema S,
CallExpr Call 
)
static

Definition at line 1919 of file SemaChecking.cpp.

◆ BuiltinPopcountg()

static bool BuiltinPopcountg ( Sema S,
CallExpr TheCall 
)
static

Checks that __builtin_popcountg was called with a single argument, which is an unsigned integer.

Definition at line 2383 of file SemaChecking.cpp.

◆ BuiltinPreserveAI()

static bool BuiltinPreserveAI ( Sema S,
CallExpr TheCall 
)
static

Check the number of arguments and set the result type to the argument type.

Definition at line 285 of file SemaChecking.cpp.

◆ BuiltinReserveRWPipe()

static bool BuiltinReserveRWPipe ( Sema S,
CallExpr Call 
)
static

Definition at line 1867 of file SemaChecking.cpp.

◆ BuiltinRWPipe()

static bool BuiltinRWPipe ( Sema S,
CallExpr Call 
)
static

Definition at line 1812 of file SemaChecking.cpp.

◆ BuiltinSEHScopeCheck()

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

Definition at line 1434 of file SemaChecking.cpp.

References clang::Sema::inTemplateInstantiation().

◆ changeAbsFunction()

static unsigned changeAbsFunction ( unsigned  AbsKind,
AbsoluteValueKind  ValueKind 
)
static

Definition at line 11921 of file SemaChecking.cpp.

References AVK_Complex, AVK_Floating, and AVK_Integer.

◆ CheckAllArgsHaveFloatRepresentation()

bool CheckAllArgsHaveFloatRepresentation ( Sema S,
CallExpr TheCall 
)

Definition at line 5599 of file SemaChecking.cpp.

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

◆ CheckArgsTypesAreCorrect()

bool CheckArgsTypesAreCorrect ( Sema S,
CallExpr TheCall,
QualType  ExpectedType,
llvm::function_ref< bool(clang::QualType PassedType)>  Check 
)

Definition at line 5581 of file SemaChecking.cpp.

◆ checkArmStreamingBuiltin()

static void checkArmStreamingBuiltin ( Sema S,
CallExpr TheCall,
const FunctionDecl FD,
ArmStreamingType  BuiltinType 
)
static

Definition at line 3598 of file SemaChecking.cpp.

◆ CheckBoolLikeConversion()

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

Check conversion of given expression to boolean.

Input argument E is a logical expression.

Definition at line 15330 of file SemaChecking.cpp.

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

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

◆ CheckBuiltinTargetInSupported()

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

Definition at line 2241 of file SemaChecking.cpp.

◆ CheckBuiltinTargetNotInUnsupported()

static bool CheckBuiltinTargetNotInUnsupported ( Sema S,
unsigned  BuiltinID,
CallExpr TheCall,
ArrayRef< llvm::Triple::ObjectFormatType >  UnsupportedObjectFormatTypes 
)
static

Definition at line 2225 of file SemaChecking.cpp.

◆ CheckConditionalOperand()

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

Definition at line 15278 of file SemaChecking.cpp.

◆ CheckConditionalOperator()

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

Definition at line 15293 of file SemaChecking.cpp.

◆ CheckFloatOrHalfRepresentations()

bool CheckFloatOrHalfRepresentations ( Sema S,
CallExpr TheCall 
)

Definition at line 5607 of file SemaChecking.cpp.

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

◆ CheckFormatString()

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

Definition at line 11717 of file SemaChecking.cpp.

◆ checkFormatStringExpr()

static StringLiteralCheckType checkFormatStringExpr ( Sema S,
const Expr E,
ArrayRef< const Expr * >  Args,
Sema::FormatArgumentPassingKind  APK,
unsigned  format_idx,
unsigned  firstDataArg,
Sema::FormatStringType  Type,
Sema::VariadicCallType  CallType,
bool  InFunctionCall,
llvm::SmallBitVector &  CheckedVarArgs,
UncoveredArgHandler &  UncoveredArg,
llvm::APSInt  Offset,
bool  IgnoreStringsWithoutSpecifiers = false 
)
static

Definition at line 9561 of file SemaChecking.cpp.

◆ CheckForReference()

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

◆ checkFPMathBuiltinElementType()

static bool checkFPMathBuiltinElementType ( Sema S,
SourceLocation  Loc,
QualType  ArgTy,
int  ArgIndex 
)
static

Definition at line 2322 of file SemaChecking.cpp.

◆ CheckImplicitArgumentConversions()

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

Definition at line 14536 of file SemaChecking.cpp.

◆ CheckImplicitConversion()

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

Definition at line 14776 of file SemaChecking.cpp.

◆ checkIntelFPGARegArgument()

static bool checkIntelFPGARegArgument ( Sema S,
QualType  ArgType,
SourceLocation Loc 
)
static

Definition at line 5947 of file SemaChecking.cpp.

◆ checkMathBuiltinElementType()

static bool checkMathBuiltinElementType ( Sema S,
SourceLocation  Loc,
QualType  ArgTy,
int  ArgIndex 
)
static

Definition at line 2311 of file SemaChecking.cpp.

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

◆ CheckMemaccessSize()

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

Diagnose cases like 'memset(buf, sizeof(buf), 0)', which should have the last two arguments transposed.

Definition at line 12489 of file SemaChecking.cpp.

◆ CheckMemorySizeofForComparison()

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

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

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

Definition at line 12278 of file SemaChecking.cpp.

◆ CheckNoDoubleVectors()

bool CheckNoDoubleVectors ( Sema S,
CallExpr TheCall 
)

Definition at line 5619 of file SemaChecking.cpp.

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

◆ CheckNonNullArgument()

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

Definition at line 6325 of file SemaChecking.cpp.

◆ CheckNonNullArguments()

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

Definition at line 6394 of file SemaChecking.cpp.

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

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

◆ checkObjCArrayLiteral()

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

Check an Objective-C array literal being converted to the given target type.

Definition at line 14645 of file SemaChecking.cpp.

◆ checkObjCCollectionLiteralElement()

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

Check a single element within a collection literal against the target element type.

Definition at line 14614 of file SemaChecking.cpp.

◆ checkObjCDictionaryLiteral()

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

Check an Objective-C dictionary literal being converted to the given target type.

Definition at line 14674 of file SemaChecking.cpp.

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

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

◆ checkOpenCLEnqueueLocalSizeArgs()

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

Definition at line 1554 of file SemaChecking.cpp.

◆ checkOpenCLEnqueueVariadicArgs()

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

OpenCL v2.0, s6.13.17.1 - Check that sizes are provided for all 'local void*' parameter of passed block.

Definition at line 1565 of file SemaChecking.cpp.

◆ checkOpenCLPipeArg()

static bool checkOpenCLPipeArg ( Sema S,
CallExpr Call 
)
static

Returns true if pipe element type is different from the pointer.

Definition at line 1739 of file SemaChecking.cpp.

◆ checkOpenCLPipePacketType()

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

Returns true if pipe element type is different from the pointer.

Definition at line 1789 of file SemaChecking.cpp.

◆ checkOpenCLSubgroupExt()

static bool checkOpenCLSubgroupExt ( Sema S,
CallExpr Call 
)
static

Definition at line 1495 of file SemaChecking.cpp.

◆ checkPointerAuthEnabled()

static bool checkPointerAuthEnabled ( Sema S,
Expr E 
)
static

Definition at line 1990 of file SemaChecking.cpp.

◆ checkPointerAuthKey()

static bool checkPointerAuthKey ( Sema S,
Expr *&  Arg 
)
static

Definition at line 1998 of file SemaChecking.cpp.

◆ checkPointerAuthValue()

static bool checkPointerAuthValue ( Sema S,
Expr *&  Arg,
PointerAuthOpKind  OpKind 
)
static

Definition at line 2037 of file SemaChecking.cpp.

◆ CheckTautologicalComparison()

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

Definition at line 13871 of file SemaChecking.cpp.

◆ checkUnsafeAssignLiteral()

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

Definition at line 17437 of file SemaChecking.cpp.

◆ checkUnsafeAssignObject()

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

◆ CheckUnsignedIntRepresentation()

bool CheckUnsignedIntRepresentation ( Sema S,
CallExpr TheCall 
)

Definition at line 5629 of file SemaChecking.cpp.

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

◆ checkVAStartIsInVariadicFunction()

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

Definition at line 8092 of file SemaChecking.cpp.

◆ CheckVectorElementCallArgs()

bool CheckVectorElementCallArgs ( Sema S,
CallExpr TheCall 
)

Definition at line 5531 of file SemaChecking.cpp.

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

◆ CheckWasmBuiltinArgIsInteger()

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

Checks the argument at the given index is an integer.

Definition at line 18805 of file SemaChecking.cpp.

◆ CheckWasmBuiltinArgIsTable()

static bool CheckWasmBuiltinArgIsTable ( Sema S,
CallExpr E,
unsigned  ArgIndex,
QualType ElTy 
)
static

Checks the argument at the given index is a WebAssembly table and if it is, sets ElTy to the element type.

Definition at line 18791 of file SemaChecking.cpp.

◆ classifyConstantValue()

static int classifyConstantValue ( Expr Constant)
static

Definition at line 13857 of file SemaChecking.cpp.

◆ combineFAPK()

static constexpr unsigned short combineFAPK ( Sema::FormatArgumentPassingKind  A,
Sema::FormatArgumentPassingKind  B 
)
staticconstexpr

Definition at line 121 of file SemaChecking.cpp.

◆ convertArgumentToType()

static bool convertArgumentToType ( Sema S,
Expr *&  Value,
QualType  Ty 
)
static

Definition at line 180 of file SemaChecking.cpp.

◆ CXXRecordMembersNamed()

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

Definition at line 10734 of file SemaChecking.cpp.

◆ DecodePPCMMATypeFromStr()

static QualType DecodePPCMMATypeFromStr ( ASTContext Context,
const char *&  Str,
unsigned Mask 
)
static

DecodePPCMMATypeFromStr - This decodes one PPC MMA type descriptor from Str, advancing the pointer over the consumed characters.

The decoded type is returned. If the decoded type represents a constant integer with a constraint on its value then Mask is set to that value. The type descriptors used in Str are specific to PPC MMA builtins and are documented in the file defining the PPC builtins.

Definition at line 5244 of file SemaChecking.cpp.

◆ diagnoseArrayStarInParamType()

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

Definition at line 16764 of file SemaChecking.cpp.

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

◆ DiagnoseCStringFormatDirectiveInCFAPI()

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

Diagnose use of s directive in an NSString which is being passed as formatting string to formatting method.

Definition at line 6347 of file SemaChecking.cpp.

◆ DiagnoseFloatingImpCast()

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

Diagnose an implicit cast from a floating point value to an integer value.

Definition at line 14354 of file SemaChecking.cpp.

◆ DiagnoseImpCast() [1/2]

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

Diagnose an implicit cast; purely a helper for CheckImplicitConversion.

Definition at line 14312 of file SemaChecking.cpp.

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

◆ DiagnoseIntInBoolContext()

static void DiagnoseIntInBoolContext ( Sema S,
Expr E 
)
static

Definition at line 14739 of file SemaChecking.cpp.

◆ DiagnoseNullConversion()

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

Definition at line 14557 of file SemaChecking.cpp.

◆ doesExprLikelyComputeSize()

static bool doesExprLikelyComputeSize ( const Expr SizeofExpr)
static

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

Definition at line 12453 of file SemaChecking.cpp.

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

◆ emitReplacement()

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

Definition at line 12018 of file SemaChecking.cpp.

Referenced by clang::syntax::computeReplacements().

◆ FindTypeTagExpr()

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

Given a type tag expression find the type tag itself.

Parameters
TypeExprType tag expression, as it appears in user's code.
VDDeclaration of an identifier that appears in a type tag.
MagicValueType tag magic value.
isConstantEvaluatedwhether the evalaution should be performed in constant context.

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

◆ getAbsoluteValueArgumentType()

static QualType getAbsoluteValueArgumentType ( ASTContext Context,
unsigned  AbsType 
)
static

Definition at line 11861 of file SemaChecking.cpp.

◆ getAbsoluteValueFunctionKind()

static unsigned getAbsoluteValueFunctionKind ( const FunctionDecl FDecl)
static

◆ getAbsoluteValueKind()

static AbsoluteValueKind getAbsoluteValueKind ( QualType  T)
static

◆ getAlignmentAndOffsetFromBinAddOrSub()

static std::optional<std::pair<CharUnits, CharUnits> > getAlignmentAndOffsetFromBinAddOrSub ( const Expr PtrE,
const Expr IntE,
bool  IsSub,
ASTContext Ctx 
)
static

◆ getAndVerifyMatrixDimension()

static std::optional<unsigned> getAndVerifyMatrixDimension ( Expr Expr,
StringRef  Name,
Sema S 
)
static

Definition at line 18557 of file SemaChecking.cpp.

◆ getArmStreamingFnType()

static ArmStreamingType getArmStreamingFnType ( const FunctionDecl FD)
static

◆ getAsSizeOfExpr()

static const UnaryExprOrTypeTraitExpr* getAsSizeOfExpr ( const Expr E)
static

◆ getBaseAlignmentAndOffsetFromLValue()

static std::optional<std::pair< CharUnits, CharUnits> > getBaseAlignmentAndOffsetFromLValue ( const Expr E,
ASTContext Ctx 
)
static

◆ getBaseAlignmentAndOffsetFromPtr()

static std::optional< std::pair< CharUnits, CharUnits > > getBaseAlignmentAndOffsetFromPtr ( const Expr E,
ASTContext Ctx 
)
static

◆ getBestAbsFunction()

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

Definition at line 11883 of file SemaChecking.cpp.

◆ getContainedDynamicClass()

static const CXXRecordDecl* getContainedDynamicClass ( QualType  T,
bool IsContained 
)
static

◆ getDerivedToBaseAlignmentAndOffset()

static std::pair<CharUnits, CharUnits> getDerivedToBaseAlignmentAndOffset ( const CastExpr CE,
QualType  DerivedType,
CharUnits  BaseAlignment,
CharUnits  Offset,
ASTContext Ctx 
)
static

Compute the alignment and offset of the base class object given the derived-to-base cast expression and the alignment and offset of the derived class object.

Definition at line 16898 of file SemaChecking.cpp.

References clang::Type::getAsCXXRecordDecl(), clang::ASTContext::getASTRecordLayout(), clang::ASTRecordLayout::getBaseClassOffset(), clang::ASTRecordLayout::getNonVirtualAlignment(), min(), Offset, clang::CastExpr::path_begin(), clang::CastExpr::path_end(), and clang::CharUnits::Zero().

Referenced by getBaseAlignmentAndOffsetFromLValue(), and getBaseAlignmentAndOffsetFromPtr().

◆ GetExprRange() [1/2]

static IntRange GetExprRange ( ASTContext C,
const Expr E,
bool  InConstantContext,
bool  Approximate 
)
static

Definition at line 13646 of file SemaChecking.cpp.

References GetExprRange(), and GetExprType().

◆ GetExprRange() [2/2]

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

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

Parameters
MaxWidthThe width to which the value will be truncated.
ApproximateIf true, return a likely range for the result: in particular, assume that arithmetic on narrower types doesn't leave those types. If false, return a range including all possible result values.

Definition at line 13398 of file SemaChecking.cpp.

References clang::Expr::EvaluateAsRValue(), GetExprType(), clang::Expr::getSourceBitField(), clang::Expr::getType(), GetValueRange(), clang::Expr::IgnoreParens(), clang::Type::isUnsignedIntegerOrEnumerationType(), clang::Type::isVoidType(), log2, min(), clang::T, and clang::Expr::EvalResult::Val.

Referenced by GetExprRange().

◆ GetExprType()

static QualType GetExprType ( const Expr E)
static

Definition at line 13383 of file SemaChecking.cpp.

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

Referenced by GetExprRange().

◆ getIntegerLiteral()

static const IntegerLiteral* getIntegerLiteral ( Expr E)
static

Definition at line 14727 of file SemaChecking.cpp.

◆ getLargerAbsoluteValueFunction()

static unsigned getLargerAbsoluteValueFunction ( unsigned  AbsFunction)
static

Definition at line 11811 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,
bool  isConstantEvaluated 
)
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.
isConstantEvaluatedwhether the evalaution should be performed in constant context.
Returns
true if the corresponding C type was found.

Definition at line 18064 of file SemaChecking.cpp.

References FindTypeTagExpr(), and clang::Decl::getAttr().

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

◆ getOpenCLArgAccess()

static OpenCLAccessAttr* getOpenCLArgAccess ( const Decl D)
static

Returns OpenCL access qual.

Definition at line 1734 of file SemaChecking.cpp.

References clang::Decl::getAttr().

◆ getPresumedAlignmentOfPointer()

static CharUnits getPresumedAlignmentOfPointer ( const Expr E,
Sema S 
)
static

Definition at line 17117 of file SemaChecking.cpp.

◆ getSizeOfArgType()

static QualType getSizeOfArgType ( const Expr E)
static

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

Definition at line 12354 of file SemaChecking.cpp.

References getAsSizeOfExpr(), and SizeOf.

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

References getAsSizeOfExpr(), and SizeOf.

◆ getSMEState()

static ArmSMEState getSMEState ( unsigned  BuiltinID)
static

Definition at line 3644 of file SemaChecking.cpp.

References ArmNoState.

◆ getStrlenExprArg()

static const Expr* getStrlenExprArg ( const Expr E)
static

Definition at line 12848 of file SemaChecking.cpp.

References clang::FunctionDecl::getMemoryFunctionKind().

◆ getSYCLAllocaDefaultSize()

static llvm::APSInt getSYCLAllocaDefaultSize ( const ASTContext Ctx,
const VarDecl VD 
)
static

◆ GetValueRange() [1/2]

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

◆ GetValueRange() [2/2]

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

Definition at line 13341 of file SemaChecking.cpp.

Referenced by GetExprRange(), and GetValueRange().

◆ handleFormatSignedness()

◆ hasArmZAState()

static bool hasArmZAState ( const FunctionDecl FD)
static

◆ hasArmZT0State()

static bool hasArmZT0State ( const FunctionDecl FD)
static

◆ HasEnumType()

static bool HasEnumType ( Expr E)
static

Definition at line 13845 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 12477 of file SemaChecking.cpp.

References clang::SourceLocation::isMacroID(), and SM.

◆ isArithmeticArgumentPromotion()

static bool isArithmeticArgumentPromotion ( Sema S,
const ImplicitCastExpr ICE 
)
static

Return true if ICE is an implicit argument promotion of an arithmetic type.

Bit-field 'promotions' from a higher ranked type to a lower ranked type do not count.

Definition at line 11111 of file SemaChecking.cpp.

◆ isBlockPointer()

static bool isBlockPointer ( Expr Arg)
inlinestatic

Definition at line 1456 of file SemaChecking.cpp.

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

◆ isConstantSizeArrayWithMoreThanOneElement()

static bool isConstantSizeArrayWithMoreThanOneElement ( QualType  Ty,
ASTContext Context 
)
static

Definition at line 12758 of file SemaChecking.cpp.

◆ IsEnumConstOrFromMacro()

static bool IsEnumConstOrFromMacro ( Sema S,
Expr E 
)
static

Definition at line 13693 of file SemaChecking.cpp.

◆ IsImplicitBoolFloatConversion()

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

Definition at line 14517 of file SemaChecking.cpp.

◆ 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,
EnumDecl ED1,
EnumDecl ED2 
)
static

Check if two enumeration types are layout-compatible.

Definition at line 17772 of file SemaChecking.cpp.

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

◆ isLayoutCompatible() [2/4]

static bool isLayoutCompatible ( ASTContext C,
FieldDecl Field1,
FieldDecl Field2,
bool  AreUnionMembers = false 
)
static

Check if two fields are layout-compatible.

Can be used on union members, which are exempt from alignment requirement of common initial sequence.

Definition at line 17783 of file SemaChecking.cpp.

References clang::FieldDecl::getBitWidthValue(), clang::Decl::getMaxAlignment(), clang::FieldDecl::getParent(), clang::ValueDecl::getType(), clang::TypeDecl::getTypeForDecl(), clang::Decl::hasAttr(), clang::FieldDecl::isBitField(), isLayoutCompatible(), clang::Type::isStructureOrClassType(), and clang::Type::isUnionType().

◆ isLayoutCompatible() [3/4]

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

◆ 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 17827 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 17871 of file SemaChecking.cpp.

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

Referenced by isLayoutCompatible().

◆ isNonNullType()

static bool isNonNullType ( QualType  type)
static

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

Definition at line 6387 of file SemaChecking.cpp.

References clang::NonNull, and clang::ast_matchers::type.

◆ isObjCSignedCharBool()

static bool isObjCSignedCharBool ( Sema S,
QualType  Ty 
)
static

Definition at line 14333 of file SemaChecking.cpp.

◆ isPPC_64Builtin()

static bool isPPC_64Builtin ( unsigned  BuiltinID)
static

Definition at line 5294 of file SemaChecking.cpp.

◆ IsSameCharType()

static bool IsSameCharType ( QualType  T1,
QualType  T2 
)
static

Definition at line 18121 of file SemaChecking.cpp.

References clang::Type::getAs(), and clang::BuiltinType::getKind().

◆ IsSameFloatAfterCast() [1/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 13672 of file SemaChecking.cpp.

References 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().

◆ IsSameFloatAfterCast() [2/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 13655 of file SemaChecking.cpp.

Referenced by IsSameFloatAfterCast().

◆ isSameWidthConstantConversion()

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

Definition at line 14703 of file SemaChecking.cpp.

◆ IsShiftedByte()

static bool IsShiftedByte ( llvm::APSInt  Value)
static

◆ IsStdFunction()

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

◆ isValidBPFPreserveEnumValueArg()

static bool isValidBPFPreserveEnumValueArg ( Expr Arg)
static

◆ isValidBPFPreserveFieldInfoArg()

static bool isValidBPFPreserveFieldInfoArg ( Expr Arg)
static

◆ isValidBPFPreserveTypeInfoArg()

static bool isValidBPFPreserveTypeInfoArg ( Expr Arg)
static

◆ isValidOrderingForOp()

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

Definition at line 6914 of file SemaChecking.cpp.

◆ maybeConstEvalStringLiteral()

static const Expr * maybeConstEvalStringLiteral ( ASTContext Context,
const Expr E 
)
static

Definition at line 9924 of file SemaChecking.cpp.

◆ OpenCLBuiltinEnqueueKernel()

static bool OpenCLBuiltinEnqueueKernel ( 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 1613 of file SemaChecking.cpp.

◆ OpenCLBuiltinKernelWorkGroupSize()

static bool OpenCLBuiltinKernelWorkGroupSize ( 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 1537 of file SemaChecking.cpp.

◆ OpenCLBuiltinNDRangeAndBlock()

static bool OpenCLBuiltinNDRangeAndBlock ( Sema S,
CallExpr TheCall 
)
static

Definition at line 1510 of file SemaChecking.cpp.

◆ OpenCLBuiltinToAddr()

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

Definition at line 1938 of file SemaChecking.cpp.

◆ PointerAuthAuthAndResign()

static ExprResult PointerAuthAuthAndResign ( Sema S,
CallExpr Call 
)
static

Definition at line 2147 of file SemaChecking.cpp.

◆ PointerAuthBlendDiscriminator()

static ExprResult PointerAuthBlendDiscriminator ( Sema S,
CallExpr Call 
)
static

Definition at line 2106 of file SemaChecking.cpp.

◆ PointerAuthSignGenericData()

static ExprResult PointerAuthSignGenericData ( Sema S,
CallExpr Call 
)
static

Definition at line 2119 of file SemaChecking.cpp.

◆ PointerAuthSignOrAuth()

static ExprResult PointerAuthSignOrAuth ( Sema S,
CallExpr Call,
PointerAuthOpKind  OpKind 
)
static

Definition at line 2132 of file SemaChecking.cpp.

◆ PointerAuthStrip()

static ExprResult PointerAuthStrip ( Sema S,
CallExpr Call 
)
static

Definition at line 2093 of file SemaChecking.cpp.

◆ PrettyPrintInRange()

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

Definition at line 14507 of file SemaChecking.cpp.

References Range, and clang::threadSafety::sx::toString().

◆ ProcessFormatStringLiteral()

static bool ProcessFormatStringLiteral ( const Expr FormatExpr,
StringRef &  FormatStrRef,
size_t StrLen,
ASTContext Context 
)
static

Definition at line 1097 of file SemaChecking.cpp.

◆ referToTheSameDecl()

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

Check if two expressions refer to the same declaration.

Definition at line 12841 of file SemaChecking.cpp.

◆ requiresParensToAddCast()

static bool requiresParensToAddCast ( const Expr E)
static

◆ RFT()

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

◆ SetElementTypeAsReturnType()

void SetElementTypeAsReturnType ( Sema S,
CallExpr TheCall,
QualType  ReturnType 
)

Definition at line 5637 of file SemaChecking.cpp.

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

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

◆ sumOffsets()

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

Definition at line 9455 of file SemaChecking.cpp.

References max(), and Offset.