clang 22.0.0git
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/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/CheckerHelpers.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/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.

Classes

struct  PrivateMethodKey
struct  llvm::DenseMapInfo< PrivateMethodKey >

Namespaces

namespace  llvm
 Diagnostic wrappers for TextAPI types for error reporting.

Macros

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

Typedefs

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

Functions

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

◆ DEBUG_TYPE

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

Definition at line 65 of file CallEvent.cpp.

Typedef Documentation

◆ ObjCMessageDataTy

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

Definition at line 1068 of file CallEvent.cpp.

Function Documentation

◆ addParameterValuesToBindings()

◆ castArgToParamTypeIfNeeded()

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

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 436 of file CallEvent.cpp.

References clang::Call, clang::Definition, clang::ento::SValBuilder::evalCast(), clang::ento::SVal::getType(), and clang::Expr::getType().

Referenced by addParameterValuesToBindings().

◆ findDefiningRedecl()

const ObjCMethodDecl * findDefiningRedecl ( const ObjCMethodDecl * MD)
static

◆ findPtrToConstParams()

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

Definition at line 221 of file CallEvent.cpp.

References clang::Call, and isPointerToConst().

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

◆ getSyntacticFromForPseudoObjectExpr()

const Expr * getSyntacticFromForPseudoObjectExpr ( const PseudoObjectExpr * POE)
static

◆ isCallback()

◆ isPointerToConst()

bool isPointerToConst ( QualType Ty)
static

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

Definition at line 207 of file CallEvent.cpp.

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

◆ isTransparentUnion()

bool isTransparentUnion ( QualType T)
static

Definition at line 392 of file CallEvent.cpp.

References clang::T.

Referenced by processArgument().

◆ isVoidPointerToNonConst()

◆ lookupRuntimeDefinition()

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

Definition at line 1258 of file CallEvent.cpp.

References clang::Interface.

Referenced by clang::ento::ObjCMethodCall::getRuntimeDefinition().

◆ processArgument()