[libcxx-commits] [libcxxabi] [llvm] [libc++abi] Enable demangling of `cp` expression production (PR #114882)

Nick Desaulniers via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 9 10:20:10 PST 2024


================
@@ -30397,24 +30398,24 @@ void test_invalid_cases()
     assert(!passed && "demangle did not fail");
 }
 
-const char *xfail_cases[] = {
-    // FIXME: Why does clang generate the "cp" expr?
-    "_ZN5test11bIsEEDTcp3foocvT__EEES1_",
+const char *const xfail_cases[] = {
+    // Sentinel value
+    nullptr
 };
 
-const size_t num_xfails = sizeof(xfail_cases) / sizeof(xfail_cases[0]);
-
 void test_xfail_cases()
 {
     std::size_t len = 0;
     char* buf = nullptr;
-    for (std::size_t i = 0; i < num_xfails; ++i)
+    for (auto c_str : xfail_cases)
----------------
nickdesaulniers wrote:

```suggestion
    for (const auto *c_str : xfail_cases)
```

https://llvm.org/docs/CodingStandards.html#beware-unnecessary-copies-with-auto

(or just use `const char *c_str` since it's the same number of characters).

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


More information about the libcxx-commits mailing list