[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

Valeriy Savchenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 18 06:58:59 PST 2021


vsavchenko added inline comments.


================
Comment at: clang/test/Parser/stmt-attributes.c:5
+
+  __attribute__((unknown_attribute));            // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
+  __attribute__((unknown_attribute)) {}          // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
----------------
aaron.ballman wrote:
> Given that these are parser tests, I think you can drop the attribute name itself except in the cases where you explicitly want to test that an unknown attribute introduces the start of a declaration (or things where the attribute identifier matters for some reason). This will reduce the amount of `expected-warning` comments we need to add.
> 
> Also, because this change impacts C++ and ObjC/C++ as well, I think we should have some tests for language-specific constructs like lambdas, range-based for loops, blocks, etc.
This test is mostly a copy-paste of a similar test for C++11 statement attributes.
I think that these cases show that GNU spelling for attributes doesn't break anything if we put it in front of these various statements.  And you are absolutely right that we need to add more cases for C++ and Obj-C constructs.  But I don't understand about 'unknown_attribute'.  What should I replace it with?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93630



More information about the cfe-commits mailing list