[cfe-commits] r137894 - in /cfe/trunk: examples/analyzer-plugin/ include/clang/StaticAnalyzer/Core/BugReporter/ lib/StaticAnalyzer/Checkers/ lib/StaticAnalyzer/Core/

Anna Zaks ganna at apple.com
Wed Aug 17 16:00:26 PDT 2011


Author: zaks
Date: Wed Aug 17 18:00:25 2011
New Revision: 137894

URL: http://llvm.org/viewvc/llvm-project?rev=137894&view=rev
Log:
Remove EnhancedBugReport and RangedBugReport - pull all the extra functionality they provided into their parent BugReport. The only functional changes are: made getRanges() non const - it adds default range to Ranges if none are supplied, made getStmt() private, which was another FIXME.

Modified:
    cfe/trunk/examples/analyzer-plugin/MainCallChecker.cpp
    cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
    cfe/trunk/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/CastSizeChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/CastToStructChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/DivZeroChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/FixedAddressChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/IteratorsChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCAtSyncChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/PointerSubChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/ReturnPointerRangeChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/ReturnUndefChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/UndefinedArraySubscriptChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
    cfe/trunk/lib/StaticAnalyzer/Core/CFRefCount.cpp

Modified: cfe/trunk/examples/analyzer-plugin/MainCallChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/analyzer-plugin/MainCallChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/examples/analyzer-plugin/MainCallChecker.cpp (original)
+++ cfe/trunk/examples/analyzer-plugin/MainCallChecker.cpp Wed Aug 17 18:00:25 2011
@@ -36,7 +36,7 @@
     if (!BT)
       BT.reset(new BugType("call to main", "example analyzer plugin"));
 
-    RangedBugReport *report = new RangedBugReport(*BT, BT->getName(), N);
+    BugReport *report = new BugReport(*BT, BT->getName(), N);
     report->addRange(Callee->getSourceRange());
     C.EmitReport(report);    
   }

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h Wed Aug 17 18:00:25 2011
@@ -58,34 +58,37 @@
   virtual void Profile(llvm::FoldingSetNodeID &ID) const = 0;
 };
 
