Skip to content

Commit bb4d90f

Browse files
authored
Merge pull request #9667 from bitjammer/rdar-32213595-migrator-fixitapply-invalid-sourceloc
[Migrator] FixitApplyDiagnosticConsumer: Ignore diags with invalid So…
2 parents cc389eb + 43094c6 commit bb4d90f

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/Migrator/FixitApplyDiagnosticConsumer.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ handleDiagnostic(SourceManager &SM, SourceLoc Loc,
3737
StringRef FormatString,
3838
ArrayRef<DiagnosticArgument> FormatArgs,
3939
const DiagnosticInfo &Info) {
40+
if (Loc.isInvalid()) {
41+
return;
42+
}
4043
auto ThisBufferID = SM.findBufferContainingLoc(Loc);
4144
auto ThisBufferName = SM.getIdentifierForBuffer(ThisBufferID);
4245
if (ThisBufferName != BufferName) {

test/Migrator/invalid_sourceloc.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// REQUIRES: objc_interop
2+
// RUN: rm -rf %t && mkdir -p %t && not %swift -c -update-code -primary-file %s -emit-migrated-file-path %t/api-special-cases.swift.result -emit-remap-file-path %t/api-special-cases.swift.remap -o /dev/null
3+
4+
// A failed import due to a missing -sdk frontend argument produces a
5+
// diagnostic with an invalid sourceloc.
6+
import CoreGraphics

0 commit comments

Comments
 (0)