[libcxx-commits] [libcxx] 333384c - [libc++][NFC] clang-format filesystem_error.h

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 20 13:27:34 PDT 2023


Author: Louis Dionne
Date: 2023-06-20T16:27:26-04:00
New Revision: 333384c5bc3511a0776301b4dc3a05fb1aee7e25

URL: https://github.com/llvm/llvm-project/commit/333384c5bc3511a0776301b4dc3a05fb1aee7e25
DIFF: https://github.com/llvm/llvm-project/commit/333384c5bc3511a0776301b4dc3a05fb1aee7e25.diff

LOG: [libc++][NFC] clang-format filesystem_error.h

It's giving me trouble in an upcoming patch so I figured I'd do it as
a NFC before landing that other patch.

Added: 
    

Modified: 
    libcxx/include/__filesystem/filesystem_error.h
    libcxx/utils/data/ignore_format.txt

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__filesystem/filesystem_error.h b/libcxx/include/__filesystem/filesystem_error.h
index 07fd3223cbde3..81db9cc88e0d4 100644
--- a/libcxx/include/__filesystem/filesystem_error.h
+++ b/libcxx/include/__filesystem/filesystem_error.h
@@ -32,48 +32,36 @@ _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
 
 class _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_EXPORTED_FROM_ABI filesystem_error : public system_error {
 public:
-  _LIBCPP_INLINE_VISIBILITY
-  filesystem_error(const string& __what, error_code __ec)
-      : system_error(__ec, __what),
-        __storage_(make_shared<_Storage>(path(), path())) {
+  _LIBCPP_HIDE_FROM_ABI filesystem_error(const string& __what, error_code __ec)
+      : system_error(__ec, __what), __storage_(make_shared<_Storage>(path(), path())) {
     __create_what(0);
   }
 
-  _LIBCPP_INLINE_VISIBILITY
-  filesystem_error(const string& __what, const path& __p1, error_code __ec)
-      : system_error(__ec, __what),
-        __storage_(make_shared<_Storage>(__p1, path())) {
+  _LIBCPP_HIDE_FROM_ABI filesystem_error(const string& __what, const path& __p1, error_code __ec)
+      : system_error(__ec, __what), __storage_(make_shared<_Storage>(__p1, path())) {
     __create_what(1);
   }
 
-  _LIBCPP_INLINE_VISIBILITY
-  filesystem_error(const string& __what, const path& __p1, const path& __p2,
-                   error_code __ec)
-      : system_error(__ec, __what),
-        __storage_(make_shared<_Storage>(__p1, __p2)) {
+  _LIBCPP_HIDE_FROM_ABI filesystem_error(const string& __what, const path& __p1, const path& __p2, error_code __ec)
+      : system_error(__ec, __what), __storage_(make_shared<_Storage>(__p1, __p2)) {
     __create_what(2);
   }
 
-  _LIBCPP_INLINE_VISIBILITY
-  const path& path1() const noexcept { return __storage_->__p1_; }
+  _LIBCPP_HIDE_FROM_ABI const path& path1() const noexcept { return __storage_->__p1_; }
 
-  _LIBCPP_INLINE_VISIBILITY
-  const path& path2() const noexcept { return __storage_->__p2_; }
+  _LIBCPP_HIDE_FROM_ABI const path& path2() const noexcept { return __storage_->__p2_; }
 
   _LIBCPP_HIDE_FROM_ABI filesystem_error(const filesystem_error&) = default;
   ~filesystem_error() override; // key function
 
   _LIBCPP_HIDE_FROM_ABI_VIRTUAL
-  const char* what() const noexcept override {
-    return __storage_->__what_.c_str();
-  }
+  const char* what() const noexcept override { return __storage_->__what_.c_str(); }
 
   void __create_what(int __num_paths);
 
 private:
   struct _LIBCPP_HIDDEN _Storage {
-    _LIBCPP_INLINE_VISIBILITY
-    _Storage(const path& __p1, const path& __p2) : __p1_(__p1), __p2_(__p2) {}
+    _LIBCPP_HIDE_FROM_ABI _Storage(const path& __p1, const path& __p2) : __p1_(__p1), __p2_(__p2) {}
 
     path __p1_;
     path __p2_;
@@ -86,17 +74,17 @@ class _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_EXPORTED_FROM_ABI filesyst
 //                filesystem_error to work around PR41078.
 _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
 
+#  ifndef _LIBCPP_HAS_NO_EXCEPTIONS
 template <class... _Args>
-_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
-void __throw_filesystem_error(_Args&&... __args) {
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_filesystem_error(_Args&&... __args) {
   throw filesystem_error(_VSTD::forward<_Args>(__args)...);
 }
-#else
-void __throw_filesystem_error(_Args&&...) {
-    _LIBCPP_VERBOSE_ABORT("filesystem_error was thrown in -fno-exceptions mode");
+#  else
+template <class... _Args>
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_filesystem_error(_Args&&...) {
+  _LIBCPP_VERBOSE_ABORT("filesystem_error was thrown in -fno-exceptions mode");
 }
-#endif
+#  endif
 _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
 
 _LIBCPP_END_NAMESPACE_FILESYSTEM

diff  --git a/libcxx/utils/data/ignore_format.txt b/libcxx/utils/data/ignore_format.txt
index c6d95af5a988c..f43f1ccb0cf34 100644
--- a/libcxx/utils/data/ignore_format.txt
+++ b/libcxx/utils/data/ignore_format.txt
@@ -186,7 +186,6 @@ libcxx/include/__filesystem/directory_entry.h
 libcxx/include/__filesystem/directory_iterator.h
 libcxx/include/__filesystem/directory_options.h
 libcxx/include/__filesystem/file_status.h
-libcxx/include/__filesystem/filesystem_error.h
 libcxx/include/__filesystem/file_type.h
 libcxx/include/__filesystem/operations.h
 libcxx/include/__filesystem/path.h


        


More information about the libcxx-commits mailing list