[PATCH] Change filesystem lib to recognize paths started with \ as root

Zachary Turner zturner at google.com
Thu Jun 19 17:56:01 PDT 2014


Hi bogner,

Previously a path of the form

\foo\bar

would not be recognized as a root path on Windows.  This patch allows paths of this nature to be considered absolute paths.

http://reviews.llvm.org/D4224

Files:
  lib/Support/Path.cpp

Index: lib/Support/Path.cpp
===================================================================
--- lib/Support/Path.cpp
+++ lib/Support/Path.cpp
@@ -384,15 +384,15 @@
   const_iterator b = begin(path),
                  e = end(path);
   if (b != e) {
-    bool has_net = b->size() > 2 && is_separator((*b)[0]) && (*b)[1] == (*b)[0];
+    bool has_sep = is_separator((*b)[0]);
     bool has_drive =
 #ifdef LLVM_ON_WIN32
       b->endswith(":");
 #else
       false;
 #endif
 
-    if (has_net || has_drive) {
+    if (has_sep || has_drive) {
       // just {C:,//net}, return the first component.
       return *b;
     }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4224.10668.patch
Type: text/x-patch
Size: 624 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140620/5fb57066/attachment.bin>


More information about the llvm-commits mailing list