-// FIXME: Combine this with RangedBugReport and remove RangedBugReport.
 class BugReport : public BugReporterVisitor {
+public:
+  class NodeResolver {
+  public:
+    virtual ~NodeResolver() {}
+    virtual const ExplodedNode*
+            getOriginalNode(const ExplodedNode *N) = 0;
+  };
+
+  typedef void (*VisitorCreator)(BugReporterContext &BRcC, const void *data,
+                                 const ExplodedNode *N);
+  typedef const SourceRange *ranges_iterator;
+
 protected:
+  friend class BugReporter;
+  friend class BugReportEquivClass;
+  typedef SmallVector<std::pair<VisitorCreator, const void*>, 2> Creators;
+
   BugType& BT;
   std::string ShortDescription;
   std::string Description;
   const ExplodedNode *ErrorNode;
-  mutable SourceRange R;
-
-protected:
-  friend class BugReporter;
-  friend class BugReportEquivClass;
+  SmallVector<SourceRange, 4> Ranges;
+  Creators creators;
 
   /// Profile to identify equivalent bug reports for error report coalescing.
-  virtual void Profile(llvm::FoldingSetNodeID& hash) const {
-    hash.AddPointer(&BT);
-    hash.AddInteger(getLocation().getRawEncoding());
-    hash.AddString(Description);
-  }
+  virtual void Profile(llvm::FoldingSetNodeID& hash) const;
 
-public:
-  class NodeResolver {
-  public:
-    virtual ~NodeResolver() {}
-    virtual const ExplodedNode*
-            getOriginalNode(const ExplodedNode *N) = 0;
-  };
+  const Stmt *getStmt() const;
 
+public:
   BugReport(BugType& bt, StringRef desc, const ExplodedNode *errornode)
     : BT(bt), Description(desc), ErrorNode(errornode) {}
 
@@ -96,34 +99,26 @@
 
   virtual ~BugReport();
 
-  virtual bool isOwnedByReporterContext() { return false; }
+  bool isOwnedByReporterContext() { return false; }
 
   const BugType& getBugType() const { return BT; }
   BugType& getBugType() { return BT; }
 
-  // FIXME: Perhaps this should be moved into a subclass?
   const ExplodedNode *getErrorNode() const { return ErrorNode; }
 
-  // FIXME: Do we need this?  Maybe getLocation() should return a ProgramPoint
-  // object.
-  // FIXME: If we do need it, we can probably just make it private to
-  // BugReporter.
-  const Stmt *getStmt() const;
-
   const StringRef getDescription() const { return Description; }
 
   const StringRef getShortDescription() const {
     return ShortDescription.empty() ? Description : ShortDescription;
   }
 
-  /// \brief This allows for addition of metadata to the diagnostic. 
+  /// \brief This allows for addition of meta data to the diagnostic.
   ///
   /// Currently, only the HTMLDiagnosticClient knows how to display it. 
   virtual std::pair<const char**,const char**> getExtraDescriptiveText() {
     return std::make_pair((const char**)0,(const char**)0);
   }
 
-  // FIXME: Perhaps move this into a subclass.
   /// Provide custom definition for the last diagnostic piece on the path.
   virtual PathDiagnosticPiece *getEndPath(BugReporterContext &BRC,
                                           const ExplodedNode *N);
@@ -135,9 +130,28 @@
   ///  This location is used by clients rendering diagnostics.
   virtual SourceLocation getLocation() const;
 
-  typedef const SourceRange *ranges_iterator;
+  /// \brief Add a range to a bug report.
+  ///
+  /// Ranges are used to highlight regions of interest in the source code.
+  /// They should be at the same source code line as the BugReport location.
+  void addRange(SourceRange R) {
+    assert(R.isValid());
+    Ranges.push_back(R);
+  }
 
-  virtual std::pair<ranges_iterator, ranges_iterator> getRanges() const;
+  /// \brief Get the SourceRanges associated with the report.
+  virtual std::pair<ranges_iterator, ranges_iterator> getRanges();
+
+  /// \brief Add custom or predefined bug report visitors to this report.
+  ///
+  /// The visitors should be used when the default trace is not sufficient.
+  /// For example, they allow constructing a more elaborate trace.
+  /// \sa registerConditionVisitor(), registerTrackNullOrUndefValue(),
+  /// registerFindLastStore(), registerNilReceiverVisitor(), and
+  /// registerVarDeclsLastStore().
+  void addVisitorCreator(VisitorCreator creator, const void *data) {
+    creators.push_back(std::make_pair(creator, data));
+  }
 
   virtual PathDiagnosticPiece *VisitNode(const ExplodedNode *N,
                                          const ExplodedNode *PrevN,
@@ -195,91 +209,6 @@
   const_iterator end() const { return const_iterator(Reports.end()); }
 };
 
-
-//===----------------------------------------------------------------------===//
-// Specialized subclasses of BugReport.
-//===----------------------------------------------------------------------===//
-
-// FIXME: Collapse this with the default BugReport class.
-class RangedBugReport : public BugReport {
-  SmallVector<SourceRange, 4> Ranges;
-public:
-  RangedBugReport(BugType& D, StringRef description,
-                  ExplodedNode *errornode)
-    : BugReport(D, description, errornode) {}
-
-  RangedBugReport(BugType& D, StringRef shortDescription,
-                  StringRef description, ExplodedNode *errornode)
-  : BugReport(D, shortDescription, description, errornode) {}
-
-  ~RangedBugReport();
-
-  // FIXME: Move this out of line.
-  /// \brief Add a range to a bug report.
-  ///
-  /// Ranges are used to highlight regions of interest in the source code. 
-  /// They should be at the same source code line as the BugReport location.
-  void addRange(SourceRange R) {
-    assert(R.isValid());
-    Ranges.push_back(R);
-  }
-  
-  virtual std::pair<ranges_iterator, ranges_iterator> getRanges() const {
-    return std::make_pair(Ranges.begin(), Ranges.end());
-  }
-  
-  virtual void Profile(llvm::FoldingSetNodeID& hash) const {
-    BugReport::Profile(hash);
-    for (SmallVectorImpl<SourceRange>::const_iterator I =
-          Ranges.begin(), E = Ranges.end(); I != E; ++I) {
-      const SourceRange range = *I;
-      if (!range.isValid())
-        continue;
-      hash.AddInteger(range.getBegin().getRawEncoding());
-      hash.AddInteger(range.getEnd().getRawEncoding());
-    }
-  }
-};
-
-/// EnhancedBugReport allows checkers to register additional bug report
-/// visitors, thus, constructing a more elaborate trace.
-class EnhancedBugReport : public RangedBugReport {
-public:
-  typedef void (*VisitorCreator)(BugReporterContext &BRcC, const void *data,
-                                 const ExplodedNode *N);
-
-private:
-  typedef std::vector<std::pair<VisitorCreator, const void*> > Creators;
-  Creators creators;
-
-public:
-  EnhancedBugReport(BugType& D, StringRef description,
-                    ExplodedNode *errornode)
-   : RangedBugReport(D, description, errornode) {}
-
-  EnhancedBugReport(BugType& D, StringRef shortDescription,
-                   StringRef description, ExplodedNode *errornode)
-    : RangedBugReport(D, shortDescription, description, errornode) {}
-
-  ~EnhancedBugReport() {}
-
-  void registerInitialVisitors(BugReporterContext &BRC, const ExplodedNode *N) {
-    for (Creators::iterator I = creators.begin(), E = creators.end(); I!=E; ++I)
-      I->first(BRC, I->second, N);
-  }
-
-  /// \brief Add custom or predefined bug report visitors to this report.
-  ///
-  /// The visitors should be used when the default trace is not sufficient.
-  /// For example, they allow constructing a more elaborate trace.
-  /// \sa registerConditionVisitor(), registerTrackNullOrUndefValue(),
-  /// registerFindLastStore(), registerNilReceiverVisitor(), and
-  /// registerVarDeclsLastStore().
-  void addVisitorCreator(VisitorCreator creator, const void *data) {
-    creators.push_back(std::make_pair(creator, data));
-  }
-};
-
 //===----------------------------------------------------------------------===//
 // BugReporter and friends.
 //===----------------------------------------------------------------------===//
@@ -491,12 +420,12 @@
   virtual BugReport::NodeResolver& getNodeResolver() = 0;
 };
 
