[llvm] r184764 - Add a simpler version of is_regular_file.

Rafael Espindola rafael.espindola at gmail.com
Mon Jun 24 10:54:24 PDT 2013


Author: rafael
Date: Mon Jun 24 12:54:24 2013
New Revision: 184764

URL: http://llvm.org/viewvc/llvm-project?rev=184764&view=rev
Log:
Add a simpler version of is_regular_file.

Modified:
    llvm/trunk/include/llvm/Support/FileSystem.h

Modified: llvm/trunk/include/llvm/Support/FileSystem.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FileSystem.h?rev=184764&r1=184763&r2=184764&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/FileSystem.h (original)
+++ llvm/trunk/include/llvm/Support/FileSystem.h Mon Jun 24 12:54:24 2013
@@ -448,6 +448,15 @@ bool is_regular_file(file_status status)
 ///          platform specific error_code.
 error_code is_regular_file(const Twine &path, bool &result);
 
+/// @brief Simpler version of is_regular_file for clients that don't need to
+///        differentiate between an error and false.
+inline bool is_regular_file(const Twine &Path) {
+  bool Result;
+  if (is_regular_file(Path, Result))
+    return false;
+  return Result;
+}
+
 /// @brief Does this status represent something that exists but is not a
 ///        directory, regular file, or symlink?
 ///





More information about the llvm-commits mailing list