Skip to content

Commit 2a5440f

Browse files
authored
Merge pull request #23660 from DavidGoldman/swift-5.0-branch
Add DebugPrefixMap remapping back to module creation
2 parents 1b0d7e8 + f1514c5 commit 2a5440f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,9 +567,11 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
567567
if (Val != DIModuleCache.end())
568568
return cast<llvm::DIModule>(Val->second);
569569

570+
std::string RemappedIncludePath = DebugPrefixMap.remapPath(IncludePath);
570571
StringRef Sysroot = IGM.Context.SearchPathOpts.SDKPath;
571572
llvm::DIModule *M =
572-
DBuilder.createModule(Parent, Name, ConfigMacros, IncludePath, Sysroot);
573+
DBuilder.createModule(Parent, Name, ConfigMacros, RemappedIncludePath,
574+
Sysroot);
573575
DIModuleCache.insert({Key, llvm::TrackingMDNodeRef(M)});
574576
return M;
575577
}

test/DebugInfo/debug_prefix_map.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
// RUN: %swiftc_driver -g -debug-prefix-map %S=/var/empty %s -emit-ir -o - | %FileCheck %s
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend -emit-module-path %t/Globals.swiftmodule %S/Globals.swift
3+
// RUN: %target-swiftc_driver -g -debug-prefix-map %/S=/var/empty -debug-prefix-map %t=/var/empty %/s -I %t -emit-ir -o - | %FileCheck %s
4+
5+
import Globals
26

37
func square(_ n: Int) -> Int {
48
return n * n
59
}
610

711
// CHECK: !DIFile(filename: "/var/empty/debug_prefix_map.swift"
12+
// CHECK: !DIModule(scope: null, name: "Globals", includePath: "/var/empty/Globals.swiftmodule"

0 commit comments

Comments
 (0)