[PATCH] D79354: [clang-format] [PR34574] Handle [[nodiscard]] attribute in class declaration

Krasimir Georgiev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 7 13:02:19 PDT 2020


krasimir accepted this revision.
krasimir added a comment.
This revision is now accepted and ready to land.

Thank you! Looks good with a couple of nits.



================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2402
   // it is often token-pasted.
+  // An [[attribute]] can be before the identifier
   while (FormatTok->isOneOf(tok::identifier, tok::coloncolon, tok::hashhash,
----------------
nit: add a fullstop


================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2431
+        // Consume the closing TT_AttributeSquare.
+        nextToken();
+      }
----------------
slight concern: check if the next token is `TT_AttributeSquare` and only consume it in that case. Other languages that are using `TT_AttributeSquare` may have a different syntax for their attributes than `[[attribute]]`, e.g. recently added [[ https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/attributes/ | C# `[attributes]` ]].


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

https://reviews.llvm.org/D79354





More information about the cfe-commits mailing list