Skip to content

Commit 45f65b9

Browse files
authored
Merge pull request #40962 from rintaro/sourcekit-compile-rdar86809003
[SourceKit] Ignore LLVM arguments in 'compile' request
2 parents 4253c2c + 1f623f6 commit 45f65b9

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

lib/IDE/CompileInstance.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff 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

test/SourceKit/Compile/basic.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// REQUIRES: rdar86809003
2-
31
// RUN: %empty-directory(%t)
42
// RUN: %empty-directory(%t/out)
53
// RUN: split-file %s %t

0 commit comments

Comments
 (0)