From d775e3645631761b899221b78000d5776cfe10bd Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Mon, 11 May 2015 11:59:46 +0000 Subject: [PATCH] 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 --- lib/Format/UnwrappedLineParser.cpp | 1 + unittests/Format/FormatTest.cpp | 6 ++++++ 2 files changed, 7 insertions(+) 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) { -- 2.40.0