Skip to content

Commit 7718c55

Browse files
committed
[TableGen] only transform dependency filename on Windows
1 parent 17cf52b commit 7718c55

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

llvm/lib/TableGen/Main.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,15 @@ static std::string escapeDependencyFilename(StringRef Filename) {
9191
std::string Res;
9292
raw_string_ostream OS(Res);
9393

94+
// Only transform the path to native on Windows, where backslashes are valid
95+
// path separators. On non-Windows platforms, we don't want backslashes in
96+
// filenames to be incorrectly treated as path separators.
97+
#ifdef _WIN32
9498
SmallString<256> NativePath;
9599
sys::path::native(Filename, NativePath);
100+
#else
101+
StringRef NativePath = Filename;
102+
#endif
96103

97104
for (unsigned I = 0, E = NativePath.size(); I != E; ++I) {
98105
if (NativePath[I] == '#')

0 commit comments

Comments
 (0)