================
@@ -645,35 +645,73 @@ class PrettyPrinter {
     }
   }
 
+  // An anonymous struct/union member has no name to print. This includes the
+  // implicit member -fms-extensions adds for a tagged anonymous struct.
+  static bool isAnonymousProjection(const Project *E) {
----------------
melver wrote:

When Cvdecl has an empty DeclarationName, Cvdecl->getDeclName().isIdentifier() 
is false, so E->slotName() populates the `std::optional<std::string>` cache via 
llvm::raw_string_ostream and Cvdecl->printName(OS) just to produce "". Checking 
getDeclName().isEmpty() directly avoids that overhead:

```
       static bool isAnonymousProjection(const Project *E) {
    -    return E->slotName().empty();
    +    return E->clangDecl()->getDeclName().isEmpty();
       }
```

https://github.com/llvm/llvm-project/pull/233965
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to