summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2013-05-03 22:58:43 +0000
committerDouglas Gregor <dgregor@apple.com>2013-05-03 22:58:43 +0000
commit6b930967e88029e9c7ce1b1c4234042b5983ad63 (patch)
treea222ecff1ec495a9578e294ba8363c778a51b36a /clang/lib/Frontend/CompilerInstance.cpp
parentb2a1cb87b1df6bb1881e5da1cd590d241f9807b6 (diff)
downloadbcm5719-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/CompilerInstance.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index df06a816e84..027e99a29d4 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -868,9 +868,11 @@ static void compileModule(CompilerInstance &ImportingInstance,
// module.
CompilerInstance Instance;
Instance.setInvocation(&*Invocation);
- Instance.createDiagnostics(&ImportingInstance.getDiagnosticClient(),
+
+ Instance.createDiagnostics(new ForwardingDiagnosticConsumer(
+ ImportingInstance.getDiagnosticClient()),
/*ShouldOwnClient=*/true,
- /*ShouldCloneClient=*/true);
+ /*ShouldCloneClient=*/false);
// Note that this module is part of the module build stack, so that we
// can detect cycles in the module graph.
@@ -892,6 +894,7 @@ static void compileModule(CompilerInstance &ImportingInstance,
llvm::CrashRecoveryContext CRC;
CompileModuleMapData Data = { Instance, CreateModuleAction };
CRC.RunSafelyOnThread(&doCompileMapModule, &Data, ThreadStackSize);
+
// Delete the temporary module map file.
// FIXME: Even though we're executing under crash protection, it would still
OpenPOWER on IntegriCloud