-class DiagBugReport : public RangedBugReport {
+class DiagBugReport : public BugReport {
   std::list<std::string> Strs;
   FullSourceLoc L;
 public:
   DiagBugReport(BugType& D, StringRef desc, FullSourceLoc l) :
-  RangedBugReport(D, desc, 0), L(l) {}
+  BugReport(D, desc, 0), L(l) {}
 
   virtual ~DiagBugReport() {}
 

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp Wed Aug 17 18:00:25 2011
@@ -73,8 +73,8 @@
     // reference is outside the range.
 
     // Generate a report for this bug.
-    RangedBugReport *report = 
-      new RangedBugReport(*BT, BT->getDescription(), N);
+    BugReport *report = 
+      new BugReport(*BT, BT->getDescription(), N);
 
     report->addRange(C.getStmt()->getSourceRange());
     C.EmitReport(report);

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp Wed Aug 17 18:00:25 2011
@@ -187,7 +187,7 @@
      << (kind == OOB_Precedes ? "(accessed memory precedes memory block)"
                               : "(access exceeds upper limit of memory block)");
 
-  checkerContext.EmitReport(new RangedBugReport(*BT, os.str(), errorNode));
+  checkerContext.EmitReport(new BugReport(*BT, os.str(), errorNode));
 }
 
 void RegionRawOffsetV2::dump() const {

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp Wed Aug 17 18:00:25 2011
@@ -100,8 +100,8 @@
           BT.reset(new BugType("Argument with 'nonnull' attribute passed null",
                                "API"));
 
-        EnhancedBugReport *R =
-          new EnhancedBugReport(*BT,
+        BugReport *R =
+          new BugReport(*BT,
                                 "Null pointer passed as an argument to a "
                                 "'nonnull' parameter", errorNode);
 

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp Wed Aug 17 18:00:25 2011
@@ -92,7 +92,7 @@
     os << "Argument to '" << GetReceiverNameType(msg) << "' method '"
        << msg.getSelector().getAsString() << "' cannot be nil";
 
-    RangedBugReport *R = new RangedBugReport(*BT, os.str(), N);
+    BugReport *R = new BugReport(*BT, os.str(), N);
     R->addRange(msg.getArgSourceRange(Arg));
     C.EmitReport(R);
   }
@@ -335,7 +335,7 @@
     if (!BT)
       BT.reset(new APIMisuse("Bad use of CFNumberCreate"));
     
-    RangedBugReport *report = new RangedBugReport(*BT, os.str(), N);
+    BugReport *report = new BugReport(*BT, os.str(), N);
     report->addRange(CE->getArg(2)->getSourceRange());
     C.EmitReport(report);
   }
@@ -412,7 +412,7 @@
                             ? "Null pointer argument in call to CFRetain"
                             : "Null pointer argument in call to CFRelease";
 
-    EnhancedBugReport *report = new EnhancedBugReport(*BT, description, N);
+    BugReport *report = new BugReport(*BT, description, N);
     report->addRange(Arg->getSourceRange());
     report->addVisitorCreator(bugreporter::registerTrackNullOrUndefValue, Arg);
     C.EmitReport(report);
@@ -471,7 +471,7 @@
           "of class '" << Class->getName()
        << "' and not the class directly";
   
-    RangedBugReport *report = new RangedBugReport(*BT, os.str(), N);
+    BugReport *report = new BugReport(*BT, os.str(), N);
     report->addRange(msg.getSourceRange());
     C.EmitReport(report);
   }
@@ -629,7 +629,7 @@
       << "' should be an Objective-C pointer type, not '" 
       << ArgTy.getAsString() << "'";
 
