[cfe-commits] r79327 - in /cfe/trunk: include/clang/Analysis/PathSensitive/AnalysisContext.h include/clang/Analysis/PathSensitive/BugReporter.h lib/Analysis/BugReporter.cpp

Zhongxing Xu xuzhongxing at gmail.com
Tue Aug 18 01:46:04 PDT 2009


Author: zhongxingxu
Date: Tue Aug 18 03:46:04 2009
New Revision: 79327

URL: http://llvm.org/viewvc/llvm-project?rev=79327&view=rev
Log:
Now we can get the CFG from the ProgramPoint. No need to pass in the 
BugReporter.

Modified:
    cfe/trunk/include/clang/Analysis/PathSensitive/AnalysisContext.h
    cfe/trunk/include/clang/Analysis/PathSensitive/BugReporter.h
    cfe/trunk/lib/Analysis/BugReporter.cpp

Modified: cfe/trunk/include/clang/Analysis/PathSensitive/AnalysisContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/AnalysisContext.h?rev=79327&r1=79326&r2=79327&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/AnalysisContext.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/AnalysisContext.h Tue Aug 18 03:46:04 2009
@@ -79,6 +79,8 @@
 
   LocationContext *getParent() const { return Parent; }
 
+  CFG *getCFG() const { return getAnalysisContext()->getCFG(); }
+
   LiveVariables *getLiveVariables() const { 
     return getAnalysisContext()->getLiveVariables();
   }

Modified: cfe/trunk/include/clang/Analysis/PathSensitive/BugReporter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/BugReporter.h?rev=79327&r1=79326&r2=79327&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/BugReporter.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/BugReporter.h Tue Aug 18 03:46:04 2009
@@ -101,7 +101,7 @@
   // 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; }
 

Modified: cfe/trunk/lib/Analysis/BugReporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/BugReporter.cpp?rev=79327&r1=79326&r2=79327&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/BugReporter.cpp (original)
+++ cfe/trunk/lib/Analysis/BugReporter.cpp Tue Aug 18 03:46:04 2009
@@ -1206,12 +1206,14 @@
 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 @@
 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 @@
 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;





More information about the cfe-commits mailing list