[libcxx-commits] [libcxx] [libcxx] Handle windows system error code mapping in std::error_code. (PR #93101)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Aug 5 11:48:20 PDT 2024


================
@@ -172,8 +172,12 @@ static void test_with_ec_dne() {
     file_status st = status(p, status_ec);
     file_status sym_st = symlink_status(p, sym_status_ec);
     std::error_code ec = GetTestEC(2);
-    auto CheckEC = [&](std::error_code const& other_ec) {
-      bool res = ec == other_ec;
+    auto CheckEC                  = [&](std::error_code const& other_ec) {
+      // We compare the canonicalized error_conditions for this case, because
+      // directory_entry may construct its own generic_category error when a
+      // file doesn't exist, instead of directly returning a system_category
+      // error.
----------------
ldionne wrote:

```suggestion
      // We compare the canonicalized error_conditions because
      // directory_entry may construct its own generic_category error when a
      // file doesn't exist, instead of directly returning a system_category
      // error.
```

What does `for this case` refer to? The way this comment was worded is a bit fishy -- it feels a bit as-if the comment was interesting to reviewers of this patch but not necessarily to someone reading this code a year down the line.

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


More information about the libcxx-commits mailing list