[DebugInfo] [PDB] Force injected source paths to use backslashes
authorMartin Storsjö <martin@martin.st>
Thu, 7 Oct 2021 10:36:46 +0000 (10:36 +0000)
committerMartin Storsjö <martin@martin.st>
Fri, 5 Nov 2021 19:50:42 +0000 (21:50 +0200)
This fixes lld/COFF/pdb-natvis.test (which only is run on Windows)
when using paths with forward slashes on Windows.

Differential Revision: https://reviews.llvm.org/D113265

llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp

index a508f16..f331254 100644 (file)
@@ -103,7 +103,7 @@ void PDBFileBuilder::addInjectedSource(StringRef Name,
   // table and the hash value is dependent on the exact contents of the string.
   // link.exe lowercases a path and converts / to \, so we must do the same.
   SmallString<64> VName;
-  sys::path::native(Name.lower(), VName);
+  sys::path::native(Name.lower(), VName, sys::path::Style::windows_backslash);
 
   uint32_t NI = getStringTableBuilder().insert(Name);
   uint32_t VNI = getStringTableBuilder().insert(VName);