[PATCH] D96109: Refactor implementation of -funique-internal-linkage-names.

Sriraman Tallam via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 18 11:22:12 PST 2021


tmsriram added inline comments.


================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:5561
+  // the mangler will not do the right thing without one.
+  if (D->getKind() == Decl::Function && !getLangOpts().CPlusPlus &&
+      cast<FunctionDecl>(D)->getType()->getAs<FunctionProtoType>() &&
----------------
tmsriram wrote:
> dblaikie wrote:
> > aaron.ballman wrote:
> > > It's a bit novel to add the attribute at codegen time rather than at sema -- is there a reason this attribute should not be added to the AST from within Sema?
> > How would it be if this didn't use an attribute at all? If this checking was done in ItaniumMangle directly, rather than checking done here, transforming the result of the checking into an attribute, and then checking the attribute later?
> @dblaikie  That is what I tried to do first.  I didnt find an easy way to do this without either storing some state in the Mangler about every such decl or adding something to the decl itself.  I guess the Mangler needs to know 3 things:
> 
> 1) That funique-internal-linakge-names is enabled - maybe I can add a bool
> 2) That the language is not C++ - This is already possible
> 3) That the decl has internal linkage - this may require adding more state to the mangler
> 
> I think it is 3) that would require some plumbing unless I missed something already existing.
I will revisit this, at a high level I think the mangler should know about the linkage of the decl as it  does "_ZL" for this. I think I missed it.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96109/new/

https://reviews.llvm.org/D96109



More information about the llvm-commits mailing list