[PATCH] D24704: PR30401: Fix substitutions for functions with abi_tag

Dmitry Polukhin via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 19 01:41:52 PDT 2016

DmitryPolukhin added inline comments.

Comment at: lib/AST/ItaniumMangle.cpp:668
@@ -664,3 +667,3 @@
   llvm::raw_svector_ostream FunctionEncodingStream(FunctionEncodingBuf);
   CXXNameMangler FunctionEncodingMangler(*this, FunctionEncodingStream);
   // Output name of the function.
rsmith wrote:
> DmitryPolukhin wrote:
> > rsmith wrote:
> > > Maybe it'd be simpler to just override the output stream here rather than creating a new mangler?
> > I'm not sure that it is simpler because it will also require substitutions save/restore for name mangling (mangleNameWithAbiTags) to produce the same substitutions twice (without implicate abi_tags and later with implicit abi_tags). IMHO, it is almost identical approaches but current one is a bit cleaner because it copies explicitly everything required from temp to outer mangler.
> I think we'd want to override the output stream to write to a temporary buffer at the point when we would otherwise write out the ABI tags, to avoid needing to save/restore any substitutions. But I agree, that seems more invasive than what you're doing here. I'll leave this up to you.
It is significant redesign and additional complexity to remember which exactly ABI tags we would like to rewrite later (it may not be the first call of writeAbiTags for current mangler). I would keep it as is.


More information about the cfe-commits mailing list