#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/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/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>
#define DEBUG_TYPE …
usingnamespaceclang;
usingnamespaceento;
QualType CallEvent::getResultType() const { … }
static bool isCallback(QualType T) { … }
static bool isVoidPointerToNonConst(QualType T) { … }
bool CallEvent::hasNonNullArgumentsWithType(bool (*Condition)(QualType)) const { … }
bool CallEvent::hasNonZeroCallbackArg() const { … }
bool CallEvent::hasVoidPointerToNonConstArg() const { … }
bool CallEvent::isGlobalCFunction(StringRef FunctionName) const { … }
AnalysisDeclContext *CallEvent::getCalleeAnalysisDeclContext() const { … }
const StackFrameContext *
CallEvent::getCalleeStackFrame(unsigned BlockCount) const { … }
const ParamVarRegion
*CallEvent::getParameterLocation(unsigned Index, unsigned BlockCount) const { … }
static bool isPointerToConst(QualType Ty) { … }
static void findPtrToConstParams(llvm::SmallSet<unsigned, 4> &PreserveArgs,
const CallEvent &Call) { … }
ProgramStateRef CallEvent::invalidateRegions(unsigned BlockCount,
ProgramStateRef Orig) const { … }
ProgramPoint CallEvent::getProgramPoint(bool IsPreVisit,
const ProgramPointTag *Tag) const { … }
SVal CallEvent::getArgSVal(unsigned Index) const { … }
SourceRange CallEvent::getArgSourceRange(unsigned Index) const { … }
SVal CallEvent::getReturnValue() const { … }
LLVM_DUMP_METHOD void CallEvent::dump() const { … }
void CallEvent::dump(raw_ostream &Out) const { … }
bool CallEvent::isCallStmt(const Stmt *S) { … }
QualType CallEvent::getDeclaredResultType(const Decl *D) { … }
bool CallEvent::isVariadic(const Decl *D) { … }
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) { … }
static void addParameterValuesToBindings(const StackFrameContext *CalleeCtx,
CallEvent::BindingsTy &Bindings,
SValBuilder &SVB,
const CallEvent &Call,
ArrayRef<ParmVarDecl*> parameters) { … }
const ConstructionContext *CallEvent::getConstructionContext() const { … }
const CallEventRef<> CallEvent::getCaller() const { … }
bool CallEvent::isCalledFromSystemHeader() const { … }
std::optional<SVal> CallEvent::getReturnValueUnderConstruction() const { … }
ArrayRef<ParmVarDecl*> AnyFunctionCall::parameters() const { … }
RuntimeDefinition AnyFunctionCall::getRuntimeDefinition() const { … }
void AnyFunctionCall::getInitialStackFrameContents(
const StackFrameContext *CalleeCtx,
BindingsTy &Bindings) const { … }
bool AnyFunctionCall::argumentsMayEscape() const { … }
const FunctionDecl *SimpleFunctionCall::getDecl() const { … }
const FunctionDecl *CXXInstanceCall::getDecl() const { … }
void CXXInstanceCall::getExtraInvalidatedValues(
ValueList &Values, RegionAndSymbolInvalidationTraits *ETraits) const { … }
SVal CXXInstanceCall::getCXXThisVal() const { … }
RuntimeDefinition CXXInstanceCall::getRuntimeDefinition() const { … }
void CXXInstanceCall::getInitialStackFrameContents(
const StackFrameContext *CalleeCtx,
BindingsTy &Bindings) const { … }
const Expr *CXXMemberCall::getCXXThisExpr() const { … }
RuntimeDefinition CXXMemberCall::getRuntimeDefinition() const { … }
const Expr *CXXMemberOperatorCall::getCXXThisExpr() const { … }
const BlockDataRegion *BlockCall::getBlockRegion() const { … }
ArrayRef<ParmVarDecl*> BlockCall::parameters() const { … }
void BlockCall::getExtraInvalidatedValues(ValueList &Values,
RegionAndSymbolInvalidationTraits *ETraits) const { … }
void BlockCall::getInitialStackFrameContents(const StackFrameContext *CalleeCtx,
BindingsTy &Bindings) const { … }
SVal AnyCXXConstructorCall::getCXXThisVal() const { … }
void AnyCXXConstructorCall::getExtraInvalidatedValues(ValueList &Values,
RegionAndSymbolInvalidationTraits *ETraits) const { … }
void AnyCXXConstructorCall::getInitialStackFrameContents(
const StackFrameContext *CalleeCtx,
BindingsTy &Bindings) const { … }
const StackFrameContext *
CXXInheritedConstructorCall::getInheritingStackFrame() const { … }
SVal CXXDestructorCall::getCXXThisVal() const { … }
RuntimeDefinition CXXDestructorCall::getRuntimeDefinition() const { … }
ArrayRef<ParmVarDecl*> ObjCMethodCall::parameters() const { … }
void ObjCMethodCall::getExtraInvalidatedValues(
ValueList &Values, RegionAndSymbolInvalidationTraits *ETraits) const { … }
SVal ObjCMethodCall::getReceiverSVal() const { … }
bool ObjCMethodCall::isReceiverSelfOrSuper() const { … }
SourceRange ObjCMethodCall::getSourceRange() const { … }
ObjCMessageDataTy;
const PseudoObjectExpr *ObjCMethodCall::getContainingPseudoObjectExpr() const { … }
static const Expr *
getSyntacticFromForPseudoObjectExpr(const PseudoObjectExpr *POE) { … }
ObjCMessageKind ObjCMethodCall::getMessageKind() const { … }
const ObjCPropertyDecl *ObjCMethodCall::getAccessedProperty() const { … }
bool ObjCMethodCall::canBeOverridenInSubclass(ObjCInterfaceDecl *IDecl,
Selector Sel) const { … }
static const ObjCMethodDecl *findDefiningRedecl(const ObjCMethodDecl *MD) { … }
struct PrivateMethodKey { … };
namespace llvm {
template <> struct DenseMapInfo<PrivateMethodKey> { … };
}
static const ObjCMethodDecl *
lookupRuntimeDefinition(const ObjCInterfaceDecl *Interface,
Selector LookupSelector, bool InstanceMethod) { … }
RuntimeDefinition ObjCMethodCall::getRuntimeDefinition() const { … }
bool ObjCMethodCall::argumentsMayEscape() const { … }
void ObjCMethodCall::getInitialStackFrameContents(
const StackFrameContext *CalleeCtx,
BindingsTy &Bindings) const { … }
CallEventRef<>
CallEventManager::getSimpleCall(const CallExpr *CE, ProgramStateRef State,
const LocationContext *LCtx,
CFGBlock::ConstCFGElementRef ElemRef) { … }
CallEventRef<>
CallEventManager::getCaller(const StackFrameContext *CalleeCtx,
ProgramStateRef State) { … }
CallEventRef<> CallEventManager::getCall(const Stmt *S, ProgramStateRef State,
const LocationContext *LC,
CFGBlock::ConstCFGElementRef ElemRef) { … }