[libcxx-commits] [libcxx] [libc++][filesystem] Report an error for canonical("") (PR #215031)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Aug 8 15:53:55 PDT 2026
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 origin/main HEAD --extensions cpp -- libcxx/src/filesystem/operations.cpp libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.canonical/canonical.pass.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</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 6a844b1bd..081aabb24 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
@@ -97,29 +97,28 @@ static void test_dne_path()
// refers to an existing file (exists(path()) is always false). canonical("")
// must therefore report an error instead of silently returning the current
// directory.
-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/215031
More information about the libcxx-commits
mailing list