clang 20.0.0git
|
#include "PrettyStackTraceLocationContext.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclCXX.h"
#include "clang/Analysis/Analyses/LiveVariables.h"
#include "clang/Analysis/ConstructionContext.h"
#include "clang/StaticAnalyzer/Core/CheckerManager.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/DynamicExtent.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/SaveAndRestore.h"
#include <optional>
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "ExprEngine" |
Functions | |
STATISTIC (NumOfDynamicDispatchPathSplits, "The # of times we split the path due to imprecise dynamic dispatch info") | |
STATISTIC (NumInlinedCalls, "The # of times we inlined a call") | |
STATISTIC (NumReachedInlineCountMax, "The # of times we reached inline count maximum") | |
static std::pair< const Stmt *, const CFGBlock * > | getLastStmt (const ExplodedNode *Node) |
static SVal | adjustReturnValue (SVal V, QualType ExpectedTy, QualType ActualTy, StoreManager &StoreMgr) |
Adjusts a return value when the called function's return type does not match the caller's expression type. | |
static bool | wasDifferentDeclUsedForInlining (CallEventRef<> Call, const StackFrameContext *calleeCtx) |
static unsigned | getElementCountOfArrayBeingDestructed (const CallEvent &Call, const ProgramStateRef State, SValBuilder &SVB) |
REGISTER_MAP_WITH_PROGRAMSTATE (DynamicDispatchBifurcationMap, const MemRegion *, unsigned) void ExprEngine | |
static ProgramStateRef | getInlineFailedState (ProgramStateRef State, const Stmt *CallE) |
static bool | hasMember (const ASTContext &Ctx, const CXXRecordDecl *RD, StringRef Name) |
Returns true if the given C++ class contains a member with the given name. | |
static bool | isContainerClass (const ASTContext &Ctx, const CXXRecordDecl *RD) |
Returns true if the given C++ class is a container or iterator. | |
static bool | isContainerMethod (const ASTContext &Ctx, const FunctionDecl *FD) |
Returns true if the given function refers to a method of a C++ container or iterator. | |
static bool | isCXXSharedPtrDtor (const FunctionDecl *FD) |
Returns true if the given function is the destructor of a class named "shared_ptr". | |
static bool | isTrivialObjectAssignment (const CallEvent &Call) |
#define DEBUG_TYPE "ExprEngine" |
Definition at line 33 of file ExprEngineCallAndReturn.cpp.
|
static |
Adjusts a return value when the called function's return type does not match the caller's expression type.
This can happen when a dynamic call is devirtualized, and the overriding method has a covariant (more specific) return type than the parent's method. For C++ objects, this means we need to add base casts.
Definition at line 130 of file ExprEngineCallAndReturn.cpp.
References clang::ento::StoreManager::evalDerivedToBase(), clang::QualType::getCanonicalType(), clang::Type::getCanonicalTypeUnqualified(), clang::Type::getPointeeCXXRecordDecl(), clang::CXXRecordDecl::isDerivedFrom(), clang::Type::isObjCObjectPointerType(), and V.
Referenced by clang::ento::ExprEngine::processCallExit().
|
static |
Definition at line 201 of file ExprEngineCallAndReturn.cpp.
References clang::Call, and clang::ento::getDynamicElementCount().
|
static |
Definition at line 590 of file ExprEngineCallAndReturn.cpp.
Referenced by clang::ento::ExprEngine::defaultEvalCall().
|
static |
Definition at line 78 of file ExprEngineCallAndReturn.cpp.
References clang::ProgramPoint::getAs(), clang::ProgramPoint::getStackFrame(), and Node.
Referenced by clang::ento::ExprEngine::processCallExit(), and clang::ento::ExprEngine::removeDeadOnEndOfFunction().
|
static |
Returns true if the given C++ class contains a member with the given name.
Definition at line 967 of file ExprEngineCallAndReturn.cpp.
References clang::ASTContext::DeclarationNames, clang::IdentifierTable::get(), clang::DeclarationNameTable::getIdentifier(), clang::CXXRecordDecl::hasMemberName(), and clang::ASTContext::Idents.
Referenced by isContainerClass().
|
static |
Returns true if the given C++ class is a container or iterator.
Our heuristic for this is whether it contains a method named 'begin()' or a nested type named 'iterator' or 'iterator_category'.
Definition at line 977 of file ExprEngineCallAndReturn.cpp.
References hasMember().
Referenced by isContainerMethod().
|
static |
Returns true if the given function refers to a method of a C++ container or iterator.
We generally do a poor job modeling most containers right now, and might prefer not to inline their methods.
Definition at line 988 of file ExprEngineCallAndReturn.cpp.
References isContainerClass().
|
static |
Returns true if the given function is the destructor of a class named "shared_ptr".
Definition at line 997 of file ExprEngineCallAndReturn.cpp.
References clang::DeclarationName::getAsIdentifierInfo(), clang::NamedDecl::getDeclName(), and clang::CXXMethodDecl::getParent().
Definition at line 1200 of file ExprEngineCallAndReturn.cpp.
References clang::Call, clang::ento::CXXInstanceCall::getDecl(), clang::CXXMethodDecl::isCopyAssignmentOperator(), clang::CXXMethodDecl::isMoveAssignmentOperator(), and clang::FunctionDecl::isTrivial().
Referenced by clang::ento::ExprEngine::defaultEvalCall().
Definition at line 498 of file ExprEngineCallAndReturn.cpp.
References clang::All, clang::Call, D, clang::ento::AnalysisManager::getAnalysisDeclContext(), clang::AnalyzerOptions::getCTUPhase1Inlining(), clang::ento::CoreEngine::getCTUWorkList(), clang::ento::CoreEngine::getWorkList(), clang::ento::AnalysisManager::options, and clang::Small.
STATISTIC | ( | NumInlinedCalls | , |
"The # of times we inlined a call" | |||
) |
STATISTIC | ( | NumOfDynamicDispatchPathSplits | , |
"The # of times we split the path due to imprecise dynamic dispatch info" | |||
) |
STATISTIC | ( | NumReachedInlineCountMax | , |
"The # of times we reached inline count maximum" | |||
) |
|
static |
Definition at line 189 of file ExprEngineCallAndReturn.cpp.
References clang::Call, clang::Decl::getCanonicalDecl(), and clang::LocationContext::getDecl().
Referenced by clang::ento::ExprEngine::processCallExit().