Skip to content

Commit 246bb41

Browse files
authored
Merge pull request swiftlang#37130 from bnbarham/do-not-abs-presumed
[Serialization] Do not absolute path the serialized line directive
2 parents d5808b0 + 2f29cbe commit 246bb41

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

lib/Serialization/SerializeDoc.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -619,10 +619,7 @@ static void writeRawLoc(const ExternalSourceLocs::RawLoc &Loc,
619619
Writer.write<uint32_t>(Loc.Directive.Offset);
620620
Writer.write<int32_t>(Loc.Directive.LineOffset);
621621
Writer.write<uint32_t>(Loc.Directive.Length);
622-
llvm::SmallString<128> AbsName = Loc.Directive.Name;
623-
if (!AbsName.empty())
624-
llvm::sys::fs::make_absolute(AbsName);
625-
Writer.write<uint32_t>(Strings.getTextOffset(AbsName.str()));
622+
Writer.write<uint32_t>(Strings.getTextOffset(Loc.Directive.Name));
626623
}
627624

628625
/**

test/diagnostics/multi-module-diagnostics.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@ open class ParentClass {
33
open func overridableMethodA(param: Int) {}
44
open func overridableMethodB(param: Int) {}
55
open func overridableMethodC(param: Int) {}
6+
open func overridableMethodD(param: Int) {}
67
}
78
#endif
89

910
#if MODA_LOC
1011
open class ParentClass {
1112
#sourceLocation(file: "doesnotexist.swift", line: 10)
1213
open func overridableMethodA(param: Int) {}
13-
#sourceLocation(file: "REPLACEDWITHSED", line: 20)
1414
open func overridableMethodB(param: Int) {}
15+
#sourceLocation(file: "REPLACEDWITHSED", line: 20)
1516
open func overridableMethodC(param: Int) {}
17+
open func overridableMethodD(param: Int) {}
1618
#sourceLocation()
1719
}
1820
#endif
@@ -24,6 +26,7 @@ open class SubClass: ParentClass {
2426
open override func overridableMethodA(param: String) {}
2527
open override func overridableMethodB(param: String) {}
2628
open override func overridableMethodC(param: String) {}
29+
open override func overridableMethodD(param: String) {}
2730
}
2831
#endif
2932

@@ -41,6 +44,7 @@ open class SubClass: ParentClass {
4144
// CHECK-EXISTS: moda.swift:3:13: note
4245
// CHECK-EXISTS: moda.swift:4:13: note
4346
// CHECK-EXISTS: moda.swift:5:13: note
47+
// CHECK-EXISTS: moda.swift:6:13: note
4448

4549
// Removed the underlying file, so should use the generated source instead
4650
// RUN: mv %t/moda.swift %t/moda.swift-moved
@@ -65,7 +69,8 @@ open class SubClass: ParentClass {
6569

6670
// RUN: cp %t/moda.swift %t/alternative.swift
6771
// RUN: not %target-swift-frontend -typecheck -I %t/mods -D MODB %s 2>&1 | %FileCheck -check-prefix=CHECK-DIRECTIVE %s
68-
// CHECK-DIRECTIVE: doesnotexist.swift:10:13: note
72+
// CHECK-DIRECTIVE: {{^}}doesnotexist.swift:10:13: note
73+
// CHECK-DIRECTIVE: {{^}}doesnotexist.swift:11:13: note
6974
// CHECK-DIRECTIVE: alternative.swift:20:13: note
7075
// CHECK-DIRECTIVE: alternative.swift:21:13: note
7176

0 commit comments

Comments
 (0)