[llvm-commits] [llvm] r50960 - in /llvm/trunk: include/llvm/System/Path.h lib/System/Unix/Path.inc lib/System/Win32/Path.inc

Nick Lewycky nicholas at mxc.ca
Sun May 11 10:37:40 PDT 2008


Author: nicholas
Date: Sun May 11 12:37:40 2008
New Revision: 50960

URL: http://llvm.org/viewvc/llvm-project?rev=50960&view=rev
Log:
Make constructors target-specific. This fixes problems where the path would
include backslashes on Windows. This should fix llvm-ld problems on win32.

Modified:
    llvm/trunk/include/llvm/System/Path.h
    llvm/trunk/lib/System/Unix/Path.inc
    llvm/trunk/lib/System/Win32/Path.inc

Modified: llvm/trunk/include/llvm/System/Path.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Path.h?rev=50960&r1=50959&r2=50960&view=diff

==============================================================================
--- llvm/trunk/include/llvm/System/Path.h (original)
+++ llvm/trunk/include/llvm/System/Path.h Sun May 11 12:37:40 2008
@@ -180,7 +180,7 @@
       /// of the path, use the isValid method.
       /// @param p The path to assign.
       /// @brief Construct a Path from a string.
-      explicit Path(const std::string& p) : path(p) {}
+      explicit Path(const std::string& p);
 
       /// This constructor will accept a character range as a path.  No checking
       /// is done on this path to determine if it is valid.  To determine
@@ -188,8 +188,7 @@
       /// @param StrStart A pointer to the first character of the path name
       /// @param StrLen The length of the path name at StrStart
       /// @brief Construct a Path from a string.
-      explicit Path(const char *StrStart, unsigned StrLen)
-        : path(StrStart, StrStart+StrLen) {}
+      Path(const char *StrStart, unsigned StrLen);
 
     /// @}
     /// @name Operators

Modified: llvm/trunk/lib/System/Unix/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Path.inc?rev=50960&r1=50959&r2=50960&view=diff

==============================================================================
--- llvm/trunk/lib/System/Unix/Path.inc (original)
+++ llvm/trunk/lib/System/Unix/Path.inc Sun May 11 12:37:40 2008
@@ -75,6 +75,12 @@
 
 extern const char sys::PathSeparator = ':';
 
+Path::Path(const std::string& p)
+  : path(p) {}
+
+Path::Path(const char *StrStart, unsigned StrLen)
+  : path(StrStart, StrLen) {}
+
 bool 
 Path::isValid() const {
   // Check some obvious things

Modified: llvm/trunk/lib/System/Win32/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Path.inc?rev=50960&r1=50959&r2=50960&view=diff

==============================================================================
--- llvm/trunk/lib/System/Win32/Path.inc (original)
+++ llvm/trunk/lib/System/Win32/Path.inc Sun May 11 12:37:40 2008
@@ -46,6 +46,16 @@
 namespace sys {
 const char PathSeparator = ';';
 
+Path::Path(const std::string& p)
+  : path(p) {
+  FlipBackSlashes(path);
+}
+
+Path::Path(const char *StrStart, unsigned StrLen)
+  : path(StrStart, StrLen) {
+  FlipBackSlashes(path);
+}
+
 bool
 Path::isValid() const {
   if (path.empty())
@@ -230,7 +240,7 @@
 }
 
 std::string Path::getDirname() const {
-  return getDirnameCharSep(path, '\\');
+  return getDirnameCharSep(path, '/');
 }
 
 std::string





More information about the llvm-commits mailing list