]> granicus.if.org Git - clang/commitdiff
Now we can get the CFG from the ProgramPoint. No need to pass in the
authorZhongxing Xu <xuzhongxing@gmail.com>
Tue, 18 Aug 2009 08:46:04 +0000 (08:46 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Tue, 18 Aug 2009 08:46:04 +0000 (08:46 +0000)
BugReporter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79327 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/PathSensitive/AnalysisContext.h
include/clang/Analysis/PathSensitive/BugReporter.h
lib/Analysis/BugReporter.cpp

index e7ef89ae6965bcb8ff756a47deeda4901d76bdee..d945aebb995f652d74c3815823c5fd678b249193 100644 (file)
@@ -79,6 +79,8 @@ public:
 
   LocationContext *getParent() const { return Parent; }
 
+  CFG *getCFG() const { return getAnalysisContext()->getCFG(); }
+
   LiveVariables *getLiveVariables() const { 
     return getAnalysisContext()->getLiveVariables();
   }
index b99eaee953dc8a954d61a1fe61f70953d2ca48b4..19d9ccd6aa93f4b8ed3d36dc36ec8ba45890b6c8 100644 (file)
@@ -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; }
 
index 354bafd9896c2bb22bc5689ef662f6083b201c3e..745e90c38e2a8671fbf2e95f444106d3afb9b471 100644 (file)
@@ -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;