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

Ted Kremenek kremenek at apple.com
Fri Apr 11 11:40:29 PDT 2008


Author: kremenek
Date: Fri Apr 11 13:40:29 2008
New Revision: 49551

URL: http://llvm.org/viewvc/llvm-project?rev=49551&view=rev
Log:
Added "RangedBugReport".

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

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=49551&r1=49550&r2=49551&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/BugReporter.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/BugReporter.h Fri Apr 11 13:40:29 2008
@@ -68,6 +68,28 @@
                                          ASTContext& Ctx);
 };
   
+  class RangedBugReport : public BugReport {
+  std::vector<SourceRange> Ranges;
+public:
+  RangedBugReport(const BugType& D) : BugReport(D) {}
+  virtual ~RangedBugReport();
+  
+  void addRange(SourceRange R) { Ranges.push_back(R); }
+  
+  virtual void getRanges(const SourceRange*& beg,           
+                         const SourceRange*& end) const {
+    
+    if (Ranges.empty()) {
+      beg = NULL;
+      end = NULL;
+    }
+    else {
+      beg = &Ranges[0];
+      end = beg + Ranges.size();
+    }
+  }
+};
+  
 class BugReporter {
   llvm::SmallPtrSet<void*,10> CachedErrors;
   Diagnostic& Diag;

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

==============================================================================
--- cfe/trunk/lib/Analysis/BugReporter.cpp (original)
+++ cfe/trunk/lib/Analysis/BugReporter.cpp Fri Apr 11 13:40:29 2008
@@ -28,6 +28,8 @@
 BugReporter::~BugReporter() {}
 BugType::~BugType() {}
 BugReport::~BugReport() {}
+RangedBugReport::~RangedBugReport() {}
+
 ExplodedGraph<ValueState>& BugReporter::getGraph() { return Eng.getGraph(); }
 
 static inline Stmt* GetStmt(const ProgramPoint& P) {





More information about the cfe-commits mailing list