Much semicolon after namespaces.
We now leave the semicolon in the line of the closing brace in: namespace { ... }; llvm-svn: 174514
This commit is contained in:
parent
c485b4e5b8
commit
046b9306d4
|
@ -505,6 +505,10 @@ void UnwrappedLineParser::parseNamespace() {
|
|||
nextToken();
|
||||
if (FormatTok.Tok.is(tok::l_brace)) {
|
||||
parseBlock(/*MustBeDeclaration=*/ true, 0);
|
||||
// Munch the semicolon after a namespace. This is more common than one would
|
||||
// think. Puttin the semicolon into its own line is very ugly.
|
||||
if (FormatTok.Tok.is(tok::semi))
|
||||
nextToken();
|
||||
addUnwrappedLine();
|
||||
}
|
||||
// FIXME: Add error handling.
|
||||
|
|
|
@ -617,6 +617,15 @@ TEST_F(FormatTest, FormatsNamespaces) {
|
|||
verifyFormat("using namespace some_namespace;\n"
|
||||
"class A {\n};\n"
|
||||
"void f() { f(); }");
|
||||
|
||||
// This code is more common than we thought; if we
|
||||
// layout this correctly the semicolon will go into
|
||||
// its own line, which is undesireable.
|
||||
verifyFormat("namespace {\n};");
|
||||
verifyFormat("namespace {\n"
|
||||
"class A {\n"
|
||||
"};\n"
|
||||
"};");
|
||||
}
|
||||
|
||||
TEST_F(FormatTest, FormatsExternC) {
|
||||
|
|
Loading…
Reference in New Issue