The path seperator is hardcoded in MCDwarf.cpp:649 as '/'. This is worng on
Windows.

A patch to use the correct path seperator is attached. I had to expose
the path seperator from llvm::sys::path.

Yaron
Index: include/llvm/Support/Path.h
===================================================================
--- include/llvm/Support/Path.h (revision 203906)
+++ include/llvm/Support/Path.h (working copy)
@@ -165,6 +165,10 @@
 /// @name Transforms (or some other better name)
 /// @{
 
+/// Return the preferred separator for this platform, null-terminated.
+///
+const char *get_preferred_separator();
+
 /// Convert path to the native form. This is used to give paths to users and
 /// operating system calls in the platform's normal way. For example, on 
Windows
 /// all '/' are converted to '\'.
Index: lib/Support/Path.cpp
===================================================================
--- lib/Support/Path.cpp        (revision 203906)
+++ lib/Support/Path.cpp        (working copy)
@@ -513,6 +513,12 @@
   path.append(ext.begin(), ext.end());
 }
 
+static const char preferred_separator_string[] = { preferred_separator, '\0' };
+
+const char *get_preferred_separator() {
+  return preferred_separator_string;
+}
+
 void native(const Twine &path, SmallVectorImpl<char> &result) {
   assert((!path.isSingleStringRef() ||
           path.getSingleStringRef().data() != result.data()) &&
Index: lib/MC/MCDwarf.cpp
===================================================================
--- lib/MC/MCDwarf.cpp  (revision 203906)
+++ lib/MC/MCDwarf.cpp  (working copy)
@@ -659,7 +659,7 @@
   const SmallVectorImpl<std::string> &MCDwarfDirs = context.getMCDwarfDirs();
   if (MCDwarfDirs.size() > 0) {
     MCOS->EmitBytes(MCDwarfDirs[0]);
-    MCOS->EmitBytes("/");
+    MCOS->EmitBytes(sys::path::get_preferred_separator());
   }
   const SmallVectorImpl<MCDwarfFile> &MCDwarfFiles =
     MCOS->getContext().getMCDwarfFiles();
_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to