[PATCH] D86713: [clang-format] Parse nullability attributes as a pointer qualifier

Alexander Richardson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 27 09:03:09 PDT 2020


arichardson added a comment.

In D86713#2242354 <https://reviews.llvm.org/D86713#2242354>, @JakeMerdichAMD wrote:

> In D86713#2242300 <https://reviews.llvm.org/D86713#2242300>, @arichardson wrote:
>
>> In D86713#2242253 <https://reviews.llvm.org/D86713#2242253>, @JakeMerdichAMD wrote:
>>
>>> LGTM, again assuming tests pass locally (patch did not resolve).
>>>
>>> Out of curiosity, is _Atomic on your radar? I found some code in clang proper that handled restrict and _Atomic together. C/C++ have way too many qualifiers...
>>
>> I have not looked at _Atomic yet and it's probably low priority for me unless it's a trivial change.
>> My main motivation with these changes is to format a `__capability` pointer qualifier correctly (an extension that we add for our out-of-tree CHERI C/C++ dialect).
>
> I don't know of anyone who uses it yet, so just adding it for posterity, definitely not a blocker. Were you planning on handling `__capability` directly or in a user-configurable option? I can imagine other ad-hoc pointer qualifiers specific to static analysis tools or as properly-ifdef'd aliases of `__attribute__(...)`, so an option might be useful.

I'm not sure yet what the best solution is. I was thinking of either

  a) option to treat double-underscore prefixed strings after `*/&` as qualifiers (probably on by default, but not sure about that).
  b) adding a config option with a list of strings that should be treated as qualifiers
  c) Adding a new __capability keyword to clang-format since it already includes things such as Qt-specific keywords.
  d) Option b) but with __capability included in the default list of qualifiers.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86713/new/

https://reviews.llvm.org/D86713



More information about the cfe-commits mailing list