r236985 - clang-format: Don't merge subsequent lines into _asm blocks.

Daniel Jasper djasper at google.com
Mon May 11 04:59:47 PDT 2015


Author: djasper
Date: Mon May 11 06:59:46 2015
New Revision: 236985

URL: http://llvm.org/viewvc/llvm-project?rev=236985&view=rev
Log:
clang-format: Don't merge subsequent lines into _asm blocks.

Before:
  _asm {
  } int i;

After:
  _asm {
  }
  int i;

Modified:
    cfe/trunk/lib/Format/UnwrappedLineParser.cpp
    cfe/trunk/unittests/Format/FormatTest.cpp

Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.cpp?rev=236985&r1=236984&r2=236985&view=diff
==============================================================================
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Mon May 11 06:59:46 2015
@@ -672,6 +672,7 @@ void UnwrappedLineParser::parseStructura
         if (FormatTok->is(tok::r_brace)) {
           FormatTok->Type = TT_InlineASMBrace;
           nextToken();
+          addUnwrappedLine();
           break;
         }
         FormatTok->Finalized = true;

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=236985&r1=236984&r2=236985&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Mon May 11 06:59:46 2015
@@ -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) {





More information about the cfe-commits mailing list