[PATCH] D18035: [GCC] PR23529 Mangler part of attrbute abi_tag support

Dmitry Polukhin via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 14 23:15:44 PDT 2016


DmitryPolukhin added inline comments.

================
Comment at: lib/AST/ItaniumMangle.cpp:268-290
@@ -265,1 +267,25 @@
 
+  // abi_tag is a gcc attribute, taking one or more strings called "tags".
+  //
+  // The goal is to annotate against which version of a library an object was
+  // build and to be able to provide backwards compatibility ("dual abi").
+  //
+  // For this the emitted mangled names have to be different, while you don't
+  // want the user to have to use different names in the source.
+  //
+  // The abi_tag can be present on Struct, Var and Function  declarations as
+  // "explicit" tag, and on inline Namespace as "implicit" tag. Explicit tags
+  // are always emitted after the unqualified name, and (implicit) tags on
+  // namespace are not.
+  //
+  // For functions and variables there is a set of "implicitly available"
+  // tags. These tags are: all tags from the namespace/structs the name is
+  // embedded in, all tags from any template arguments of the name, and, for
+  // functions, alls tags used anywhere in the <bare-function-type> (i.e.
+  // parameters and sometimes the return type).
+  //
+  // For functions this is basically the list of all tags from the signature
+  // without the unqualified name and usually without the return type of the
+  // function. In `operator Type()` Type is NOT part of that list, as it is
+  // part of the unqualified name!
+  //
----------------
rnk wrote:
> I think it would be a valuable exercise to write up something more concrete than this in a .rst file in docs/. I think part of the reason why this patch has languished so long is because there is no specification or documentation to speak of. This new abi_tag is a major departure from the wonderful *standard* Itanium C++ ABI that Unix has enjoyed. On Windows, we suffer greatly from having to follow each and every implementation detail that Microsoft accidentally baked into their ABI. It would be good if we could put together a document that we could send back to someone who works on GCC, so that they can verify that that is how abi_tag is intended to work, even if GCC deviates from it in some places.
It was part of previous commit with syntax of the attribute, please see http://clang.llvm.org/docs/ItaniumMangleAbiTags.html

Also as far as I understand, Jason Merrill is going to write some document about it, see https://llvm.org/bugs/show_bug.cgi?id=23529#c58 a

================
Comment at: lib/AST/ItaniumMangle.cpp:427
@@ +426,3 @@
+  AbiTagState *AbiTags = nullptr;
+  AbiTagState AbiTagsRoot{ AbiTags };
+
----------------
majnemer wrote:
> Is this clang-format'd?
Yes, that is how clang-format formats this in-class {}-initializer. But I removed it and replaced with initialization in c-tor.


http://reviews.llvm.org/D18035





More information about the cfe-commits mailing list