summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/MC/MCContext.cpp')
-rw-r--r--llvm/lib/MC/MCContext.cpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index b601ab24434..606da252689 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/lib/MC/MCContext.cpp
@@ -540,19 +540,26 @@ void MCContext::addDebugPrefixMapEntry(const std::string &From,
DebugPrefixMap.insert(std::make_pair(From, To));
}
-void MCContext::RemapDebugPath(std::string *Path) {
- for (const auto &Entry : DebugPrefixMap)
- if (StringRef(*Path).startswith(Entry.first)) {
- std::string RemappedPath =
- (Twine(Entry.second) + Path->substr(Entry.first.size())).str();
- Path->swap(RemappedPath);
- }
-}
-
-void MCContext::RemapCompilationDir() {
+void MCContext::RemapDebugPaths() {
+ const auto &DebugPrefixMap = this->DebugPrefixMap;
+ const auto RemapDebugPath = [&DebugPrefixMap](std::string &Path) {
+ for (const auto &Entry : DebugPrefixMap)
+ if (StringRef(Path).startswith(Entry.first)) {
+ std::string RemappedPath =
+ (Twine(Entry.second) + Path.substr(Entry.first.size())).str();
+ Path.swap(RemappedPath);
+ }
+ };
+
+ // Remap compilation directory.
std::string CompDir = CompilationDir.str();
- RemapDebugPath(&CompDir);
+ RemapDebugPath(CompDir);
CompilationDir = CompDir;
+
+ // Remap MCDwarfDirs in all compilation units.
+ for (auto &CUIDTablePair : MCDwarfLineTablesCUMap)
+ for (auto &Dir : CUIDTablePair.second.getMCDwarfDirs())
+ RemapDebugPath(Dir);
}
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud