[PATCH] D86711: [clang-format] Parse __attribute((foo)) as a pointer qualifier
Alexander Richardson via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 28 03:32:21 PDT 2020
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
arichardson marked an inline comment as done.
Closed by commit rG37cdabdb82e3: [clang-format] Parse __attribute((foo)) as a pointer qualifier (authored by arichardson).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86711/new/
https://reviews.llvm.org/D86711
Files:
clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/FormatTest.cpp
Index: clang/unittests/Format/FormatTest.cpp
===================================================================
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -8059,6 +8059,8 @@
verifyIndependentOfContext("MACRO(A *volatile a);");
verifyIndependentOfContext("MACRO(A *__volatile a);");
verifyIndependentOfContext("MACRO(A *__volatile__ a);");
+ verifyIndependentOfContext("MACRO(A *__attribute__((foo)) a);");
+ verifyIndependentOfContext("MACRO(A *__attribute((foo)) a);");
verifyIndependentOfContext("MACRO('0' <= c && c <= '9');");
verifyFormat("void f() { f(float{1}, a * a); }");
// FIXME: Is there a way to make this work?
Index: clang/lib/Format/TokenAnnotator.cpp
===================================================================
--- clang/lib/Format/TokenAnnotator.cpp
+++ clang/lib/Format/TokenAnnotator.cpp
@@ -1892,7 +1892,7 @@
if (!NextToken ||
NextToken->isOneOf(tok::arrow, tok::equal, tok::kw_const,
tok::kw_restrict, tok::kw_volatile,
- tok::kw_noexcept) ||
+ tok::kw___attribute, tok::kw_noexcept) ||
(NextToken->is(tok::l_brace) && !NextToken->getNextNonComment()))
return TT_PointerOrReference;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86711.288573.patch
Type: text/x-patch
Size: 1290 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200828/37f23e46/attachment.bin>
More information about the cfe-commits
mailing list