-    RangedBugReport *R = new RangedBugReport(*BT, os.str(),
+    BugReport *R = new BugReport(*BT, os.str(),
                                              errorNode.getValue());
     R->addRange(msg.getArgSourceRange(I));
     C.EmitReport(R);

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CStringChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CStringChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CStringChecker.cpp Wed Aug 17 18:00:25 2011
@@ -228,7 +228,7 @@
 
     // Generate a report for this bug.
     BuiltinBug *BT = static_cast<BuiltinBug*>(BT_Null.get());
-    EnhancedBugReport *report = new EnhancedBugReport(*BT, os.str(), N);
+    BugReport *report = new BugReport(*BT, os.str(), N);
 
     report->addRange(S->getSourceRange());
     report->addVisitorCreator(bugreporter::registerTrackNullOrUndefValue, S);
@@ -286,9 +286,9 @@
     BuiltinBug *BT = static_cast<BuiltinBug*>(BT_Bounds.get());
 
     // Generate a report for this bug.
-    RangedBugReport *report;
+    BugReport *report;
     if (warningMsg) {
-      report = new RangedBugReport(*BT, warningMsg, N);
+      report = new BugReport(*BT, warningMsg, N);
     } else {
       assert(CurrentFunctionDescription);
       assert(CurrentFunctionDescription[0] != '\0');
@@ -298,7 +298,7 @@
       os << (char)toupper(CurrentFunctionDescription[0])
          << &CurrentFunctionDescription[1]
          << " accesses out-of-bound array element";
-      report = new RangedBugReport(*BT, os.str(), N);      
+      report = new BugReport(*BT, os.str(), N);      
     }
 
     // FIXME: It would be nice to eventually make this diagnostic more clear,
@@ -508,8 +508,8 @@
     BT_Overlap.reset(new BugType("Unix API", "Improper arguments"));
 
   // Generate a report for this bug.
-  RangedBugReport *report = 
-    new RangedBugReport(*BT_Overlap,
+  BugReport *report = 
+    new BugReport(*BT_Overlap,
       "Arguments must not be overlapping buffers", N);
   report->addRange(First->getSourceRange());
   report->addRange(Second->getSourceRange());
@@ -672,7 +672,7 @@
            << "', which is not a null-terminated string";
 
         // Generate a report for this bug.
-        EnhancedBugReport *report = new EnhancedBugReport(*BT_NotCString,
+        BugReport *report = new BugReport(*BT_NotCString,
                                                           os.str(), N);
 
         report->addRange(Ex->getSourceRange());
@@ -733,7 +733,7 @@
         os << "not a null-terminated string";
 
       // Generate a report for this bug.
-      EnhancedBugReport *report = new EnhancedBugReport(*BT_NotCString,
+      BugReport *report = new BugReport(*BT_NotCString,
                                                         os.str(), N);
 
       report->addRange(Ex->getSourceRange());

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp Wed Aug 17 18:00:25 2011
@@ -64,7 +64,7 @@
   if (!N)
     return;
 
-  EnhancedBugReport *R = new EnhancedBugReport(*BT, BT->getName(), N);
+  BugReport *R = new BugReport(*BT, BT->getName(), N);
   R->addVisitorCreator(bugreporter::registerTrackNullOrUndefValue,
                        bugreporter::GetCalleeExpr(N));
   C.EmitReport(R);
@@ -92,7 +92,7 @@
       LazyInit_BT(BT_desc, BT);
 
       // Generate a report for this bug.
-      EnhancedBugReport *R = new EnhancedBugReport(*BT, BT->getName(), N);
+      BugReport *R = new BugReport(*BT, BT->getName(), N);
       R->addRange(argRange);
       if (argEx)
         R->addVisitorCreator(bugreporter::registerTrackNullOrUndefValue, argEx);
@@ -174,7 +174,7 @@
         }
 
         // Generate a report for this bug.
-        EnhancedBugReport *R = new EnhancedBugReport(*BT, os.str(), N);
+        BugReport *R = new BugReport(*BT, os.str(), N);
         R->addRange(argRange);
 
         // FIXME: enhance track back for uninitialized value for arbitrary
@@ -227,8 +227,8 @@
         if (!BT_msg_undef)
           BT_msg_undef.reset(new BuiltinBug("Receiver in message expression is "
                                             "an uninitialized value"));
-        EnhancedBugReport *R =
-          new EnhancedBugReport(*BT_msg_undef, BT_msg_undef->getName(), N);
+        BugReport *R =
+          new BugReport(*BT_msg_undef, BT_msg_undef->getName(), N);
         R->addRange(receiver->getSourceRange());
         R->addVisitorCreator(bugreporter::registerTrackNullOrUndefValue,
                              receiver);
@@ -272,7 +272,7 @@
      << "' is nil and returns a value of type '"
      << msg.getType(C.getASTContext()).getAsString() << "' that will be garbage";
 
-  EnhancedBugReport *report = new EnhancedBugReport(*BT_msg_ret, os.str(), N);
+  BugReport *report = new BugReport(*BT_msg_ret, os.str(), N);
   if (const Expr *receiver = msg.getInstanceReceiver()) {
     report->addRange(receiver->getSourceRange());
     report->addVisitorCreator(bugreporter::registerTrackNullOrUndefValue,

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CastSizeChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CastSizeChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CastSizeChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CastSizeChecker.cpp Wed Aug 17 18:00:25 2011
@@ -72,7 +72,7 @@
         BT.reset(new BuiltinBug("Cast region with wrong size.",
                             "Cast a region whose size is not a multiple of the"
                             " destination type size."));
-      RangedBugReport *R = new RangedBugReport(*BT, BT->getDescription(),
+      BugReport *R = new BugReport(*BT, BT->getDescription(),
                                                errorNode);
       R->addRange(CE->getSourceRange());
       C.EmitReport(R);

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CastToStructChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CastToStructChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CastToStructChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CastToStructChecker.cpp Wed Aug 17 18:00:25 2011
@@ -62,7 +62,7 @@
                             "Casting a non-structure type to a structure type "
                             "and accessing a field can lead to memory access "
                             "errors or data corruption."));
-      RangedBugReport *R = new RangedBugReport(*BT,BT->getDescription(), N);
+      BugReport *R = new BugReport(*BT,BT->getDescription(), N);
       R->addRange(CE->getSourceRange());
       C.EmitReport(R);
     }

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp Wed Aug 17 18:00:25 2011
@@ -73,8 +73,8 @@
       if (!BT_undef)
         BT_undef.reset(new BuiltinBug("Dereference of undefined pointer value"));
 
-      EnhancedBugReport *report =
-        new EnhancedBugReport(*BT_undef, BT_undef->getDescription(), N);
+      BugReport *report =
+        new BugReport(*BT_undef, BT_undef->getDescription(), N);
       report->addVisitorCreator(bugreporter::registerTrackNullOrUndefValue,
                                 bugreporter::GetDerefExpr(N));
       C.EmitReport(report);
@@ -157,8 +157,8 @@
           break;
       }
 
-      EnhancedBugReport *report =
-        new EnhancedBugReport(*BT_null,
+      BugReport *report =
+        new BugReport(*BT_null,
                               buf.empty() ? BT_null->getDescription():buf.str(),
                               N);
 

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/DivZeroChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/DivZeroChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/DivZeroChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/DivZeroChecker.cpp Wed Aug 17 18:00:25 2011
@@ -60,8 +60,8 @@
       if (!BT)
         BT.reset(new BuiltinBug("Division by zero"));
 
-      EnhancedBugReport *R = 
-        new EnhancedBugReport(*BT, BT->getDescription(), N);
+      BugReport *R = 
+        new BugReport(*BT, BT->getDescription(), N);
 
       R->addVisitorCreator(bugreporter::registerTrackNullOrUndefValue,
                            bugreporter::GetDenomExpr(N));

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/FixedAddressChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/FixedAddressChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/FixedAddressChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/FixedAddressChecker.cpp Wed Aug 17 18:00:25 2011
@@ -57,7 +57,7 @@
                           "Using a fixed address is not portable because that "
                           "address will probably not be valid in all "
                           "environments or platforms."));
-    RangedBugReport *R = new RangedBugReport(*BT, BT->getDescription(), N);
+    BugReport *R = new BugReport(*BT, BT->getDescription(), N);
     R->addRange(B->getRHS()->getSourceRange());
     C.EmitReport(R);
   }

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp Wed Aug 17 18:00:25 2011
@@ -407,7 +407,7 @@
 
     // Add a report for each ExplodedNode
     for (ExplodedNodeSet::iterator I = ES.begin(), E = ES.end(); I != E; ++I) {
-      EnhancedBugReport *report = new EnhancedBugReport(*BT, os.str(), *I);
+      BugReport *report = new BugReport(*BT, os.str(), *I);
 
       // Add source ranges and visitor hooks
       if (LHSRelevant) {

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/IteratorsChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/IteratorsChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/IteratorsChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/IteratorsChecker.cpp Wed Aug 17 18:00:25 2011
@@ -422,7 +422,7 @@
                     "container to its container";
       }
 
-      EnhancedBugReport *R = new EnhancedBugReport(*BT_Invalid, msg, N);
+      BugReport *R = new BugReport(*BT_Invalid, msg, N);
       R->addRange(getDeclRefExpr(E)->getSourceRange());
       C.EmitReport(R);
     }
