summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-07-06 11:30:34 +0000
committerDaniel Jasper <djasper@google.com>2015-07-06 11:30:34 +0000
commita5fa4d1d7e9e95a0e0385f4fee7fd102d7db41a9 (patch)
treedfbc717aab806d1f10fba3dd486b5bce41237879 /clang/lib/Format
parent25026f52d09d3c177c2562e0db076931320b7129 (diff)
downloadbcm5719-llvm-a5fa4d1d7e9e95a0e0385f4fee7fd102d7db41a9.tar.gz
bcm5719-llvm-a5fa4d1d7e9e95a0e0385f4fee7fd102d7db41a9.zip
clang-format: Fix __attribute__ being treated as decl name.
__attribute__ was treated as the name of a function definition, with the tokens in parentheses being the parameter list. This formats incorrectly with AlwaysBreakAfterDefinitionReturnType. Fix it by treating __attribute__ like decltype. Patch by Strager Neds, thank you. llvm-svn: 241439
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 0e1f14ad05f..f4b9c4eee9e 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -505,7 +505,8 @@ private:
if (Line.MustBeDeclaration && Contexts.size() == 1 &&
!Contexts.back().IsExpression && !Line.startsWith(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:
OpenPOWER on IntegriCloud