]> granicus.if.org Git - clang/commitdiff
[analyzer] Re-apply r283092, attempt no.4, chunk no.3.
authorArtem Dergachev <artem.dergachev@gmail.com>
Fri, 7 Oct 2016 17:12:05 +0000 (17:12 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Fri, 7 Oct 2016 17:12:05 +0000 (17:12 +0000)
This is the primary suspect for causing the msvc crash, now that vector of
smart pointers was proven to be safe. Probably the default {}-initializer
is the problem.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283573 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h

index 7bcdef66229db596d12f15eb72eaae6894987314..2d14bdf0bf83c33893923fec4449492d5351b682 100644 (file)
@@ -248,7 +248,23 @@ public:
   void setDeclWithIssue(const Decl *declWithIssue) {
     DeclWithIssue = declWithIssue;
   }
-  
+
+  /// Add new item to the list of additional notes that need to be attached to
+  /// this path-insensitive report. If you want to add extra notes to a
+  /// path-sensitive report, you need to use a BugReporterVisitor because it
+  /// allows you to specify where exactly in the auto-generated path diagnostic
+  /// the extra note should appear.
+  void addNote(StringRef Msg, const PathDiagnosticLocation &Pos,
+                    ArrayRef<SourceRange> Ranges = {}) {
+    PathDiagnosticNotePiece *P =
+        new PathDiagnosticNotePiece(Pos, Msg);
+
+    for (const auto &R : Ranges)
+      P->addRange(R);
+
+    Notes.push_back(P);
+  }
+
   /// \brief This allows for addition of meta data to the diagnostic.
   ///
   /// Currently, only the HTMLDiagnosticClient knows how to display it.