[llvm-commits] [llvm] r121109 - in /llvm/trunk: include/llvm/Support/PathV2.h lib/Support/PathV2.cpp lib/Support/Unix/PathV2.inc lib/Support/Windows/PathV2.inc unittests/Support/Path.cpp

Michael J. Spencer bigcheesegs at gmail.com
Mon Dec 6 19:57:37 PST 2010


Author: mspencer
Date: Mon Dec  6 21:57:37 2010
New Revision: 121109

URL: http://llvm.org/viewvc/llvm-project?rev=121109&view=rev
Log:
Support/PathV2: Remove the error_code return type from all functions in the path
namespace. None of them return anything except for success anyway. These will be
converted to returning their result soon.

Modified:
    llvm/trunk/include/llvm/Support/PathV2.h
    llvm/trunk/lib/Support/PathV2.cpp
    llvm/trunk/lib/Support/Unix/PathV2.inc
    llvm/trunk/lib/Support/Windows/PathV2.inc
    llvm/trunk/unittests/Support/Path.cpp

Modified: llvm/trunk/include/llvm/Support/PathV2.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/PathV2.h?rev=121109&r1=121108&r2=121109&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/PathV2.h (original)
+++ llvm/trunk/include/llvm/Support/PathV2.h Mon Dec  6 21:57:37 2010
@@ -11,16 +11,7 @@
 // TR2/boost filesystem (v3), but modified to remove exception handling and the
 // path class.
 //
-// All functions return an error_code and their actual work via the last out
-// argument. The out argument is defined if and only if errc::success is
-// returned. A function may return any error code in the generic or system
-// category. However, they shall be equivalent to any error conditions listed
-// in each functions respective documentation if the condition applies. [ note:
-// this does not guarantee that error_code will be in the set of explicitly
-// listed codes, but it does guarantee that if any of the explicitly listed
-// errors occur, the correct error_code will be used ]. All functions may
-// return errc::not_enough_memory if there is not enough memory to complete the
-// operation.
+// All functions return void and their actual work via the last out argument.
 //
 //===----------------------------------------------------------------------===//
 
