[clang] [SystemZ][Clang]Use the function name from the source for name PPA1 (PR #209215)

Sean Perry via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 13 13:59:02 PDT 2026


================
@@ -126,7 +126,8 @@ static CCMangling getCallingConvMangling(const ASTContext &Context,
   }
 }
 
-bool MangleContext::shouldMangleDeclName(const NamedDecl *D) {
+bool MangleContext::shouldMangleDeclName(const NamedDecl *D,
+                                         bool IgnoreAsmLabel) {
----------------
perry-ca wrote:

If we do this I see I'll need to create a `shouldMangleDeclNameIgnoreAsmLabel()` and then check the IgnoreAsmLabel arg in getMangledNameImpl() to see which shouldMangleDeclName function should be called which will just go back to being an argument to `shouldMangleDeclNameImpl()`.  That will add conditional code in getMangledNameImpl() when we could just have passed the argument through.  Is that what you were thinking?

A slight variation on the Impl pattern is to have:
```cpp
bool MangleContext::shouldMangleDeclName(const NamedDecl *D) {
  // Any decl can be declared with __asm("foo") on it, and this takes precedence
  // over all other naming in the .o file.
  if (D->hasAttr<AsmLabelAttr>())
    return true;
  return shouldMangleDeclNameIgnoringAsmLabel(D);  // original code with the check avoid removed
}
```
This gets rid of the extra argument completely.  It still fans out and back in.

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


More information about the cfe-commits mailing list