[cfe-commits] r64034 - /cfe/trunk/lib/Analysis/CFRefCount.cpp

Ted Kremenek kremenek at apple.com
Sat Feb 7 14:04:05 PST 2009


Author: kremenek
Date: Sat Feb  7 16:04:05 2009
New Revision: 64034

URL: http://llvm.org/viewvc/llvm-project?rev=64034&view=rev
Log:
Split logic for 'getEndPath()' for CFRefReport and CFRefLeakReport.

Modified:
    cfe/trunk/lib/Analysis/CFRefCount.cpp

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

==============================================================================
--- cfe/trunk/lib/Analysis/CFRefCount.cpp (original)
+++ cfe/trunk/lib/Analysis/CFRefCount.cpp Sat Feb  7 16:04:05 2009
@@ -2091,6 +2091,7 @@
   //===---------===//
   
   class VISIBILITY_HIDDEN CFRefReport : public RangedBugReport {
+  protected:
     SymbolRef Sym;
   public:
     CFRefReport(CFRefBug& D, ExplodedNode<GRState> *n, SymbolRef sym)
@@ -2132,7 +2133,10 @@
   public:
     CFRefLeakReport(CFRefBug& D, ExplodedNode<GRState> *n, SymbolRef sym)
       : CFRefReport(D, n, sym) {}
-    
+
+    PathDiagnosticPiece* getEndPath(BugReporter& BR,
+                                    const ExplodedNode<GRState>* N);
+
     SourceLocation getLocation() const;
   };  
 } // end anonymous namespace
@@ -2415,16 +2419,22 @@
 CFRefReport::getEndPath(BugReporter& br, const ExplodedNode<GRState>* EndN) {
 
   GRBugReporter& BR = cast<GRBugReporter>(br);
-  
   // Tell the BugReporter to report cases when the tracked symbol is
   // assigned to different variables, etc.
   cast<GRBugReporter>(BR).addNotableSymbol(Sym);
-  
-  if (!getBugType().isLeak())
-    return RangedBugReport::getEndPath(BR, EndN);
-  
-  // We are a leak.  Walk up the graph to get to the first node where the
-  // symbol appeared, and also get the first VarDecl that tracked object
+  return RangedBugReport::getEndPath(BR, EndN);
+}
+
+PathDiagnosticPiece*
+CFRefLeakReport::getEndPath(BugReporter& br, const ExplodedNode<GRState>* EndN){
+
+  GRBugReporter& BR = cast<GRBugReporter>(br);
+  // Tell the BugReporter to report cases when the tracked symbol is
+  // assigned to different variables, etc.
+  cast<GRBugReporter>(BR).addNotableSymbol(Sym);
+    
+  // We are reporting a leak.  Walk up the graph to get to the first node where
+  // the symbol appeared, and also get the first VarDecl that tracked object
   // is stored to.
   const ExplodedNode<GRState>* AllocNode = 0;
   const MemRegion* FirstBinding = 0;





More information about the cfe-commits mailing list