[PATCH] Add PragmaAttr and Pragma Spelling to Tablegen

Reid Kleckner rnk at google.com
Tue May 27 15:28:26 PDT 2014


On Sat, May 24, 2014 at 8:28 AM, Aaron Ballman <aaron at aaronballman.com>wrote:
>
> > My first idea is to add a tablegen property like "HasPrettyPrinter = 0
> or 1"
> > that supresses emission of the default printPretty method.  Then again,
> we
> > kind of want the default version when the GNU and C++11 spellings of the
> > attribute are used.
>
> That seems like the wrong way to go about it though, since this is a
> new *spelling*, not a wholly new semantic kind of attribute (which I
> think we really want to avoid). We could possibly attach a custom
> pretty printer to the spelling itself (a la a code block), but that
> seems a bit skeezy because the arguments are rather important and the
> spelling shouldn't have to care about the arguments.
>

How about this: when generating the prettyPrint implementation, if there is
a pragma spelling, call MyAttr::printPrettyPragma(...).  Any attribute with
a pragma spelling will have to provide this method in lib/AST/AttrImpl.cpp.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140527/7d512be9/attachment.html>


More information about the cfe-commits mailing list