[PATCH] clang-format: Fix __attribute__ being treated as decl name.
strager
strager.nds at gmail.com
Fri Jun 12 14:38:50 PDT 2015
Try to fix binary test problem.
http://reviews.llvm.org/D10373
Files:
lib/Format/TokenAnnotator.cpp
unittests/Format/FormatTest.cpp
Index: lib/Format/TokenAnnotator.cpp
===================================================================
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -506,7 +506,8 @@
if (Line.MustBeDeclaration && Contexts.size() == 1 &&
!Contexts.back().IsExpression && Line.First->isNot(TT_ObjCProperty) &&
(!Tok->Previous ||
- !Tok->Previous->isOneOf(tok::kw_decltype, TT_LeadingJavaAnnotation)))
+ !Tok->Previous->isOneOf(tok::kw_decltype, tok::kw___attribute,
+ TT_LeadingJavaAnnotation)))
Line.MightBeFunctionDecl = true;
break;
case tok::l_square:
Index: unittests/Format/FormatTest.cpp
===================================================================
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -5866,6 +5866,11 @@
verifyFormat("SomeType s __attribute__((unused)) (InitValue);");
verifyFormat("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa __attribute__((unused))\n"
"aaaaaaaaaaaaaaaaaaaaaaa(int i);");
+ FormatStyle AfterType = getLLVMStyle();
+ AfterType.AlwaysBreakAfterDefinitionReturnType = true;
+ verifyFormat("__attribute__((nodebug)) void\n"
+ "foo() {}\n",
+ AfterType);
}
TEST_F(FormatTest, UnderstandsEllipsis) {
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10373.27603.patch
Type: text/x-patch
Size: 1325 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150612/feb387a8/attachment.bin>
More information about the cfe-commits
mailing list