r262402 - [clang-format] Detect constructor initializers preceded by `noexcept`.
Daniel Jasper via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 1 13:41:58 PST 2016
Author: djasper
Date: Tue Mar 1 15:41:58 2016
New Revision: 262402
URL: http://llvm.org/viewvc/llvm-project?rev=262402&view=rev
Log:
[clang-format] Detect constructor initializers preceded by `noexcept`.
Patch by Erik Kessler, thank you.
Modified:
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/FormatTest.cpp
Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=262402&r1=262401&r2=262402&view=diff
==============================================================================
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Tue Mar 1 15:41:58 2016
@@ -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;
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=262402&r1=262401&r2=262402&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Tue Mar 1 15:41:58 2016
@@ -10389,6 +10389,9 @@ TEST_F(FormatTest, BreakConstructorIniti
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"
More information about the cfe-commits
mailing list