Add a simpler version of is_regular_file.
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 24 Jun 2013 17:54:24 +0000 (17:54 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 24 Jun 2013 17:54:24 +0000 (17:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184764 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/FileSystem.h

index 474e01ce360f7e0b33a54d6e792c2b8e008e18d3..5c514dc95c8cf2a47c761092a179a6144c19b7b7 100644 (file)
@@ -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?
 ///