summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2009-08-18 08:46:04 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2009-08-18 08:46:04 +0000
commit4c76dbc758e675995e2a92d5b5de23986a1d72df (patch)
tree03133559aa296efe8e3d2d339256ff3c3e916d2a
parentd04405f036903adcc9e667c4f4e79309fb6f6ef7 (diff)
downloadbcm5719-llvm-4c76dbc758e675995e2a92d5b5de23986a1d72df.tar.gz
bcm5719-llvm-4c76dbc758e675995e2a92d5b5de23986a1d72df.zip
Now we can get the CFG from the ProgramPoint. No need to pass in the
BugReporter. llvm-svn: 79327
-rw-r--r--clang/include/clang/Analysis/PathSensitive/AnalysisContext.h2
-rw-r--r--clang/include/clang/Analysis/PathSensitive/BugReporter.h2
-rw-r--r--clang/lib/Analysis/BugReporter.cpp10
3 files changed, 9 insertions, 5 deletions
diff --git a/clang/include/clang/Analysis/PathSensitive/AnalysisContext.h b/clang/include/clang/Analysis/PathSensitive/AnalysisContext.h
index e7ef89ae696..d945aebb995 100644
--- a/clang/include/clang/Analysis/PathSensitive/AnalysisContext.h
+++ b/clang/include/clang/Analysis/PathSensitive/AnalysisContext.h
@@ -79,6 +79,8 @@ public:
LocationContext *getParent() const { return Parent; }
+ CFG *getCFG() const { return getAnalysisContext()->getCFG(); }
+
LiveVariables *getLiveVariables() const {
return getAnalysisContext()->getLiveVariables();
}
diff --git a/clang/include/clang/Analysis/PathSensitive/BugReporter.h b/clang/include/clang/Analysis/PathSensitive/BugReporter.h
index b99eaee953d..19d9ccd6aa9 100644
--- a/clang/include/clang/Analysis/PathSensitive/BugReporter.h
+++ b/clang/include/clang/Analysis/PathSensitive/BugReporter.h
@@ -101,7 +101,7 @@ public:
// object.
// FIXME: If we do need it, we can probably just make it private to
// BugReporter.
- const Stmt* getStmt(BugReporter& BR) const;
+ const Stmt* getStmt() const;
const std::string& getDescription() const { return Description; }
diff --git a/clang/lib/Analysis/BugReporter.cpp b/clang/lib/Analysis/BugReporter.cpp
index 354bafd9896..745e90c38e2 100644
--- a/clang/lib/Analysis/BugReporter.cpp
+++ b/clang/lib/Analysis/BugReporter.cpp
@@ -1206,12 +1206,14 @@ void BugType::FlushReports(BugReporter &BR) {}
BugReport::~BugReport() {}
RangedBugReport::~RangedBugReport() {}
-const Stmt* BugReport::getStmt(BugReporter& BR) const {
+const Stmt* BugReport::getStmt() const {
ProgramPoint ProgP = EndNode->getLocation();
const Stmt *S = NULL;
if (BlockEntrance* BE = dyn_cast<BlockEntrance>(&ProgP)) {
- if (BE->getBlock() == &BR.getCFG()->getExit()) S = GetPreviousStmt(EndNode);
+ CFGBlock &Exit = ProgP.getContext()->getCFG()->getExit();
+ if (BE->getBlock() == &Exit)
+ S = GetPreviousStmt(EndNode);
}
if (!S)
S = GetStmt(ProgP);
@@ -1223,7 +1225,7 @@ PathDiagnosticPiece*
BugReport::getEndPath(BugReporterContext& BRC,
const ExplodedNode* EndPathNode) {
- const Stmt* S = getStmt(BRC.getBugReporter());
+ const Stmt* S = getStmt();
if (!S)
return NULL;
@@ -1246,7 +1248,7 @@ BugReport::getEndPath(BugReporterContext& BRC,
void BugReport::getRanges(BugReporter& BR, const SourceRange*& beg,
const SourceRange*& end) {
- if (const Expr* E = dyn_cast_or_null<Expr>(getStmt(BR))) {
+ if (const Expr* E = dyn_cast_or_null<Expr>(getStmt())) {
R = E->getSourceRange();
assert(R.isValid());
beg = &R;
OpenPOWER on IntegriCloud