Skip to content

Commit 1f623f6

Browse files
committed
[SourceKit] Bug fixes in 'compile'
* Diagnostics consumer wasn't attached in new compilation * The reuse flag check was flipped
1 parent e775d85 commit 1f623f6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/IDE/CompileInstance.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ void CompileInstance::performSema(
294294
if (CI && ArgsHash == CachedArgHash &&
295295
CachedReuseCount < Opts.MaxASTReuseCount) {
296296
CI->getASTContext().CancellationFlag = CancellationFlag;
297-
if (performCachedSemaIfPossible(DiagC)) {
297+
if (!performCachedSemaIfPossible(DiagC)) {
298298
// If we compileted cacehd Sema operation. We're done.
299299
++CachedReuseCount;
300300
return;
@@ -312,6 +312,9 @@ void CompileInstance::performSema(
312312
return;
313313
}
314314

315+
CI->addDiagnosticConsumer(DiagC);
316+
SWIFT_DEFER { CI->removeDiagnosticConsumer(DiagC); };
317+
315318
// CI is potentially reusable.
316319
CachedArgHash = ArgsHash;
317320

0 commit comments

Comments
 (0)