aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-07-02 19:28:09 +0000
committerJordan Rose <jordan_rose@apple.com>2012-07-02 19:28:09 +0000
commit69f87c956b3ac2b80124fd9604af012e1061473a (patch)
treea137e8b3bb536d633c81c6b3c31ec63a855baa27 /include
parentde507eaf3cb54d3cb234dc14499c10ab3373d15f (diff)
[analyzer] Use CallEvent for inlining and call default-evaluation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159560 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/clang/StaticAnalyzer/Core/CheckerManager.h10
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/Calls.h21
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h9
3 files changed, 26 insertions, 14 deletions
diff --git a/include/clang/StaticAnalyzer/Core/CheckerManager.h b/include/clang/StaticAnalyzer/Core/CheckerManager.h
index eef82fe848..689b13d99d 100644
--- a/include/clang/StaticAnalyzer/Core/CheckerManager.h
+++ b/include/clang/StaticAnalyzer/Core/CheckerManager.h
@@ -33,6 +33,7 @@ namespace ento {
class AnalysisManager;
class BugReporter;
class CheckerContext;
+ class SimpleCall;
class ObjCMethodCall;
class SVal;
class ExplodedNode;
@@ -44,12 +45,6 @@ namespace ento {
class MemRegion;
class SymbolReaper;
-class GraphExpander {
-public:
- virtual ~GraphExpander();
- virtual void expandGraph(ExplodedNodeSet &Dst, ExplodedNode *Pred) = 0;
-};
-
template <typename T> class CheckerFn;
template <typename RET, typename P1, typename P2, typename P3, typename P4,
@@ -303,8 +298,7 @@ public:
/// \brief Run checkers for evaluating a call.
void runCheckersForEvalCall(ExplodedNodeSet &Dst,
const ExplodedNodeSet &Src,
- const CallExpr *CE, ExprEngine &Eng,
- GraphExpander *defaultEval = 0);
+ const SimpleCall &CE, ExprEngine &Eng);
/// \brief Run checkers for the entire Translation Unit.
void runCheckersOnEndOfTranslationUnit(const TranslationUnitDecl *TU,
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/Calls.h b/include/clang/StaticAnalyzer/Core/PathSensitive/Calls.h
index a16eb4afef..c555ee995f 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/Calls.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/Calls.h
@@ -278,16 +278,27 @@ protected:
public:
BlockCall(const CallExpr *CE, ProgramStateRef St,
const LocationContext *LCtx)
- : SimpleCall(CE, St, LCtx, CE_Block) {
- assert(isa<BlockDataRegion>(getSVal(CE->getCallee()).getAsRegion()));
+ : SimpleCall(CE, St, LCtx, CE_Block) {}
+
+ /// \brief Returns the region associated with this instance of the block.
+ ///
+ /// This may be NULL if the block's origin is unknown.
+ const BlockDataRegion *getBlockRegion() const;
+
+ /// \brief Gets the declaration of the block.
+ ///
+ /// This is not an override of getDecl() because AnyFunctionCall has already
+ /// assumed that it's a FunctionDecl.
+ const BlockDecl *getBlockDecl() const {
+ const BlockDataRegion *BR = getBlockRegion();
+ if (!BR)
+ return 0;
+ return BR->getDecl();
}
static bool classof(const CallEvent *CA) {
return CA->getKind() == CE_Block;
}
-
-private:
- const BlockDataRegion *getBlockRegion() const;
};
/// \brief Represents a call to a C++ constructor.
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
index bddc23cacd..c8a7e8102a 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
@@ -42,6 +42,7 @@ namespace ento {
class AnalysisManager;
class CallEvent;
+class SimpleCall;
class ObjCMethodCall;
class ExprEngine : public SubEngine {
@@ -468,6 +469,11 @@ public:
void evalStore(ExplodedNodeSet &Dst, const Expr *AssignE, const Expr *StoreE,
ExplodedNode *Pred, ProgramStateRef St, SVal TargetLV, SVal Val,
const ProgramPointTag *tag = 0);
+
+ void evalCall(ExplodedNodeSet &Dst, ExplodedNode *Pred,
+ const SimpleCall &Call);
+ void defaultEvalCall(ExplodedNodeSet &Dst, ExplodedNode *Pred,
+ const CallEvent &Call);
private:
void evalLoadCommon(ExplodedNodeSet &Dst,
const Expr *NodeEx, /* Eventually will be a CFGStmt */
@@ -488,7 +494,8 @@ private:
const ProgramPointTag *tag, bool isLoad);
bool shouldInlineDecl(const Decl *D, ExplodedNode *Pred);
- bool InlineCall(ExplodedNodeSet &Dst, const CallExpr *CE, ExplodedNode *Pred);
+ bool inlineCall(ExplodedNodeSet &Dst, const CallEvent &Call,
+ ExplodedNode *Pred);
bool replayWithoutInlining(ExplodedNode *P, const LocationContext *CalleeLC);
};