Dont break between (( in __attribute__((.
Before:
void aaaaaaaaaaaaaaaaaa() __attribute__(
(aaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaa));
After:
void aaaaaaaaaaaaaaaaaa()
__attribute__((aaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaa));
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176260 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index 5c17223..e127f4a 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/lib/Format/TokenAnnotator.cpp
@@ -1092,6 +1092,9 @@
return false;
if (Left.is(tok::equal) && Line.Type == LT_VirtualFunctionDecl)
return false;
+ if (Left.is(tok::l_paren) && Right.is(tok::l_paren) && Left.Parent &&
+ Left.Parent->is(tok::kw___attribute))
+ return false;
if (Right.Type == TT_LineComment)
// We rely on MustBreakBefore being set correctly here as we should not
@@ -1120,7 +1123,7 @@
Right.is(tok::colon) || Left.is(tok::coloncolon) ||
Left.is(tok::semi) || Left.is(tok::l_brace) ||
(Left.is(tok::r_paren) && Left.Type != TT_CastRParen &&
- Right.is(tok::identifier)) ||
+ (Right.is(tok::identifier) || Right.is(tok::kw___attribute))) ||
(Left.is(tok::l_paren) && !Right.is(tok::r_paren)) ||
(Left.is(tok::l_square) && !Right.is(tok::r_square));
}