[PATCH] D51329: [Attribute/Diagnostics] Print macro instead of whole attribute for address_space

Leonard Chan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 29 11:43:46 PDT 2018


leonardchan added inline comments.


================
Comment at: lib/AST/TypePrinter.cpp:1370
+
+    // Remove the underlying address space so it won't be printed.
+    SplitQualType SplitTy = T->getModifiedType().split();
----------------
rsmith wrote:
> leonardchan wrote:
> > rsmith wrote:
> > > This is unnecessary; just print the modified type here. (The modified type by definition does not have the attribute applied to it.)
> > When you say the modified type, do you mean just the type without it's qualifiers? I wasn't sure if removing all the qualifiers would suffice since there were also other  non-address_space qualifiers that could be printed.
> I mean `T->getModifiedType()`, which tracks what the type was before the attribute was applied.
Oh, I understand that you meant `T->getModifiedType()`. This is a special case when printing the `address_space` since even though the attribute is applied and printed here, when we reach the qualifiers of the modified type, the address space will still be printed unless we remove it here.

I'm not sure if there's a better way to do this though.


Repository:
  rC Clang

https://reviews.llvm.org/D51329





More information about the cfe-commits mailing list