@@ -434,7 +434,7 @@
         const_cast<IteratorsChecker*>(this)->BT_Undefined =
           new BuiltinBug("Use of iterator that is not defined");
 
-      EnhancedBugReport *R = new EnhancedBugReport(*BT_Undefined,
+      BugReport *R = new BugReport(*BT_Undefined,
                                            BT_Undefined->getDescription(), N);
       R->addRange(getDeclRefExpr(E)->getSourceRange());
       C.EmitReport(R);
@@ -503,8 +503,8 @@
               new BuiltinBug(
                       "Cannot compare iterators from different containers");
 
-          EnhancedBugReport *R = new EnhancedBugReport(*BT_Incompatible,
-                                         BT_Incompatible->getDescription(), N);
+          BugReport *R = new BugReport(*BT_Incompatible,
+                                        BT_Incompatible->getDescription(), N);
           R->addRange(OCE->getSourceRange());
           C.EmitReport(R);
         }

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp Wed Aug 17 18:00:25 2011
@@ -84,9 +84,8 @@
       BT.reset(new BugType("Improper use of SecKeychain API", "Mac OS API"));
   }
 
-  RangedBugReport *generateAllocatedDataNotReleasedReport(
-                                                      const AllocationState &AS,
-                                                      ExplodedNode *N) const;
+  BugReport *generateAllocatedDataNotReleasedReport(const AllocationState &AS,
+                                                    ExplodedNode *N) const;
 
   /// Check if RetSym evaluates to an error value in the current state.
   bool definitelyReturnedError(SymbolRef RetSym,
@@ -245,7 +244,7 @@
               << "the allocator: missing a call to '"
               << FunctionsToTrack[DIdx].Name
               << "'.";
-          RangedBugReport *Report = new RangedBugReport(*BT, os.str(), N);
+          BugReport *Report = new BugReport(*BT, os.str(), N);
           Report->addRange(ArgExpr->getSourceRange());
           C.EmitReport(Report);
         }
@@ -291,7 +290,7 @@
     if (!N)
       return;
     initBugType();
-    RangedBugReport *Report = new RangedBugReport(*BT,
+    BugReport *Report = new BugReport(*BT,
         "Trying to free data which has not been allocated.", N);
     Report->addRange(ArgExpr->getSourceRange());
     C.EmitReport(Report);
@@ -316,7 +315,7 @@
     llvm::raw_svector_ostream os(sbuf);
     os << "Allocator doesn't match the deallocator: '"
        << FunctionsToTrack[PDeallocIdx].Name << "' should be used.";
-    RangedBugReport *Report = new RangedBugReport(*BT, os.str(), N);
+    BugReport *Report = new BugReport(*BT, os.str(), N);
     Report->addRange(ArgExpr->getSourceRange());
     C.EmitReport(Report);
     return;
@@ -328,7 +327,7 @@
     if (!N)
       return;
     initBugType();
-    RangedBugReport *Report = new RangedBugReport(*BT,
+    BugReport *Report = new BugReport(*BT,
         "Call to free data when error was returned during allocation.", N);
     Report->addRange(ArgExpr->getSourceRange());
     C.EmitReport(Report);
@@ -406,7 +405,7 @@
 
 // TODO: The report has to mention the expression which contains the
 // allocated content as well as the point at which it has been allocated.
-RangedBugReport *MacOSKeychainAPIChecker::
+BugReport *MacOSKeychainAPIChecker::
   generateAllocatedDataNotReleasedReport(const AllocationState &AS,
                                          ExplodedNode *N) const {
   const ADFunctionInfo &FI = FunctionsToTrack[AS.AllocatorIdx];
@@ -415,7 +414,7 @@
   llvm::raw_svector_ostream os(sbuf);
   os << "Allocated data is not released: missing a call to '"
       << FunctionsToTrack[FI.DeallocatorIdx].Name << "'.";
-  RangedBugReport *Report = new RangedBugReport(*BT, os.str(), N);
+  BugReport *Report = new BugReport(*BT, os.str(), N);
   Report->addRange(AS.Address->getSourceRange());
   return Report;
 }

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp Wed Aug 17 18:00:25 2011
@@ -81,7 +81,7 @@
   if (isa<VarRegion>(R) && isa<StackLocalsSpaceRegion>(R->getMemorySpace()))
     os << "  Perhaps you intended to declare the variable as 'static'?";
 
-  RangedBugReport *report = new RangedBugReport(*BT_dispatchOnce, os.str(), N);
+  BugReport *report = new BugReport(*BT_dispatchOnce, os.str(), N);
   report->addRange(CE->getArg(0)->getSourceRange());
   C.EmitReport(report);
 }

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp Wed Aug 17 18:00:25 2011
@@ -484,7 +484,7 @@
         os << "not memory allocated by malloc()";
     }
     
