clang
9.0.0
|
#include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h"
#include "PrettyStackTraceLocationContext.h"
#include "clang/AST/CXXInheritance.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 "llvm/ADT/SmallSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Support/SaveAndRestore.h"
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "ExprEngine" |
Enumerations | |
enum | DynamicDispatchMode |
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. More... | |
static bool | wasDifferentDeclUsedForInlining (CallEventRef<> Call, const StackFrameContext *calleeCtx) |
REGISTER_MAP_WITH_PROGRAMSTATE (DynamicDispatchBifurcationMap, const MemRegion *, unsigned) bool 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. More... | |
static bool | isContainerClass (const ASTContext &Ctx, const CXXRecordDecl *RD) |
Returns true if the given C++ class is a container or iterator. More... | |
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. More... | |
static bool | isCXXSharedPtrDtor (const FunctionDecl *FD) |
Returns true if the given function is the destructor of a class named "shared_ptr". More... | |
static bool | isTrivialObjectAssignment (const CallEvent &Call) |
#define DEBUG_TYPE "ExprEngine" |
Definition at line 28 of file ExprEngineCallAndReturn.cpp.
enum DynamicDispatchMode |
Definition at line 421 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 125 of file ExprEngineCallAndReturn.cpp.
References clang::QualType::getCanonicalType(), clang::Type::getPointeeCXXRecordDecl(), clang::Type::isObjCObjectPointerType(), and V.
Referenced by clang::ento::ExprEngine::processCallExit().
|
static |
Definition at line 485 of file ExprEngineCallAndReturn.cpp.
Referenced by clang::ento::ExprEngine::defaultEvalCall().
Definition at line 73 of file ExprEngineCallAndReturn.cpp.
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 801 of file ExprEngineCallAndReturn.cpp.
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 823 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 834 of file ExprEngineCallAndReturn.cpp.
References isContainerClass().
Referenced by isCXXSharedPtrDtor().
|
static |
Returns true if the given function is the destructor of a class named "shared_ptr".
Definition at line 843 of file ExprEngineCallAndReturn.cpp.
References clang::AnalysisDeclContext::getAnalysis(), clang::ento::ExprEngine::getAnalysisManager(), clang::DeclarationName::getAsIdentifierInfo(), clang::AnalysisDeclContext::getASTContext(), clang::AnalysisDeclContext::getCFG(), clang::AnalysisDeclContextManager::getContext(), clang::AnalysisDeclContext::getDecl(), clang::NamedDecl::getDeclName(), clang::ASTContext::getLangOpts(), clang::ento::ExplodedNode::getLocationContext(), clang::CXXMethodDecl::getParent(), clang::ASTContext::getSourceManager(), clang::ento::ExprEngine::Inline_Minimal, clang::AnalyzerOptions::InlineMaxStackDepth, clang::AnalysisDeclContext::isBodyAutosynthesized(), isContainerMethod(), clang::AnalysisDeclContext::isInStdNamespace(), clang::SourceManager::isInSystemHeader(), clang::ento::CallEvent::isVariadic(), and clang::FunctionDecl::TK_NonTemplate.
Definition at line 989 of file ExprEngineCallAndReturn.cpp.
References clang::CXXInstanceCall::getDecl(), clang::CXXMethodDecl::isCopyAssignmentOperator(), clang::CXXMethodDecl::isMoveAssignmentOperator(), and clang::FunctionDecl::isTrivial().
Referenced by clang::ento::ExprEngine::defaultEvalCall().
REGISTER_MAP_WITH_PROGRAMSTATE | ( | DynamicDispatchBifurcationMap | , |
const MemRegion * | , | ||
unsigned | |||
) |
Definition at line 427 of file ExprEngineCallAndReturn.cpp.
References clang::ento::CE_Block, clang::AnalysisDeclContext::getBlockInvocationContext(), clang::AnalysisDeclContext::getStackFrame(), and clang::LocationContext::getStackFrame().
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 |
Definition at line 184 of file ExprEngineCallAndReturn.cpp.
References clang::Decl::getCanonicalDecl(), and clang::LocationContext::getDecl().
Referenced by clang::ento::ExprEngine::processCallExit().