Fix tests on Windows after D49466
It is tricky to use replace_path_prefix correctly on Windows which uses
backslashes as native path separators. Switch back to the old approach
(startswith is not ideal) to appease build bots for now.
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 282a8e4..db5893a 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -476,12 +476,10 @@
}
std::string CGDebugInfo::remapDIPath(StringRef Path) const {
- SmallString<256> p = Path;
for (const auto &Entry : DebugPrefixMap)
- if (llvm::sys::path::replace_path_prefix(
- p, Entry.first, Entry.second, llvm::sys::path::Style::native, true))
- break;
- return p.str();
+ if (Path.startswith(Entry.first))
+ return (Twine(Entry.second) + Path.substr(Entry.first.size())).str();
+ return Path.str();
}
unsigned CGDebugInfo::getLineNumber(SourceLocation Loc) {