-    EnhancedBugReport *R = new EnhancedBugReport(*BT_BadFree, os.str(), N);
+    BugReport *R = new BugReport(*BT_BadFree, os.str(), N);
     R->addRange(range);
     C.EmitReport(R);
   }

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp Wed Aug 17 18:00:25 2011
@@ -277,7 +277,7 @@
     bug = new NSErrorDerefBug();
   else
     bug = new CFErrorDerefBug();
-  EnhancedBugReport *report = new EnhancedBugReport(*bug, os.str(),
+  BugReport *report = new BugReport(*bug, os.str(),
                                                     event.SinkNode);
   BR.EmitReport(report);
 }

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCAtSyncChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCAtSyncChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCAtSyncChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCAtSyncChecker.cpp Wed Aug 17 18:00:25 2011
@@ -47,8 +47,8 @@
       if (!BT_undef)
         BT_undef.reset(new BuiltinBug("Uninitialized value used as mutex "
                                   "for @synchronized"));
-      EnhancedBugReport *report =
-        new EnhancedBugReport(*BT_undef, BT_undef->getDescription(), N);
+      BugReport *report =
+        new BugReport(*BT_undef, BT_undef->getDescription(), N);
       report->addVisitorCreator(bugreporter::registerTrackNullOrUndefValue, Ex);
       C.EmitReport(report);
     }
@@ -70,8 +70,8 @@
         if (!BT_null)
           BT_null.reset(new BuiltinBug("Nil value used as mutex for @synchronized() "
                                    "(no synchronization will occur)"));
-        EnhancedBugReport *report =
-          new EnhancedBugReport(*BT_null, BT_null->getDescription(), N);
+        BugReport *report =
+          new BugReport(*BT_null, BT_null->getDescription(), N);
         report->addVisitorCreator(bugreporter::registerTrackNullOrUndefValue,
                                   Ex);
 

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp Wed Aug 17 18:00:25 2011
@@ -179,8 +179,8 @@
   if (!N)
     return;
 
-  EnhancedBugReport *report =
-    new EnhancedBugReport(*new InitSelfBug(), errorStr, N);
+  BugReport *report =
+    new BugReport(*new InitSelfBug(), errorStr, N);
   C.EmitReport(report);
 }
 

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp Wed Aug 17 18:00:25 2011
@@ -56,7 +56,7 @@
                             "Pointer arithmetic done on non-array variables "
                             "means reliance on memory layout, which is "
                             "dangerous."));
-      RangedBugReport *R = new RangedBugReport(*BT, BT->getDescription(), N);
+      BugReport *R = new BugReport(*BT, BT->getDescription(), N);
       R->addRange(B->getSourceRange());
       C.EmitReport(R);
     }

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/PointerSubChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/PointerSubChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/PointerSubChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/PointerSubChecker.cpp Wed Aug 17 18:00:25 2011
@@ -64,7 +64,7 @@
       BT.reset(new BuiltinBug("Pointer subtraction", 
                           "Subtraction of two pointers that do not point to "
                           "the same memory chunk may cause incorrect result."));
-    RangedBugReport *R = new RangedBugReport(*BT, BT->getDescription(), N);
+    BugReport *R = new BugReport(*BT, BT->getDescription(), N);
     R->addRange(B->getSourceRange());
     C.EmitReport(R);
   }

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp Wed Aug 17 18:00:25 2011
@@ -117,7 +117,7 @@
     ExplodedNode *N = C.generateSink();
     if (!N)
       return;
