[PATCH] D64838: [Attr] Support _attribute__ ((fallthrough))

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 5 11:34:23 PDT 2019


aaron.ballman added inline comments.


================
Comment at: clang/lib/Parse/ParseDecl.cpp:1767
     }
     return ParseSimpleDeclaration(Context, DeclEnd, attrs,
                                   true);
----------------
Should this also be passed `DeclSpecStart`?


================
Comment at: clang/lib/Parse/ParseStmt.cpp:233
+    GNUAttributeLoc = Tok.getLocation();
+    MaybeParseGNUAttributes(Attrs);
+    goto Retry;
----------------
xbolva00 wrote:
> Since you know that tok is kw_attr, I think you can use 'ParseGNUAttributes'.
Agreed, you don't need to use the Maybe check here.


================
Comment at: clang/lib/Parse/ParseStmt.cpp:156
   StmtResult Res;
+  bool SeenGNUAttributes = false;
+  SourceLocation GNUAttributeLoc;
----------------
I think you can use `GNUAttributeLoc.isValid()` instead of using the extra local variable.


================
Comment at: clang/test/SemaCXX/warn-unused-label-error.cpp:23
+#pragma weak unused_local_static
+    __attribute__((unused)) // expected-error {{'unused' attribute cannot be applied to a statement}}
+    ;
----------------
This change in diagnostics makes me very happy!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64838





More information about the cfe-commits mailing list