[PATCH] D99338: [clang][parser] Allow GNU-style attributes in enum specifiers

2021-03-30 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder abandoned this revision.
tbaeder added a comment.

Abandoning in favor of https://reviews.llvm.org/D97362


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

https://reviews.llvm.org/D99338

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99338: [clang][parser] Allow GNU-style attributes in enum specifiers

2021-03-29 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

To be clear, this is expected to be an NFC change that allows D97362 
 to be applied without breaking bots? If so, 
it'd be helpful to have the changes as part of D97362 
 because they're critical to that review and 
so that we get appropriate CI pre-merge testing.


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

https://reviews.llvm.org/D99338

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99338: [clang][parser] Allow GNU-style attributes in enum specifiers

2021-03-26 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 333511.

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

https://reviews.llvm.org/D99338

Files:
  clang/lib/Parse/ParseDecl.cpp


Index: clang/lib/Parse/ParseDecl.cpp
===
--- clang/lib/Parse/ParseDecl.cpp
+++ clang/lib/Parse/ParseDecl.cpp
@@ -4653,7 +4653,8 @@
   // or opaque-enum-declaration anywhere.
   if (IsElaboratedTypeSpecifier && !getLangOpts().MicrosoftExt &&
   !getLangOpts().ObjC) {
-ProhibitAttributes(attrs);
+ProhibitCXX11Attributes(attrs, diag::err_attributes_not_allowed,
+/*DiagnoseEmptyAttrs=*/true);
 if (BaseType.isUsable())
   Diag(BaseRange.getBegin(), diag::ext_enum_base_in_type_specifier)
   << (AllowEnumSpecifier == AllowDefiningTypeSpec::Yes) << BaseRange;


Index: clang/lib/Parse/ParseDecl.cpp
===
--- clang/lib/Parse/ParseDecl.cpp
+++ clang/lib/Parse/ParseDecl.cpp
@@ -4653,7 +4653,8 @@
   // or opaque-enum-declaration anywhere.
   if (IsElaboratedTypeSpecifier && !getLangOpts().MicrosoftExt &&
   !getLangOpts().ObjC) {
-ProhibitAttributes(attrs);
+ProhibitCXX11Attributes(attrs, diag::err_attributes_not_allowed,
+/*DiagnoseEmptyAttrs=*/true);
 if (BaseType.isUsable())
   Diag(BaseRange.getBegin(), diag::ext_enum_base_in_type_specifier)
   << (AllowEnumSpecifier == AllowDefiningTypeSpec::Yes) << BaseRange;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99338: [clang][parser] Allow GNU-style attributes in enum specifiers

2021-03-25 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision.
tbaeder added reviewers: aaron.ballman, rsmith.
tbaeder requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

We are parsing both C++11 and GNU-style attributes here, but the previous 
`ProhibitAttributes()` call was never working for GNU-style attributes.

GNU-style attributes are however expected to be parsed and not diagnosed, for 
example in `clang/test/Sema/ast-print` in the following code:

  // CHECK-LABEL: enum __attribute__((deprecated(""))) EnumWithAttributes2 
*EnumWithAttributes2Ptr;
  // expected-warning@+2 {{'EnumWithAttributes2' is deprecated}}
  // expected-note@+1 {{'EnumWithAttributes2' has been explicitly marked 
deprecated here}}
  enum __attribute__((deprecated)) EnumWithAttributes2 *EnumWithAttributes2Ptr;

This is essentially the same as https://reviews.llvm.org/D99278 and needs 
https://reviews.llvm.org/D97362 to be applied first.

The comment just above this change is a bit confusing since it tries to explain 
that "an elaborated-type-specifier has a much more constrained grammar", but 
does not mention any attributes.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99338

Files:
  clang/lib/Parse/ParseDecl.cpp


Index: clang/lib/Parse/ParseDecl.cpp
===
--- clang/lib/Parse/ParseDecl.cpp
+++ clang/lib/Parse/ParseDecl.cpp
@@ -4653,7 +4653,7 @@
   // or opaque-enum-declaration anywhere.
   if (IsElaboratedTypeSpecifier && !getLangOpts().MicrosoftExt &&
   !getLangOpts().ObjC) {
-ProhibitAttributes(attrs);
+ProhibitCXX11Attributes(attrs, diag::err_attributes_not_allowed, 
/*DiagnoseEmptyAttrs=*/true);
 if (BaseType.isUsable())
   Diag(BaseRange.getBegin(), diag::ext_enum_base_in_type_specifier)
   << (AllowEnumSpecifier == AllowDefiningTypeSpec::Yes) << BaseRange;


Index: clang/lib/Parse/ParseDecl.cpp
===
--- clang/lib/Parse/ParseDecl.cpp
+++ clang/lib/Parse/ParseDecl.cpp
@@ -4653,7 +4653,7 @@
   // or opaque-enum-declaration anywhere.
   if (IsElaboratedTypeSpecifier && !getLangOpts().MicrosoftExt &&
   !getLangOpts().ObjC) {
-ProhibitAttributes(attrs);
+ProhibitCXX11Attributes(attrs, diag::err_attributes_not_allowed, /*DiagnoseEmptyAttrs=*/true);
 if (BaseType.isUsable())
   Diag(BaseRange.getBegin(), diag::ext_enum_base_in_type_specifier)
   << (AllowEnumSpecifier == AllowDefiningTypeSpec::Yes) << BaseRange;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits