[PATCH] D30009: Add support for '#pragma clang attribute'

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 29 18:04:51 PDT 2018

rsmith added a comment.

In https://reviews.llvm.org/D30009#1218647, @rsmith wrote:

> One consequence of this patch (see https://reviews.llvm.org/rL341002) is that adding documentation to an existing attribute //changes the behavior of Clang//. That does not seem acceptable to me: documentation improvements should not change which attributes we allow this pragma to appertain to.
> If we really want an "only documented attribtues can use this feature" rule (and I'm really not convinced that is a useful rule to enforce), I think the best way to do that is to add another flag on the Attr instance in the .td file to opt the attribute out of `#pragma clang` support, opt out all the undocumented attributes, and add an error to TableGen if we find that an undocumented attribute has `#pragma clang` support enabled.

I've changed how we determine whether `#pragma clang attribute` is usable in https://reviews.llvm.org/rL341009 so that future documentation changes don't change clang's behavior. But we should still consider whether the attributes that were explicitly opted out of this feature in that revision really should be. What harm does allowing this feature for attributes that we don't document do? Most of those attributes are documented by GCC anyway, and the user experience of opting them out seems inconsistent and arbitrary. If the goal is to use this pragma as a forcing function to get documentation written for the attributes, it hasn't worked.



More information about the cfe-commits mailing list