clang-format: Restrict r272537 to function ref qualifiers.

Seems this isn't generally desirable.

Before:
  int const * a;

After:
  int const* a;

llvm-svn: 272548
This commit is contained in:
Daniel Jasper 2016-06-13 14:45:12 +00:00
parent daae87aa21
commit 1f5d6371fd
2 changed files with 3 additions and 1 deletions

View File

@ -1994,7 +1994,8 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
return false;
if (Right.is(TT_PointerOrReference))
return (Left.is(tok::r_paren) && Line.MightBeFunctionDecl) ||
(Left.Tok.isLiteral() || Left.is(tok::kw_const) ||
(Left.Tok.isLiteral() || (Left.is(tok::kw_const) && Left.Previous &&
Left.Previous->is(tok::r_paren)) ||
(!Left.isOneOf(TT_PointerOrReference, tok::l_paren) &&
(Style.PointerAlignment != FormatStyle::PAS_Left ||
Line.IsMultiVariableDeclStmt)));

View File

@ -5755,6 +5755,7 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) {
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
" aaaaaaaaaaaaaaaaaaaaaaaaaaaa, *aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);");
verifyGoogleFormat("int const* a = &b;");
verifyGoogleFormat("**outparam = 1;");
verifyGoogleFormat("*outparam = a * b;");
verifyGoogleFormat("int main(int argc, char** argv) {}");