-    EnhancedBugReport *report = new EnhancedBugReport(*BT_doublelock,
+    BugReport *report = new BugReport(*BT_doublelock,
                                                       "This lock has already "
                                                       "been acquired", N);
     report->addRange(CE->getArg(0)->getSourceRange());
@@ -181,7 +181,7 @@
     ExplodedNode *N = C.generateSink();
     if (!N)
       return;
-    EnhancedBugReport *report = new EnhancedBugReport(*BT_lor,
+    BugReport *report = new BugReport(*BT_lor,
                                                       "This was not the most "
                                                       "recently acquired lock. "
                                                       "Possible lock order "

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/ReturnPointerRangeChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/ReturnPointerRangeChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/ReturnPointerRangeChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/ReturnPointerRangeChecker.cpp Wed Aug 17 18:00:25 2011
@@ -78,8 +78,8 @@
     // reference is outside the range.
 
     // Generate a report for this bug.
-    RangedBugReport *report = 
-      new RangedBugReport(*BT, BT->getDescription(), N);
+    BugReport *report = 
+      new BugReport(*BT, BT->getDescription(), N);
 
     report->addRange(RetE->getSourceRange());
     C.EmitReport(report);

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/ReturnUndefChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/ReturnUndefChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/ReturnUndefChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/ReturnUndefChecker.cpp Wed Aug 17 18:00:25 2011
@@ -50,8 +50,8 @@
     BT.reset(new BuiltinBug("Garbage return value",
                             "Undefined or garbage value returned to caller"));
     
-  EnhancedBugReport *report = 
-    new EnhancedBugReport(*BT, BT->getDescription(), N);
+  BugReport *report = 
+    new BugReport(*BT, BT->getDescription(), N);
 
   report->addRange(RetE->getSourceRange());
   report->addVisitorCreator(bugreporter::registerTrackNullOrUndefValue, RetE);

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp Wed Aug 17 18:00:25 2011
@@ -99,7 +99,7 @@
   llvm::raw_svector_ostream os(buf);
   SourceRange range = GenName(os, R, C.getSourceManager());
   os << " returned to caller";
-  RangedBugReport *report = new RangedBugReport(*BT_returnstack, os.str(), N);
+  BugReport *report = new BugReport(*BT_returnstack, os.str(), N);
   report->addRange(RetE->getSourceRange());
   if (range.isValid())
     report->addRange(range);
@@ -204,7 +204,7 @@
     const VarRegion *VR = cast<VarRegion>(cb.V[i].first->getBaseRegion());
     os << VR->getDecl()->getNameAsString() 
        << "' upon returning to the caller.  This will be a dangling reference";
-    RangedBugReport *report = new RangedBugReport(*BT_stackleak, os.str(), N);
+    BugReport *report = new BugReport(*BT_stackleak, os.str(), N);
     if (range.isValid())
       report->addRange(range);
 

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp Wed Aug 17 18:00:25 2011
@@ -99,7 +99,7 @@
       Ex = FindIt.FindExpr(Ex);
 
       // Emit the bug report.
-      EnhancedBugReport *R = new EnhancedBugReport(*BT, BT->getDescription(),N);
+      BugReport *R = new BugReport(*BT, BT->getDescription(),N);
       R->addVisitorCreator(bugreporter::registerTrackNullOrUndefValue, Ex);
       R->addRange(Ex->getSourceRange());
 

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp Wed Aug 17 18:00:25 2011
@@ -87,7 +87,7 @@
         os << "Variable '" << VD->getName() 
            << "' is uninitialized when captured by block";
 
-        EnhancedBugReport *R = new EnhancedBugReport(*BT, os.str(), N);
+        BugReport *R = new BugReport(*BT, os.str(), N);
         if (const Expr *Ex = FindBlockDeclRefExpr(BE->getBody(), VD))
           R->addRange(Ex->getSourceRange());
         R->addVisitorCreator(bugreporter::registerFindLastStore, VR);

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp Wed Aug 17 18:00:25 2011
@@ -71,7 +71,7 @@
          << BinaryOperator::getOpcodeStr(B->getOpcode())
          << "' expression is undefined";
     }
-    EnhancedBugReport *report = new EnhancedBugReport(*BT, OS.str(), N);
+    BugReport *report = new BugReport(*BT, OS.str(), N);
     if (Ex) {
       report->addRange(Ex->getSourceRange());
       report->addVisitorCreator(bugreporter::registerTrackNullOrUndefValue, Ex);

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/UndefinedArraySubscriptChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/UndefinedArraySubscriptChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/UndefinedArraySubscriptChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/UndefinedArraySubscriptChecker.cpp Wed Aug 17 18:00:25 2011
@@ -40,7 +40,7 @@
         BT.reset(new BuiltinBug("Array subscript is undefined"));
 
       // Generate a report for this bug.
-      EnhancedBugReport *R = new EnhancedBugReport(*BT, BT->getName(), N);
+      BugReport *R = new BugReport(*BT, BT->getName(), N);
       R->addRange(A->getIdx()->getSourceRange());
       R->addVisitorCreator(bugreporter::registerTrackNullOrUndefValue, 
                            A->getIdx());

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp Wed Aug 17 18:00:25 2011
@@ -74,7 +74,7 @@
     break;
   }
 
-  EnhancedBugReport *R = new EnhancedBugReport(*BT, str, N);
+  BugReport *R = new BugReport(*BT, str, N);
   if (ex) {
     R->addRange(ex->getSourceRange());
     R->addVisitorCreator(bugreporter::registerTrackNullOrUndefValue, ex);

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp Wed Aug 17 18:00:25 2011
@@ -116,8 +116,8 @@
 
     LazyInitialize(BT_open, "Improper use of 'open'");
 
-    RangedBugReport *report =
-      new RangedBugReport(*BT_open,
+    BugReport *report =
+      new BugReport(*BT_open,
                             "Call to 'open' requires a third argument when "
                             "the 'O_CREAT' flag is set", N);
     report->addRange(oflagsEx->getSourceRange());
@@ -163,7 +163,7 @@
 
   LazyInitialize(BT_pthreadOnce, "Improper use of 'pthread_once'");
 
-  RangedBugReport *report = new RangedBugReport(*BT_pthreadOnce, os.str(), N);
+  BugReport *report = new BugReport(*BT_pthreadOnce, os.str(), N);
   report->addRange(CE->getArg(0)->getSourceRange());
   C.EmitReport(report);
 }
@@ -202,8 +202,8 @@
 
     LazyInitialize(BT_mallocZero, "Undefined allocation of 0 bytes");
     
-    EnhancedBugReport *report =
-      new EnhancedBugReport(*BT_mallocZero, "Call to 'malloc' has an allocation"
+    BugReport *report =
+      new BugReport(*BT_mallocZero, "Call to 'malloc' has an allocation"
                                             " size of 0 bytes", N);
     report->addRange(CE->getArg(0)->getSourceRange());
     report->addVisitorCreator(bugreporter::registerTrackNullOrUndefValue,

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp Wed Aug 17 18:00:25 2011
@@ -62,8 +62,8 @@
       BT_undef.reset(new BuiltinBug("Declared variable-length array (VLA) "
                                     "uses a garbage value as its size"));
 
-    EnhancedBugReport *report =
-      new EnhancedBugReport(*BT_undef, BT_undef->getName(), N);
+    BugReport *report =
+      new BugReport(*BT_undef, BT_undef->getName(), N);
     report->addRange(SE->getSourceRange());
     report->addVisitorCreator(bugreporter::registerTrackNullOrUndefValue, SE);
     C.EmitReport(report);
@@ -87,8 +87,8 @@
       BT_zero.reset(new BuiltinBug("Declared variable-length array (VLA) has "
                                    "zero size"));
 
-    EnhancedBugReport *report =
-      new EnhancedBugReport(*BT_zero, BT_zero->getName(), N);
+    BugReport *report =
+      new BugReport(*BT_zero, BT_zero->getName(), N);
     report->addRange(SE->getSourceRange());
     report->addVisitorCreator(bugreporter::registerTrackNullOrUndefValue, SE);
     C.EmitReport(report);

Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp Wed Aug 17 18:00:25 2011
@@ -1221,10 +1221,28 @@
 //===----------------------------------------------------------------------===//
 // Methods for BugReport and subclasses.
 //===----------------------------------------------------------------------===//
+
 BugReport::~BugReport() {}
-RangedBugReport::~RangedBugReport() {}
+
+void BugReport::Profile(llvm::FoldingSetNodeID& hash) const {
+  hash.AddPointer(&BT);
+  hash.AddInteger(getLocation().getRawEncoding());
+  hash.AddString(Description);
+
+  for (SmallVectorImpl<SourceRange>::const_iterator I =
+      Ranges.begin(), E = Ranges.end(); I != E; ++I) {
+    const SourceRange range = *I;
+    if (!range.isValid())
+      continue;
+    hash.AddInteger(range.getBegin().getRawEncoding());
+    hash.AddInteger(range.getEnd().getRawEncoding());
+  }
+}
 
 const Stmt *BugReport::getStmt() const {
+  if (!ErrorNode)
+    return 0;
+
   ProgramPoint ProgP = ErrorNode->getLocation();
   const Stmt *S = NULL;
 
@@ -1279,14 +1297,17 @@
 }
 
 std::pair<BugReport::ranges_iterator, BugReport::ranges_iterator>
-BugReport::getRanges() const {
-  if (const Expr *E = dyn_cast_or_null<Expr>(getStmt())) {
-    R = E->getSourceRange();
-    assert(R.isValid());
-    return std::make_pair(&R, &R+1);
-  }
-  else
-    return std::make_pair(ranges_iterator(), ranges_iterator());
+BugReport::getRanges() {
+    // If no custom ranges, add the range of the statement corresponding to
+    // the error node.
+    if (Ranges.empty()) {
+      if (const Expr *E = dyn_cast_or_null<Expr>(getStmt()))
+        addRange(E->getSourceRange());
+      else
+        return std::make_pair(ranges_iterator(), ranges_iterator());
+    }
+
+    return std::make_pair(Ranges.begin(), Ranges.end());
 }
 
 SourceLocation BugReport::getLocation() const {
@@ -1912,7 +1933,7 @@
   // 'BT' is owned by BugReporter.
   BugType *BT = getBugTypeForName(name, category);
   FullSourceLoc L = getContext().getFullLoc(Loc);
-  RangedBugReport *R = new DiagBugReport(*BT, str, L);
+  BugReport *R = new DiagBugReport(*BT, str, L);
   for ( ; NumRanges > 0 ; --NumRanges, ++RBeg) R->addRange(*RBeg);
   EmitReport(R);
 }

Modified: cfe/trunk/lib/StaticAnalyzer/Core/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/CFRefCount.cpp?rev=137894&r1=137893&r2=137894&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/CFRefCount.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/CFRefCount.cpp Wed Aug 17 18:00:25 2011
@@ -1959,28 +1959,28 @@
   // Bug Reports.  //
   //===---------===//
 
-  class CFRefReport : public RangedBugReport {
+  class CFRefReport : public BugReport {
   protected:
     SymbolRef Sym;
     const CFRefCount &TF;
   public:
     CFRefReport(CFRefBug& D, const CFRefCount &tf,
                 ExplodedNode *n, SymbolRef sym)
-      : RangedBugReport(D, D.getDescription(), n), Sym(sym), TF(tf) {}
+      : BugReport(D, D.getDescription(), n), Sym(sym), TF(tf) {}
 
     CFRefReport(CFRefBug& D, const CFRefCount &tf,
                 ExplodedNode *n, SymbolRef sym, StringRef endText)
-      : RangedBugReport(D, D.getDescription(), endText, n), Sym(sym), TF(tf) {}
+      : BugReport(D, D.getDescription(), endText, n), Sym(sym), TF(tf) {}
 
     virtual ~CFRefReport() {}
 
     CFRefBug& getBugType() const {
-      return (CFRefBug&) RangedBugReport::getBugType();
+      return (CFRefBug&) BugReport::getBugType();
     }
 
-    virtual std::pair<ranges_iterator, ranges_iterator> getRanges() const {
+    virtual std::pair<ranges_iterator, ranges_iterator> getRanges() {
       if (!getBugType().isLeak())
-        return RangedBugReport::getRanges();
+        return BugReport::getRanges();
       else
         return std::make_pair(ranges_iterator(), ranges_iterator());
     }
@@ -2368,7 +2368,7 @@
   // Tell the BugReporterContext to report cases when the tracked symbol is
   // assigned to different variables, etc.
   BRC.addNotableSymbol(Sym);
-  return RangedBugReport::getEndPath(BRC, EndN);
+  return BugReport::getEndPath(BRC, EndN);
 }
 
 PathDiagnosticPiece*





More information about the cfe-commits mailing list