File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -67,11 +67,17 @@ SourceLoc ClangSourceBufferImporter::resolveSourceLocation(
6767
6868 StringRef presumedFile = presumedLoc.getFilename ();
6969 SourceLoc startOfLine = loc.getAdvancedLoc (-presumedLoc.getColumn () + 1 );
70- bool isNewVirtualFile = swiftSourceManager.openVirtualFile (
71- startOfLine, presumedFile, presumedLoc.getLine () - bufferLineNumber);
72- if (isNewVirtualFile) {
73- SourceLoc endOfLine = findEndOfLine (swiftSourceManager, loc, mirrorID);
74- swiftSourceManager.closeVirtualFile (endOfLine);
70+
71+ // FIXME: Virtual files can't actually model the EOF position correctly, so
72+ // if this virtual file would start at EOF, just hope the physical location
73+ // will do.
74+ if (startOfLine != swiftSourceManager.getRangeForBuffer (mirrorID).getEnd ()) {
75+ bool isNewVirtualFile = swiftSourceManager.openVirtualFile (
76+ startOfLine, presumedFile, presumedLoc.getLine () - bufferLineNumber);
77+ if (isNewVirtualFile) {
78+ SourceLoc endOfLine = findEndOfLine (swiftSourceManager, loc, mirrorID);
79+ swiftSourceManager.closeVirtualFile (endOfLine);
80+ }
7581 }
7682
7783 using SourceManagerRef = llvm::IntrusiveRefCntPtr<const clang::SourceManager>;
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ import Module
3737// CHECK-PRIMARY: diags_from_module.swift:[[@LINE-4]]:8: error: could not build Objective-C module 'Module'
3838
3939// CHECK-WARN: Sub2.h:7:2: warning: here is some warning about something
40- // CHECK-WARN: <module-includes>:1 :1: warning: umbrella header for module 'Module' does not include header 'NotInModule.h'
40+ // CHECK-WARN: Module.h:20 :1: warning: umbrella header for module 'Module' does not include header 'NotInModule.h'
4141// FIXME: show [-Wincomplete-umbrella]
4242
4343// CHECK-NO-WARN-NOT: warning about something
You can’t perform that action at this time.
0 commit comments