@@ -30,7 +21,6 @@
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/DataTypes.h"
-#include "llvm/Support/system_error.h"
 #include <iterator>
 
 namespace llvm {
@@ -124,9 +114,7 @@
 /// /                      => /
 ///
 /// @param path A path that is modified to not have a file component.
-/// @returns errc::success if \a path's file name has been removed (or there was
-///          not one to begin with), otherwise a platform specific error_code.
-error_code remove_filename(SmallVectorImpl<char> &path);
+void remove_filename(SmallVectorImpl<char> &path);
 
 /// @brief Replace the file extension of \a path with \a extension.
 ///
@@ -138,9 +126,7 @@
 /// @param extension The extension to be added. It may be empty. It may also
 ///                  optionally start with a '.', if it does not, one will be
 ///                  prepended.
-/// @returns errc::success if \a path's extension has been replaced, otherwise a
-///          platform specific error_code.
-error_code replace_extension(SmallVectorImpl<char> &path,
+void replace_extension(SmallVectorImpl<char> &path,
                              const Twine &extension);
 
 /// @brief Append to path.
@@ -151,9 +137,7 @@
 ///
 /// @param path Set to \a path + \a component.
 /// @param component The component to be appended to \a path.
-/// @returns errc::success if \a component has been appended to \a path,
-///          otherwise a platform specific error_code.
-error_code append(SmallVectorImpl<char> &path, const Twine &a,
+void append(SmallVectorImpl<char> &path, const Twine &a,
                                                const Twine &b = "",
                                                const Twine &c = "",
                                                const Twine &d = "");
@@ -167,9 +151,7 @@
 /// @param path Set to \a path + [\a begin, \a end).
 /// @param begin Start of components to append.
 /// @param end One past the end of components to append.
-/// @returns errc::success if [\a begin, \a end) has been appended to \a path,
-///          otherwise a platform specific error_code.
-error_code append(SmallVectorImpl<char> &path,
+void append(SmallVectorImpl<char> &path,
                   const_iterator begin, const_iterator end);
 
 /// @}
@@ -182,9 +164,7 @@
 ///
 /// @param path A path that is transformed to native format.
 /// @param result Holds the result of the transformation.
-/// @returns errc::success if \a path has been transformed and stored in result,
-///          otherwise a platform specific error_code.
-error_code native(const Twine &path, SmallVectorImpl<char> &result);
+void native(const Twine &path, SmallVectorImpl<char> &result);
 
 /// @}
 /// @name Lexical Observers
@@ -198,9 +178,7 @@
 ///
 /// @param path Input path.
 /// @param result Set to the root name of \a path if it has one, otherwise "".
-/// @results errc::success if result has been successfully set, otherwise a
-///          platform specific error_code.
-error_code root_name(const StringRef &path, StringRef &result);
+void root_name(const StringRef &path, StringRef &result);
 
 /// @brief Get root directory.
 ///
@@ -211,9 +189,7 @@
 /// @param path Input path.
 /// @param result Set to the root directory of \a path if it has one, otherwise
 ///               "".
-/// @results errc::success if result has been successfully set, otherwise a
-///          platform specific error_code.
-error_code root_directory(const StringRef &path, StringRef &result);
+void root_directory(const StringRef &path, StringRef &result);
 
 /// @brief Get root path.
 ///
@@ -221,9 +197,7 @@
 ///
 /// @param path Input path.
 /// @param result Set to the root path of \a path if it has one, otherwise "".
-/// @results errc::success if result has been successfully set, otherwise a
-///          platform specific error_code.
-error_code root_path(const StringRef &path, StringRef &result);
+void root_path(const StringRef &path, StringRef &result);
 
 /// @brief Get relative path.
 ///
@@ -234,9 +208,7 @@
 /// @param path Input path.
 /// @param result Set to the path starting after root_path if one exists,
 ///               otherwise "".
-/// @results errc::success if result has been successfully set, otherwise a
-///          platform specific error_code.
-error_code relative_path(const StringRef &path, StringRef &result);
+void relative_path(const StringRef &path, StringRef &result);
 
 /// @brief Get parent path.
 ///
@@ -246,9 +218,7 @@
 ///
 /// @param path Input path.
 /// @param result Set to the parent path of \a path if one exists, otherwise "".
-/// @results errc::success if result has been successfully set, otherwise a
-///          platform specific error_code.
-error_code parent_path(const StringRef &path, StringRef &result);
+void parent_path(const StringRef &path, StringRef &result);
 
 /// @brief Get filename.
 ///
@@ -260,9 +230,7 @@
 /// @param path Input path.
 /// @param result Set to the filename part of \a path. This is defined as the
 ///               last component of \a path.
-/// @results errc::success if result has been successfully set, otherwise a
-///          platform specific error_code.
-error_code filename(const StringRef &path, StringRef &result);
+void filename(const StringRef &path, StringRef &result);
 
 /// @brief Get stem.
 ///
@@ -278,9 +246,7 @@
 ///
 /// @param path Input path.
 /// @param result Set to the stem of \a path.
-/// @results errc::success if result has been successfully set, otherwise a
-///          platform specific error_code.
-error_code stem(const StringRef &path, StringRef &result);
+void stem(const StringRef &path, StringRef &result);
 
 /// @brief Get extension.
 ///
@@ -294,9 +260,7 @@
 ///
 /// @param path Input path.
 /// @param result Set to the extension of \a path.
-/// @results errc::success if result has been successfully set, otherwise a
-///          platform specific error_code.
-error_code extension(const StringRef &path, StringRef &result);
+void extension(const StringRef &path, StringRef &result);
 
 /// @brief Has root name?
 ///
@@ -304,9 +268,7 @@
 ///
 /// @param path Input path.
 /// @param result Set to true if the path has a root name, false otherwise.
-/// @results errc::success if result has been successfully set, otherwise a
-///          platform specific error_code.
-error_code has_root_name(const Twine &path, bool &result);
+void has_root_name(const Twine &path, bool &result);
 
 /// @brief Has root directory?
 ///
@@ -314,9 +276,7 @@
 ///
 /// @param path Input path.
 /// @param result Set to true if the path has a root directory, false otherwise.
-/// @results errc::success if result has been successfully set, otherwise a
-///          platform specific error_code.
-error_code has_root_directory(const Twine &path, bool &result);
+void has_root_directory(const Twine &path, bool &result);
 
 /// @brief Has root path?
 ///
@@ -324,9 +284,7 @@
 ///
 /// @param path Input path.
 /// @param result Set to true if the path has a root path, false otherwise.
-/// @results errc::success if result has been successfully set, otherwise a
-///          platform specific error_code.
-error_code has_root_path(const Twine &path, bool &result);
+void has_root_path(const Twine &path, bool &result);
 
 /// @brief Has relative path?
 ///
@@ -334,9 +292,7 @@
 ///
 /// @param path Input path.
 /// @param result Set to true if the path has a relative path, false otherwise.
-/// @results errc::success if result has been successfully set, otherwise a
-///          platform specific error_code.
-error_code has_relative_path(const Twine &path, bool &result);
+void has_relative_path(const Twine &path, bool &result);
 
 /// @brief Has parent path?
 ///
@@ -344,9 +300,7 @@
 ///
 /// @param path Input path.
 /// @param result Set to true if the path has a parent path, false otherwise.
-/// @results errc::success if result has been successfully set, otherwise a
-///          platform specific error_code.
-error_code has_parent_path(const Twine &path, bool &result);
+void has_parent_path(const Twine &path, bool &result);
 
 /// @brief Has filename?
 ///
@@ -354,9 +308,7 @@
 ///
 /// @param path Input path.
 /// @param result Set to true if the path has a filename, false otherwise.
-/// @results errc::success if result has been successfully set, otherwise a
-///          platform specific error_code.
-error_code has_filename(const Twine &path, bool &result);
+void has_filename(const Twine &path, bool &result);
 
 /// @brief Has stem?
 ///
@@ -364,9 +316,7 @@
 ///
 /// @param path Input path.
 /// @param result Set to true if the path has a stem, false otherwise.
-/// @results errc::success if result has been successfully set, otherwise a
-///          platform specific error_code.
-error_code has_stem(const Twine &path, bool &result);
+void has_stem(const Twine &path, bool &result);
 
 /// @brief Has extension?
 ///
@@ -374,26 +324,19 @@
 ///
 /// @param path Input path.
 /// @param result Set to true if the path has a extension, false otherwise.
-/// @results errc::success if result has been successfully set, otherwise a
-///          platform specific error_code.
-error_code has_extension(const Twine &path, bool &result);
+void has_extension(const Twine &path, bool &result);
 
 /// @brief Is path absolute?
 ///
 /// @param path Input path.
 /// @param result Set to true if the path is absolute, false if it is not.
-/// @results errc::success if result has been successfully set, otherwise a
-///          platform specific error_code.
-error_code is_absolute(const Twine &path, bool &result);
+void is_absolute(const Twine &path, bool &result);
 
 /// @brief Is path relative?
 ///
 /// @param path Input path.
 /// @param result Set to true if the path is relative, false if it is not.
-/// @results errc::success if result has been successfully set, otherwise a
-///          platform specific error_code.
-error_code is_relative(const Twine &path, bool &result);
-// end purely lexical.
+void is_relative(const Twine &path, bool &result);
 
 } // end namespace path
 } // end namespace sys

Modified: llvm/trunk/lib/Support/PathV2.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/PathV2.cpp?rev=121109&r1=121108&r2=121109&view=diff
==============================================================================
--- llvm/trunk/lib/Support/PathV2.cpp (original)
+++ llvm/trunk/lib/Support/PathV2.cpp Mon Dec  6 21:57:37 2010
@@ -276,7 +276,7 @@
   return Position - RHS.Position;
 }
 
-error_code root_path(const StringRef &path, StringRef &result) {
+void root_path(const StringRef &path, StringRef &result) {
   const_iterator b = begin(path),
                  pos = b,
                  e = end(path);
@@ -293,31 +293,25 @@
       if ((++pos != e) && is_separator((*pos)[0])) {
         // {C:/,//net/}, so get the first two components.
         result = StringRef(path.begin(), b->size() + pos->size());
-        return success;
+        return;
       } else {
         // just {C:,//net}, return the first component.
         result = *b;
-        return success;
+        return;
       }
     }
 
     // POSIX style root directory.
     if (is_separator((*b)[0])) {
       result = *b;
-      return success;
+      return;
     }
-
-    // No root_path.
-    result = StringRef();
-    return success;
   }
 
-  // No path :(.
   result = StringRef();
-  return success;
 }
 
