[libcxx-commits] [libcxx] [libc++] Make std::filesystem::canonical throw when given empty path (PR #77223)

via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jan 6 22:36:02 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 5dfcb3e5d1d16bb4f8fce52b3c089119ed977e7f 19f5fb22944f79c672e192c75b90b3d94ad542c8 -- libcxx/src/filesystem/operations.cpp libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.canonical/canonical.pass.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.canonical/canonical.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.canonical/canonical.pass.cpp
index 000fb47096..c5935f2051 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.canonical/canonical.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.canonical/canonical.pass.cpp
@@ -92,29 +92,24 @@ static void test_dne_path()
     }
 }
 
-static void test_empty_path()
-{
-    std::error_code ec = GetTestEC();
-    {
-        const path ret = canonical(path{}, ec);
-        assert(ec != GetTestEC());
-        assert(ec);
-        assert(ret == path{});
-    }
-    {
-        TEST_THROWS_TYPE(filesystem_error, canonical(path{}));
-    }
+static void test_empty_path() {
+  std::error_code ec = GetTestEC();
+  {
+    const path ret = canonical(path{}, ec);
+    assert(ec != GetTestEC());
+    assert(ec);
+    assert(ret == path{});
+  }
+  { TEST_THROWS_TYPE(filesystem_error, canonical(path{})); }
 
-    ec = GetTestEC();
-    {
-        const path ret = canonical("", ec);
-        assert(ec != GetTestEC());
-        assert(ec);
-        assert(ret == path{});
-    }
-    {
-        TEST_THROWS_TYPE(filesystem_error, canonical(""));
-    }
+  ec = GetTestEC();
+  {
+    const path ret = canonical("", ec);
+    assert(ec != GetTestEC());
+    assert(ec);
+    assert(ret == path{});
+  }
+  { TEST_THROWS_TYPE(filesystem_error, canonical("")); }
 }
 
 static void test_exception_contains_paths()

``````````

</details>


https://github.com/llvm/llvm-project/pull/77223


More information about the libcxx-commits mailing list