LLVMReactorDebugInfo: fix location filename always "<unknown>" on Windows
This filename is output in the emitted asm files when
ENABLE_RR_EMIT_ASM_FILE is enabled, but on Windows, it was always
"<unknown>". Fixed this by splitting out the name by backslash as well.
Bug: b/174358505
Change-Id: Ie5386fa50fd8a6aa43a48bc6fa5fcf987936aacf
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/51750
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Reactor/LLVMReactorDebugInfo.cpp b/src/Reactor/LLVMReactorDebugInfo.cpp
index 120a43a..d2ea6767 100644
--- a/src/Reactor/LLVMReactorDebugInfo.cpp
+++ b/src/Reactor/LLVMReactorDebugInfo.cpp
@@ -56,7 +56,11 @@
std::pair<llvm::StringRef, llvm::StringRef> splitPath(const char *path)
{
- auto dirAndFile = llvm::StringRef(path).rsplit('/');
+# ifdef _WIN32
+ auto dirAndFile = llvm::StringRef(path).rsplit('\\');
+# else
+ auto dirAndFile = llvm::StringRef(path).rsplit('/');
+# endif
if(dirAndFile.second == "")
{
dirAndFile.second = "<unknown>";