This is an archive of the discontinued LLVM Phabricator instance.

Improve attribute documentation to list which spellings are used in which syntaxes.
ClosedPublic

Authored by rsmith on Aug 29 2018, 7:03 PM.

Details

Summary

Instead of listing all the spellings (including attribute namespaces) in
the section heading, only list the actual attribute names there, and
list the spellings in the supported syntaxes table.

This allows us to properly describe things like [[fallthrough]], for
which we allow a clang:: prefix in C++ but not in C, and AlwaysInline,
which has one spelling as a GNU attribute and a different spelling as a
keyword, without needing to repeat the syntax description in the
documentation text.

Sample rendering: https://pste.eu/p/T1ZV.html

Diff Detail

Repository
rL LLVM

Event Timeline

rsmith created this revision.Aug 29 2018, 7:03 PM
aaron.ballman accepted this revision.Aug 30 2018, 11:07 AM

LGTM with a commenting nit. Thank you for this, I like this exposition better!

utils/TableGen/ClangAttrEmitter.cpp
3881 ↗(On Diff #163252)

We don't actually support Microsoft's attribute spellings currently and have no attributes there to document. I think the fixme should probably read "TODO: support documenting Microsoft spellings" or something more concrete.

This revision is now accepted and ready to land.Aug 30 2018, 11:07 AM
This revision was automatically updated to reflect the committed changes.
rsmith marked an inline comment as done.Aug 30 2018, 12:21 PM
rsmith added inline comments.
utils/TableGen/ClangAttrEmitter.cpp
3881 ↗(On Diff #163252)

Done. (I accidentally pushed the old version, so this is done in r341100.)

For what it's worth, we have one Microsoft spelling listed in the .td file already (but I assume this has no effect):

def Uuid : InheritableAttr {
  let Spellings = [Declspec<"uuid">, Microsoft<"uuid">];