summaryrefslogtreecommitdiffstats
path: root/clang/include
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2014-11-13 13:08:27 +0000
committerAlexander Kornienko <alexfh@google.com>2014-11-13 13:08:27 +0000
commit254b7dba27abf991a99df4c4cc12fa88d9b3905f (patch)
tree7b6a54d42764e1ce18aeb53a20ce759ab0bef74f /clang/include
parentd5e95b57e033ee5bc91e2da3116879ef3a1a0581 (diff)
downloadbcm5719-llvm-254b7dba27abf991a99df4c4cc12fa88d9b3905f.tar.gz
bcm5719-llvm-254b7dba27abf991a99df4c4cc12fa88d9b3905f.zip
Support non-owned DiagnosticConsumer in SetupSerializedDiagnostics
This fixes an assertion when running clang-tidy on a file having --serialize-diagnostics in compiler options. Committing a regression test for clang-tidy separately. Patch by Aaron Wishnick! llvm-svn: 221884
Diffstat (limited to 'clang/include')
-rw-r--r--clang/include/clang/Frontend/ChainedDiagnosticConsumer.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/clang/include/clang/Frontend/ChainedDiagnosticConsumer.h b/clang/include/clang/Frontend/ChainedDiagnosticConsumer.h
index 372b381cff6..eb33273c2fb 100644
--- a/clang/include/clang/Frontend/ChainedDiagnosticConsumer.h
+++ b/clang/include/clang/Frontend/ChainedDiagnosticConsumer.h
@@ -22,13 +22,20 @@ class LangOptions;
/// diagnostics should be included in counts.
class ChainedDiagnosticConsumer : public DiagnosticConsumer {
virtual void anchor();
- std::unique_ptr<DiagnosticConsumer> Primary;
+ std::unique_ptr<DiagnosticConsumer> OwningPrimary;
+ DiagnosticConsumer *Primary;
std::unique_ptr<DiagnosticConsumer> Secondary;
public:
ChainedDiagnosticConsumer(std::unique_ptr<DiagnosticConsumer> Primary,
std::unique_ptr<DiagnosticConsumer> Secondary)
- : Primary(std::move(Primary)), Secondary(std::move(Secondary)) {}
+ : OwningPrimary(std::move(Primary)), Primary(OwningPrimary.get()),
+ Secondary(std::move(Secondary)) {}
+
+ /// \brief Construct without taking ownership of \c Primary.
+ ChainedDiagnosticConsumer(DiagnosticConsumer *Primary,
+ std::unique_ptr<DiagnosticConsumer> Secondary)
+ : Primary(Primary), Secondary(std::move(Secondary)) {}
void BeginSourceFile(const LangOptions &LO,
const Preprocessor *PP) override {
OpenPOWER on IntegriCloud