================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to