mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-15 04:29:42 +00:00
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.
This commit is contained in:
parent
df773ebb5f
commit
3bb24bf257
@ -476,12 +476,10 @@ CGDebugInfo::createFile(StringRef FileName,
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -1456,10 +1456,10 @@ static void remapMacroPath(
|
||||
const std::map<std::string, std::string, std::greater<std::string>>
|
||||
&MacroPrefixMap) {
|
||||
for (const auto &Entry : MacroPrefixMap)
|
||||
if (llvm::sys::path::replace_path_prefix(Path, Entry.first, Entry.second,
|
||||
llvm::sys::path::Style::native,
|
||||
true))
|
||||
if (Path.startswith(Entry.first)) {
|
||||
Path = (Twine(Entry.second) + Path.substr(Entry.first.size())).str();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// ExpandBuiltinMacro - If an identifier token is read that is to be expanded
|
||||
|
@ -19,21 +19,21 @@ void test_rewrite_includes() {
|
||||
}
|
||||
|
||||
// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: "/UNLIKELY_PATH/empty{{/|\\\\}}<stdin>"
|
||||
// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: "/UNLIKELY_PATH/empty{{[/\\]}}{{.*}}",
|
||||
// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: "/UNLIKELY_PATH/empty{{/|\\\\}}{{.*}}",
|
||||
// On POSIX systems "Dir" should actually be empty, but on Windows we
|
||||
// can't recognize "/UNLIKELY_PATH" as being an absolute path.
|
||||
// CHECK-NO-MAIN-FILE-NAME-SAME: directory: "{{()|(.*:.*)}}")
|
||||
// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: "/UNLIKELY_PATH/empty{{[/\\]}}Inputs/stdio.h",
|
||||
// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: "/UNLIKELY_PATH/empty{{/|\\\\}}Inputs/stdio.h",
|
||||
// CHECK-NO-MAIN-FILE-NAME-SAME: directory: "{{()|(.*:.*)}}")
|
||||
// CHECK-NO-MAIN-FILE-NAME-NOT: !DIFile(filename:
|
||||
|
||||
// CHECK-EVIL: !DIFile(filename: "/UNLIKELY_PATH=empty{{[/\\]}}{{.*}}"
|
||||
// CHECK-EVIL: !DIFile(filename: "/UNLIKELY_PATH=empty{{[/\\]}}{{.*}}Inputs/stdio.h",
|
||||
// CHECK-EVIL: !DIFile(filename: "/UNLIKELY_PATH=empty{{/|\\\\}}{{.*}}"
|
||||
// CHECK-EVIL: !DIFile(filename: "/UNLIKELY_PATH=empty{{/|\\\\}}{{.*}}Inputs/stdio.h",
|
||||
// CHECK-EVIL-SAME: directory: "{{()|(.*:.*)}}")
|
||||
// CHECK-EVIL-NOT: !DIFile(filename:
|
||||
|
||||
// CHECK: !DIFile(filename: "/UNLIKELY_PATH/empty{{[/\\]}}{{.*}}"
|
||||
// CHECK: !DIFile(filename: "/UNLIKELY_PATH/empty{{[/\\]}}{{.*}}Inputs/stdio.h",
|
||||
// CHECK: !DIFile(filename: "/UNLIKELY_PATH/empty{{/|\\\\}}{{.*}}"
|
||||
// CHECK: !DIFile(filename: "/UNLIKELY_PATH/empty{{/|\\\\}}{{.*}}Inputs/stdio.h",
|
||||
// CHECK-SAME: directory: "{{()|(.*:.*)}}")
|
||||
// CHECK-NOT: !DIFile(filename:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user