File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -263,6 +263,11 @@ bool CompileInstance::setupCI(
263263 return false ;
264264 }
265265
266+ // Since LLVM arguments are parsed into a global state, LLVM can't handle
267+ // multiple argument sets in a process simultaneously. So let's ignore them.
268+ // FIXME: Remove this if possible.
269+ invocation.getFrontendOptions ().LLVMArgs .clear ();
270+
266271 // / Declare the frontend to be used for multiple compilations.
267272 invocation.getFrontendOptions ().ReuseFrontendForMutipleCompilations = true ;
268273
@@ -289,7 +294,7 @@ void CompileInstance::performSema(
289294 if (CI && ArgsHash == CachedArgHash &&
290295 CachedReuseCount < Opts.MaxASTReuseCount ) {
291296 CI->getASTContext ().CancellationFlag = CancellationFlag;
292- if (performCachedSemaIfPossible (DiagC)) {
297+ if (! performCachedSemaIfPossible (DiagC)) {
293298 // If we compileted cacehd Sema operation. We're done.
294299 ++CachedReuseCount;
295300 return ;
@@ -307,6 +312,9 @@ void CompileInstance::performSema(
307312 return ;
308313 }
309314
315+ CI->addDiagnosticConsumer (DiagC);
316+ SWIFT_DEFER { CI->removeDiagnosticConsumer (DiagC); };
317+
310318 // CI is potentially reusable.
311319 CachedArgHash = ArgsHash;
312320
Original file line number Diff line number Diff line change 1- // REQUIRES: rdar86809003
2-
31// RUN: %empty-directory(%t)
42// RUN: %empty-directory(%t/out)
53// RUN: split-file %s %t
You can’t perform that action at this time.
0 commit comments