From: Daniel Jasper Date: Mon, 11 May 2015 11:59:46 +0000 (+0000) Subject: clang-format: Don't merge subsequent lines into _asm blocks. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d775e3645631761b899221b78000d5776cfe10bd;p=clang clang-format: Don't merge subsequent lines into _asm blocks. Before: _asm { } int i; After: _asm { } int i; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236985 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp index a2afcc0fd5..6dee251a91 100644 --- a/lib/Format/UnwrappedLineParser.cpp +++ b/lib/Format/UnwrappedLineParser.cpp @@ -672,6 +672,7 @@ void UnwrappedLineParser::parseStructuralElement() { if (FormatTok->is(tok::r_brace)) { FormatTok->Type = TT_InlineASMBrace; nextToken(); + addUnwrappedLine(); break; } FormatTok->Finalized = true; diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index a70cab1096..43f94f0ce6 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -2328,6 +2328,12 @@ TEST_F(FormatTest, FormatsInlineASM) { " // comment\n" " asm(\"\");\n" "}"); + EXPECT_EQ("__asm {\n" + "}\n" + "int i;", + format("__asm {\n" + "}\n" + "int i;")); } TEST_F(FormatTest, FormatTryCatch) {