From: Artem Dergachev Date: Fri, 7 Oct 2016 17:12:05 +0000 (+0000) Subject: [analyzer] Re-apply r283092, attempt no.4, chunk no.3. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=327a87198af404c50f61c2fbb7c4b09fd4ee7821;p=clang [analyzer] Re-apply r283092, attempt no.4, chunk no.3. 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 --- diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h index 7bcdef6622..2d14bdf0bf 100644 --- a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h +++ b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h @@ -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 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.