forked from OSchip/llvm-project
clang-format: Fix false positive in cast detection.
Before (with spaces in parentheses): void inFunction() { std::function<void( int, int )> fct; } After: void inFunction() { std::function<void( int, int)> fct; } llvm-svn: 251284
This commit is contained in:
parent
84d7a40c7a
commit
74331d4c43
|
@ -1086,7 +1086,8 @@ private:
|
|||
Tok.Previous->isOneOf(TT_PointerOrReference, TT_TemplateCloser) ||
|
||||
Tok.Previous->isSimpleTypeSpecifier();
|
||||
bool ParensCouldEndDecl =
|
||||
Tok.Next && Tok.Next->isOneOf(tok::equal, tok::semi, tok::l_brace);
|
||||
Tok.Next &&
|
||||
Tok.Next->isOneOf(tok::equal, tok::semi, tok::l_brace, tok::greater);
|
||||
bool IsSizeOfOrAlignOf =
|
||||
LeftOfParens && LeftOfParens->isOneOf(tok::kw_sizeof, tok::kw_alignof);
|
||||
if (ParensAreType && !ParensCouldEndDecl && !IsSizeOfOrAlignOf &&
|
||||
|
|
|
@ -8398,6 +8398,8 @@ TEST_F(FormatTest, ConfigurableSpacesInParentheses) {
|
|||
verifyFormat("call( x, y, z );", Spaces);
|
||||
verifyFormat("call();", Spaces);
|
||||
verifyFormat("std::function<void( int, int )> callback;", Spaces);
|
||||
verifyFormat("void inFunction() { std::function<void( int, int )> fct; }",
|
||||
Spaces);
|
||||
verifyFormat("while ( (bool)1 )\n"
|
||||
" continue;",
|
||||
Spaces);
|
||||
|
@ -10633,6 +10635,9 @@ TEST_F(FormatTest, SpacesInAngles) {
|
|||
verifyFormat("f< int, float >();", Spaces);
|
||||
verifyFormat("template <> g() {}", Spaces);
|
||||
verifyFormat("template < std::vector< int > > f() {}", Spaces);
|
||||
verifyFormat("std::function< void(int, int) > fct;", Spaces);
|
||||
verifyFormat("void inFunction() { std::function< void(int, int) > fct; }",
|
||||
Spaces);
|
||||
|
||||
Spaces.Standard = FormatStyle::LS_Cpp03;
|
||||
Spaces.SpacesInAngles = true;
|
||||
|
|
Loading…
Reference in New Issue