-error_code root_name(const StringRef &path, StringRef &result) {
+void root_name(const StringRef &path, StringRef &result) {
   const_iterator b = begin(path),
                  e = end(path);
   if (b != e) {
@@ -332,16 +326,16 @@
     if (has_net || has_drive) {
       // just {C:,//net}, return the first component.
       result = *b;
-      return success;
+      return;
     }
   }
 
   // No path or no name.
   result = StringRef();
-  return success;
+  return;
 }
 
-error_code root_directory(const StringRef &path, StringRef &result) {
+void root_directory(const StringRef &path, StringRef &result) {
   const_iterator b = begin(path),
                  pos = b,
                  e = end(path);
@@ -358,32 +352,32 @@
         // {C:,//net}, skip to the next component.
         (++pos != e) && is_separator((*pos)[0])) {
       result = *pos;
-      return success;
+      return;
     }
 
     // POSIX style root directory.
     if (!has_net && is_separator((*b)[0])) {
       result = *b;
-      return success;
+      return;
     }
   }
 
   // No path or no root.
   result = StringRef();
-  return success;
+  return;
 }
 
-error_code relative_path(const StringRef &path, StringRef &result) {
+void relative_path(const StringRef &path, StringRef &result) {
   StringRef root;
-  if (error_code ec = root_path(path, root)) return ec;
+  root_path(path, root);
   result = StringRef(path.begin() + root.size(), path.size() - root.size());
-  return success;
+  return;
 }
 
-error_code append(SmallVectorImpl<char> &path, const Twine &a,
-                                               const Twine &b,
-                                               const Twine &c,
-                                               const Twine &d) {
+void append(SmallVectorImpl<char> &path, const Twine &a,
+                                         const Twine &b,
+                                         const Twine &c,
+                                         const Twine &d) {
   SmallString<32> a_storage;
   SmallString<32> b_storage;
   SmallString<32> c_storage;
@@ -401,7 +395,7 @@
     bool path_has_sep = !path.empty() && is_separator(path[path.size() - 1]);
     bool component_has_sep = !i->empty() && is_separator((*i)[0]);
     bool is_root_name = false;
-    if (error_code ec = has_root_name(*i, is_root_name)) return ec;
+    has_root_name(*i, is_root_name);
 
     if (path_has_sep) {
       // Strip separators from beginning of component.
@@ -420,28 +414,23 @@
 
     path.append(i->begin(), i->end());
   }
-
-  return success;
 }
 
-error_code parent_path(const StringRef &path, StringRef &result) {
+void parent_path(const StringRef &path, StringRef &result) {
   size_t end_pos = parent_path_end(path);
   if (end_pos == StringRef::npos)
     result = StringRef();
   else
     result = StringRef(path.data(), end_pos);
-  return success;
 }
 
-error_code remove_filename(SmallVectorImpl<char> &path) {
+void remove_filename(SmallVectorImpl<char> &path) {
   size_t end_pos = parent_path_end(StringRef(path.begin(), path.size()));
-  if (end_pos == StringRef::npos)
-    return success;
-  path.set_size(end_pos);
-  return success;
+  if (end_pos != StringRef::npos)
+    path.set_size(end_pos);
 }
 
-error_code replace_extension(SmallVectorImpl<char> &path,
+void replace_extension(SmallVectorImpl<char> &path,
                              const Twine &extension) {
   StringRef p(path.begin(), path.size());
   SmallString<32> ext_storage;
@@ -458,10 +447,9 @@
 
   // Append extension.
   path.append(ext.begin(), ext.end());
-  return success;
 }
 
-error_code native(const Twine &path, SmallVectorImpl<char> &result) {
+void native(const Twine &path, SmallVectorImpl<char> &result) {
   // Clear result.
   result.clear();
 #ifdef LLVM_ON_WIN32
@@ -480,17 +468,15 @@
 #else
   path.toVector(result);
 #endif
-  return success;
 }
 
-error_code filename(const StringRef &path, StringRef &result) {
+void filename(const StringRef &path, StringRef &result) {
   result = *(--end(path));
-  return success;
 }
 
-error_code stem(const StringRef &path, StringRef &result) {
+void stem(const StringRef &path, StringRef &result) {
   StringRef fname;
-  if (error_code ec = filename(path, fname)) return ec;
+  filename(path, fname);
   size_t pos = fname.find_last_of('.');
   if (pos == StringRef::npos)
     result = fname;
@@ -500,13 +486,11 @@
       result = fname;
     else
       result = StringRef(fname.begin(), pos);
-
-  return success;
 }
 
-error_code extension(const StringRef &path, StringRef &result) {
+void extension(const StringRef &path, StringRef &result) {
   StringRef fname;
-  if (error_code ec = filename(path, fname)) return ec;
+  filename(path, fname);
   size_t pos = fname.find_last_of('.');
   if (pos == StringRef::npos)
     result = StringRef();
@@ -516,102 +500,91 @@
       result = StringRef();
     else
       result = StringRef(fname.begin() + pos, fname.size() - pos);
-
-  return success;
 }
 
-error_code has_root_name(const Twine &path, bool &result) {
+void has_root_name(const Twine &path, bool &result) {
   SmallString<128> path_storage;
   StringRef p = path.toStringRef(path_storage);
 
-  if (error_code ec = root_name(p, p)) return ec;
+  root_name(p, p);
 
   result = !p.empty();
-  return success;
 }
 
-error_code has_root_directory(const Twine &path, bool &result) {
+void has_root_directory(const Twine &path, bool &result) {
   SmallString<128> path_storage;
   StringRef p = path.toStringRef(path_storage);
 
-  if (error_code ec = root_directory(p, p)) return ec;
+  root_directory(p, p);
 
   result = !p.empty();
-  return success;
 }
 
-error_code has_root_path(const Twine &path, bool &result) {
+void has_root_path(const Twine &path, bool &result) {
   SmallString<128> path_storage;
   StringRef p = path.toStringRef(path_storage);
 
-  if (error_code ec = root_path(p, p)) return ec;
+  root_path(p, p);
 
   result = !p.empty();
-  return success;
 }
 
-error_code has_filename(const Twine &path, bool &result) {
+void has_filename(const Twine &path, bool &result) {
   SmallString<128> path_storage;
   StringRef p = path.toStringRef(path_storage);
 
-  if (error_code ec = filename(p, p)) return ec;
+  filename(p, p);
 
   result = !p.empty();
-  return success;
 }
 
-error_code has_parent_path(const Twine &path, bool &result) {
+void has_parent_path(const Twine &path, bool &result) {
   SmallString<128> path_storage;
   StringRef p = path.toStringRef(path_storage);
 
-  if (error_code ec = parent_path(p, p)) return ec;
+  parent_path(p, p);
 
   result = !p.empty();
-  return success;
 }
 
-error_code has_stem(const Twine &path, bool &result) {
+void has_stem(const Twine &path, bool &result) {
   SmallString<128> path_storage;
   StringRef p = path.toStringRef(path_storage);
 
-  if (error_code ec = stem(p, p)) return ec;
+  stem(p, p);
 
   result = !p.empty();
-  return success;
 }
 
-error_code has_extension(const Twine &path, bool &result) {
+void has_extension(const Twine &path, bool &result) {
   SmallString<128> path_storage;
   StringRef p = path.toStringRef(path_storage);
 
-  if (error_code ec = extension(p, p)) return ec;
+  extension(p, p);
 
   result = !p.empty();
-  return success;
 }
 
-error_code is_absolute(const Twine &path, bool &result) {
+void is_absolute(const Twine &path, bool &result) {
   SmallString<128> path_storage;
   StringRef p = path.toStringRef(path_storage);
 
   bool rootDir = false,
        rootName = false;
-  if (error_code ec = has_root_directory(p, rootDir)) return ec;
+  has_root_directory(p, rootDir);
 #ifdef LLVM_ON_WIN32
-  if (error_code ec = has_root_name(p, rootName)) return ec;
+  has_root_name(p, rootName);
 #else
   rootName = true;
 #endif
 
   result = rootDir && rootName;
-  return success;
 }
 
-error_code is_relative(const Twine &path, bool &result) {
+void is_relative(const Twine &path, bool &result) {
   bool res;
-  error_code ec = is_absolute(path, res);
+  is_absolute(path, res);
   result = !res;
-  return ec;
 }
 
 } // end namespace path
@@ -622,8 +595,8 @@
   StringRef p(path.data(), path.size());
 
   bool rootName = false, rootDirectory = false;
-  if (error_code ec = path::has_root_name(p, rootName)) return ec;
-  if (error_code ec = path::has_root_directory(p, rootDirectory)) return ec;
+  path::has_root_name(p, rootName);
+  path::has_root_directory(p, rootDirectory);
 
   // Already absolute.
   if (rootName && rootDirectory)
@@ -636,7 +609,7 @@
   // Relative path. Prepend the current directory.
   if (!rootName && !rootDirectory) {
     // Append path to the current directory.
-    if (error_code ec = path::append(current_dir, p)) return ec;
+    path::append(current_dir, p);
     // Set path to the result.
     path.swap(current_dir);
     return success;
@@ -644,9 +617,9 @@
 
   if (!rootName && rootDirectory) {
     StringRef cdrn;
-    if (error_code ec = path::root_name(current_dir, cdrn)) return ec;
+    path::root_name(current_dir, cdrn);
     SmallString<128> curDirRootName(cdrn.begin(), cdrn.end());
-    if (error_code ec = path::append(curDirRootName, p)) return ec;
+    path::append(curDirRootName, p);
     // Set path to the result.
     path.swap(curDirRootName);
     return success;
@@ -657,16 +630,13 @@
     StringRef bRootDirectory;
     StringRef bRelativePath;
     StringRef pRelativePath;
-    if (error_code ec = path::root_name(p, pRootName)) return ec;
-    if (error_code ec = path::root_directory(current_dir, bRootDirectory))
-      return ec;
-    if (error_code ec = path::relative_path(current_dir, bRelativePath))
-      return ec;
-    if (error_code ec = path::relative_path(p, pRelativePath)) return ec;
+    path::root_name(p, pRootName);
+    path::root_directory(current_dir, bRootDirectory);
+    path::relative_path(current_dir, bRelativePath);
+    path::relative_path(p, pRelativePath);
 
     SmallString<128> res;
-    if (error_code ec = path::append(res, pRootName, bRootDirectory,
-                                     bRelativePath, pRelativePath)) return ec;
+    path::append(res, pRootName, bRootDirectory, bRelativePath, pRelativePath);
     path.swap(res);
     return success;
   }
@@ -681,7 +651,7 @@
 
   StringRef parent;
   bool parent_exists;
-  if (error_code ec = path::parent_path(p, parent)) return ec;
+  path::parent_path(p, parent);
   if (error_code ec = fs::exists(parent, parent_exists)) return ec;
 
   if (!parent_exists)

Modified: llvm/trunk/lib/Support/Unix/PathV2.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/PathV2.inc?rev=121109&r1=121108&r2=121109&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/PathV2.inc (original)
+++ llvm/trunk/lib/Support/Unix/PathV2.inc Mon Dec  6 21:57:37 2010
@@ -325,11 +325,11 @@
 
   // Make model absolute by prepending a temp directory if it's not already.
   bool absolute;
-  if (error_code ec = path::is_absolute(Twine(Model), absolute)) return ec;
+  path::is_absolute(Twine(Model), absolute);
   if (!absolute) {
     SmallString<128> TDir;
     if (error_code ec = TempDir(TDir)) return ec;
-    if (error_code ec = path::append(TDir, Twine(Model))) return ec;
+    path::append(TDir, Twine(Model));
     Model.swap(TDir);
   }
 
@@ -374,7 +374,7 @@
       SmallString<64> dir_to_create;
       for (path::const_iterator i = path::begin(p),
                                 e = --path::end(p); i != e; ++i) {
-        if (error_code ec = path::append(dir_to_create, *i)) return ec;
+        path::append(dir_to_create, *i);
         bool Exists;
         if (error_code ec = exists(Twine(dir_to_create), Exists)) return ec;
         if (!Exists) {

Modified: llvm/trunk/lib/Support/Windows/PathV2.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/PathV2.inc?rev=121109&r1=121108&r2=121109&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/PathV2.inc (original)
+++ llvm/trunk/lib/Support/Windows/PathV2.inc Mon Dec  6 21:57:37 2010
@@ -490,7 +490,7 @@
 
   // Make model absolute by prepending a temp directory if it's not already.
   bool absolute;
-  if (error_code ec = path::is_absolute(m, absolute)) return ec;
+  path::is_absolute(m, absolute);
 
   if (!absolute) {
     SmallVector<wchar_t, 64> temp_dir;
@@ -560,7 +560,7 @@
       SmallString<64> dir_to_create;
       for (path::const_iterator i = path::begin(p),
                                 e = --path::end(p); i != e; ++i) {
-        if (error_code ec = path::append(dir_to_create, *i)) return ec;
+        path::append(dir_to_create, *i);
         bool Exists;
         if (error_code ec = exists(Twine(dir_to_create), Exists)) return ec;
         if (!Exists) {

Modified: llvm/trunk/unittests/Support/Path.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/Path.cpp?rev=121109&r1=121108&r2=121109&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/Path.cpp (original)
+++ llvm/trunk/unittests/Support/Path.cpp Mon Dec  6 21:57:37 2010
@@ -85,37 +85,37 @@
 
     bool      bres;
     StringRef sfres;
-    ASSERT_FALSE(path::has_root_path(*i, bres));
-    ASSERT_FALSE(path::root_path(*i, sfres));
-    ASSERT_FALSE(path::has_root_name(*i, bres));
-    ASSERT_FALSE(path::root_name(*i, sfres));
-    ASSERT_FALSE(path::has_root_directory(*i, bres));
-    ASSERT_FALSE(path::root_directory(*i, sfres));
-    ASSERT_FALSE(path::has_parent_path(*i, bres));
-    ASSERT_FALSE(path::parent_path(*i, sfres));
-    ASSERT_FALSE(path::has_filename(*i, bres));
-    ASSERT_FALSE(path::filename(*i, sfres));
-    ASSERT_FALSE(path::has_stem(*i, bres));
-    ASSERT_FALSE(path::stem(*i, sfres));
-    ASSERT_FALSE(path::has_extension(*i, bres));
-    ASSERT_FALSE(path::extension(*i, sfres));
-    ASSERT_FALSE(path::is_absolute(*i, bres));
-    ASSERT_FALSE(path::is_relative(*i, bres));
+    path::has_root_path(*i, bres);
+    path::root_path(*i, sfres);
+    path::has_root_name(*i, bres);
+    path::root_name(*i, sfres);
+    path::has_root_directory(*i, bres);
+    path::root_directory(*i, sfres);
+    path::has_parent_path(*i, bres);
+    path::parent_path(*i, sfres);
+    path::has_filename(*i, bres);
+    path::filename(*i, sfres);
+    path::has_stem(*i, bres);
+    path::stem(*i, sfres);
+    path::has_extension(*i, bres);
+    path::extension(*i, sfres);
+    path::is_absolute(*i, bres);
+    path::is_relative(*i, bres);
 
     SmallString<16> temp_store;
     temp_store = *i;
     ASSERT_FALSE(fs::make_absolute(temp_store));
     temp_store = *i;
-    ASSERT_FALSE(path::remove_filename(temp_store));
+    path::remove_filename(temp_store);
 
     temp_store = *i;
-    ASSERT_FALSE(path::replace_extension(temp_store, "ext"));
+    path::replace_extension(temp_store, "ext");
     StringRef filename(temp_store.begin(), temp_store.size()), stem, ext;
-    ASSERT_FALSE(path::stem(filename, stem));
-    ASSERT_FALSE(path::extension(filename, ext));
+    path::stem(filename, stem);
+    path::extension(filename, ext);
     EXPECT_EQ(*(--sys::path::end(filename)), (stem + ext).str());
 
-    ASSERT_FALSE(path::native(*i, temp_store));
+    path::native(*i, temp_store);
 
     outs().flush();
   }





More information about the llvm-commits mailing list