forked from OSchip/llvm-project
clang-format: Understand that "auto" is a type.
Before: MACRO(auto * a); After: MACRO(auto *a); llvm-svn: 205517
This commit is contained in:
parent
92e0fc0484
commit
cc7bf7fda1
|
@ -196,7 +196,7 @@ private:
|
|||
!CurrentToken->Next->HasUnescapedNewline &&
|
||||
!CurrentToken->Next->isTrailingComment())
|
||||
HasMultipleParametersOnALine = true;
|
||||
if (CurrentToken->is(tok::kw_const) ||
|
||||
if (CurrentToken->isOneOf(tok::kw_const, tok::kw_auto) ||
|
||||
CurrentToken->isSimpleTypeSpecifier())
|
||||
Contexts.back().IsExpression = false;
|
||||
if (!consumeToken())
|
||||
|
|
|
@ -4554,6 +4554,12 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) {
|
|||
verifyFormat("foo<b && false>();");
|
||||
verifyFormat("foo<b & 1>();");
|
||||
|
||||
verifyIndependentOfContext("MACRO(int *i);");
|
||||
verifyIndependentOfContext("MACRO(auto *a);");
|
||||
verifyIndependentOfContext("MACRO(const A *a);");
|
||||
// FIXME: Is there a way to make this work?
|
||||
// verifyIndependentOfContext("MACRO(A *a);");
|
||||
|
||||
// FIXME: We cannot handle this case yet; we might be able to figure out that
|
||||
// foo<x> d > v; doesn't make sense.
|
||||
verifyFormat("foo<a < b && c> d > v;");
|
||||
|
|
Loading…
Reference in New Issue