Do not highlight bogus ranges for leaks.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50549 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index 9828792..ea036f0 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -1444,7 +1444,9 @@
   public:
     CFRefBug(CFRefCount& tf) : TF(tf) {}
     
-    CFRefCount& getTF() { return TF; }   
+    CFRefCount& getTF() { return TF; }
+    
+    virtual bool ReportRanges() const { return true; }
   };
   
   class VISIBILITY_HIDDEN UseAfterRelease : public CFRefBug {
@@ -1491,7 +1493,8 @@
     }
     
     virtual void EmitWarnings(BugReporter& BR);
-    virtual void GetErrorNodes(std::vector<ExplodedNode<ValueState>*>& Nodes);    
+    virtual void GetErrorNodes(std::vector<ExplodedNode<ValueState>*>& Nodes);
+    virtual bool ReportRanges() const { return false; }
   };
   
   //===---------===//
@@ -1506,6 +1509,24 @@
         
     virtual ~CFRefReport() {}
     
+    CFRefBug& getBugType() {
+      return (CFRefBug&) RangedBugReport::getBugType();
+    }
+    const CFRefBug& getBugType() const {
+      return (const CFRefBug&) RangedBugReport::getBugType();
+    }
+    
+    virtual void getRanges(BugReporter& BR, const SourceRange*& beg,           
+                           const SourceRange*& end) {
+      
+      if (getBugType().ReportRanges())
+        RangedBugReport::getRanges(BR, beg, end);
+      else {
+        beg = 0;
+        end = 0;
+      }
+    }
+    
     virtual std::pair<const char**,const char**> getExtraDescriptiveText();
     
     virtual PathDiagnosticPiece* VisitNode(ExplodedNode<ValueState>* N,