[clang-format] Detect constructor initializers preceded by `noexcept`.

Patch by Erik Kessler, thank you.

llvm-svn: 262402
This commit is contained in:
Daniel Jasper 2016-03-01 21:41:58 +00:00
parent 46e57fd073
commit 56ef6aca2b
2 changed files with 4 additions and 1 deletions

View File

@ -505,7 +505,7 @@ private:
Tok->Type = TT_BitFieldColon;
} else if (Contexts.size() == 1 &&
!Line.First->isOneOf(tok::kw_enum, tok::kw_case)) {
if (Tok->Previous->is(tok::r_paren))
if (Tok->Previous->isOneOf(tok::r_paren, tok::kw_noexcept))
Tok->Type = TT_CtorInitializerColon;
else
Tok->Type = TT_InheritanceColon;

View File

@ -10389,6 +10389,9 @@ TEST_F(FormatTest, BreakConstructorInitializersBeforeComma) {
verifyFormat("SomeClass::Constructor()\n"
" : a(a) {}",
Style);
verifyFormat("SomeClass::Constructor() noexcept\n"
" : a(a) {}",
Style);
verifyFormat("SomeClass::Constructor()\n"
" : a(a)\n"
" , b(b)\n"