diff options
author | Douglas Gregor <dgregor@apple.com> | 2013-05-03 22:58:43 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2013-05-03 22:58:43 +0000 |
commit | 6b930967e88029e9c7ce1b1c4234042b5983ad63 (patch) | |
tree | a222ecff1ec495a9578e294ba8363c778a51b36a /clang/lib/Frontend/ASTMerge.cpp | |
parent | b2a1cb87b1df6bb1881e5da1cd590d241f9807b6 (diff) | |
download | bcm5719-llvm-6b930967e88029e9c7ce1b1c4234042b5983ad63.tar.gz bcm5719-llvm-6b930967e88029e9c7ce1b1c4234042b5983ad63.zip |
When building a module, forward diagnostics to the outer diagnostic consumer.
Previously, we would clone the current diagnostic consumer to produce
a new diagnostic consumer to use when building a module. The problem
here is that we end up losing diagnostics for important diagnostic
consumers, such as serialized diagnostics (where we'd end up with two
diagnostic consumers writing the same output file). With forwarding,
the diagnostics from all of the different modules being built get
forwarded to the one serialized-diagnostic consumer and are emitted in
a sane way.
Fixes <rdar://problem/13663996>.
llvm-svn: 181067
Diffstat (limited to 'clang/lib/Frontend/ASTMerge.cpp')
-rw-r--r-- | clang/lib/Frontend/ASTMerge.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Frontend/ASTMerge.cpp b/clang/lib/Frontend/ASTMerge.cpp index bfb30836d81..b6c644eba78 100644 --- a/clang/lib/Frontend/ASTMerge.cpp +++ b/clang/lib/Frontend/ASTMerge.cpp @@ -34,7 +34,7 @@ bool ASTMergeAction::BeginSourceFileAction(CompilerInstance &CI, void ASTMergeAction::ExecuteAction() { CompilerInstance &CI = getCompilerInstance(); CI.getDiagnostics().getClient()->BeginSourceFile( - CI.getASTContext().getLangOpts()); + CI.getASTContext().getLangOpts()); CI.getDiagnostics().SetArgToStringFn(&FormatASTNodeDiagnosticArgument, &CI.getASTContext()); IntrusiveRefCntPtr<DiagnosticIDs> @@ -42,8 +42,9 @@ void ASTMergeAction::ExecuteAction() { for (unsigned I = 0, N = ASTFiles.size(); I != N; ++I) { IntrusiveRefCntPtr<DiagnosticsEngine> Diags(new DiagnosticsEngine(DiagIDs, &CI.getDiagnosticOpts(), - CI.getDiagnostics().getClient(), - /*ShouldOwnClient=*/false)); + new ForwardingDiagnosticConsumer( + *CI.getDiagnostics().getClient()), + /*ShouldOwnClient=*/true)); ASTUnit *Unit = ASTUnit::LoadFromASTFile(ASTFiles[I], Diags, CI.getFileSystemOpts(), false); if (!Unit) |