clang 17.0.0git
Classes | Namespaces | Macros | Typedefs | Functions
CallEvent.cpp File Reference
#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Attr.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprObjC.h"
#include "clang/AST/ParentMap.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/Type.h"
#include "clang/Analysis/AnalysisDeclContext.h"
#include "clang/Analysis/CFG.h"
#include "clang/Analysis/CFGStmtMap.h"
#include "clang/Analysis/PathDiagnostic.h"
#include "clang/Analysis/ProgramPoint.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/Specifiers.h"
#include "clang/CrossTU/CrossTranslationUnit.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/DynamicType.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/DynamicTypeInfo.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/Store.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/ImmutableList.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <optional>
#include <utility>

Go to the source code of this file.


struct  PrivateMethodKey
struct  llvm::DenseMapInfo< PrivateMethodKey >


namespace  llvm
 YAML serialization mapping.


#define DEBUG_TYPE   "static-analyzer-call-event"


using ObjCMessageDataTy = llvm::PointerIntPair< const PseudoObjectExpr *, 2 >


static bool isCallback (QualType T)
static bool isVoidPointerToNonConst (QualType T)
static bool isPointerToConst (QualType Ty)
 Returns true if a type is a pointer-to-const or reference-to-const with no further indirection.
static void findPtrToConstParams (llvm::SmallSet< unsigned, 4 > &PreserveArgs, const CallEvent &Call)
static bool isTransparentUnion (QualType T)
static SVal processArgument (SVal Value, const Expr *ArgumentExpr, const ParmVarDecl *Parameter, SValBuilder &SVB)
static SVal castArgToParamTypeIfNeeded (const CallEvent &Call, unsigned ArgIdx, SVal ArgVal, SValBuilder &SVB)
 Cast the argument value to the type of the parameter at the function declaration.
static void addParameterValuesToBindings (const StackFrameContext *CalleeCtx, CallEvent::BindingsTy &Bindings, SValBuilder &SVB, const CallEvent &Call, ArrayRef< ParmVarDecl * > parameters)
static const ExprgetSyntacticFromForPseudoObjectExpr (const PseudoObjectExpr *POE)
static const ObjCMethodDeclfindDefiningRedecl (const ObjCMethodDecl *MD)
static const ObjCMethodDecllookupRuntimeDefinition (const ObjCInterfaceDecl *Interface, Selector LookupSelector, bool InstanceMethod)

Macro Definition Documentation


#define DEBUG_TYPE   "static-analyzer-call-event"

Definition at line 66 of file CallEvent.cpp.

Typedef Documentation

◆ ObjCMessageDataTy

using ObjCMessageDataTy = llvm::PointerIntPair<const PseudoObjectExpr *, 2>

Definition at line 1020 of file CallEvent.cpp.

Function Documentation

◆ addParameterValuesToBindings()

static void addParameterValuesToBindings ( const StackFrameContext CalleeCtx,
CallEvent::BindingsTy Bindings,
SValBuilder SVB,
const CallEvent Call,
ArrayRef< ParmVarDecl * >  parameters 

◆ castArgToParamTypeIfNeeded()

static SVal castArgToParamTypeIfNeeded ( const CallEvent Call,
unsigned  ArgIdx,
SVal  ArgVal,
SValBuilder SVB 

Cast the argument value to the type of the parameter at the function declaration.

Returns the argument value if it didn't need a cast. Or returns the cast argument if it needed a cast. Or returns 'Unknown' if it would need a cast but the callsite and the runtime definition don't match in terms of argument and parameter count.

Definition at line 435 of file CallEvent.cpp.

References clang::ento::SValBuilder::evalCast(), clang::FunctionDecl::getNumParams(), clang::FunctionDecl::getParamDecl(), clang::ValueDecl::getType(), clang::Expr::getType(), and clang::FunctionDecl::hasPrototype().

Referenced by addParameterValuesToBindings().

◆ findDefiningRedecl()

static const ObjCMethodDecl * findDefiningRedecl ( const ObjCMethodDecl MD)

◆ findPtrToConstParams()

static void findPtrToConstParams ( llvm::SmallSet< unsigned, 4 > &  PreserveArgs,
const CallEvent Call 

Definition at line 222 of file CallEvent.cpp.

References isPointerToConst().

Referenced by clang::ento::CallEvent::invalidateRegions().

◆ getSyntacticFromForPseudoObjectExpr()

static const Expr * getSyntacticFromForPseudoObjectExpr ( const PseudoObjectExpr POE)

◆ isCallback()

static bool isCallback ( QualType  T)

◆ isPointerToConst()

static bool isPointerToConst ( QualType  Ty)

Returns true if a type is a pointer-to-const or reference-to-const with no further indirection.

Definition at line 208 of file CallEvent.cpp.

References clang::Type::getPointeeType(), clang::Type::isAnyPointerType(), and clang::QualType::isConstQualified().

◆ isTransparentUnion()

static bool isTransparentUnion ( QualType  T)

◆ isVoidPointerToNonConst()

static bool isVoidPointerToNonConst ( QualType  T)

◆ lookupRuntimeDefinition()

static const ObjCMethodDecl * lookupRuntimeDefinition ( const ObjCInterfaceDecl Interface,
Selector  LookupSelector,
bool  InstanceMethod 

◆ processArgument()

static SVal processArgument ( SVal  Value,
const Expr ArgumentExpr,
const ParmVarDecl Parameter,
SValBuilder SVB