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(
67
67
68
68
StringRef presumedFile = presumedLoc.getFilename ();
69
69
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
+ }
75
81
}
76
82
77
83
using SourceManagerRef = llvm::IntrusiveRefCntPtr<const clang::SourceManager>;
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ import Module
37
37
// CHECK-PRIMARY: diags_from_module.swift:[[@LINE-4]]:8: error: could not build Objective-C module 'Module'
38
38
39
39
// 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'
41
41
// FIXME: show [-Wincomplete-umbrella]
42
42
43
43
// CHECK-NO-WARN-NOT: warning about something
You can’t perform that action at this time.
0 commit comments