Support/PathV2: Fix make_absolute() to match is_absolute() and not expect to
authorDaniel Dunbar <daniel@zuster.org>
Wed, 29 Feb 2012 00:20:37 +0000 (00:20 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 29 Feb 2012 00:20:37 +0000 (00:20 +0000)
find root names on Unix.
 - This fixes make_absolute to not basically always call current_path() on
   Unix systems.
 - I think the API probably needs cleanup in this area, but I'll let Michael
   handle that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151681 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/PathV2.cpp

index bf8672bc57bcf4b745dc56d7f631da04746c689e..ce97b7f2ca20e773becb78ae222e10e43b8e4625 100644 (file)
@@ -600,8 +600,12 @@ namespace fs {
 error_code make_absolute(SmallVectorImpl<char> &path) {
   StringRef p(path.data(), path.size());
 
-  bool rootName      = path::has_root_name(p),
-       rootDirectory = path::has_root_directory(p);
+  bool rootDirectory = path::has_root_directory(p),
+#ifdef LLVM_ON_WIN32
+       rootName = has_root_name(p);
+#else
+       rootName = true;
+#endif
 
   // Already absolute.
   if (rootName && rootDirectory)