clang-format: Fix formatting of inline asm.
Specifically, adjust the leading "__asm {" and trailing "}" while still
leaving the assembly inside it alone.
This fixes llvm.org/PR22190.
llvm-svn: 225623
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 3b3f5fb..a49a35c1 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -2191,11 +2191,11 @@
" : \"a\"(value));");
EXPECT_EQ(
"void NS_InvokeByIndex(void *that, unsigned int methodIndex) {\n"
- " __asm {\n"
+ " __asm {\n"
" mov edx,[that] // vtable in edx\n"
" mov eax,methodIndex\n"
" call [edx][eax*4] // stdcall\n"
- " }\n"
+ " }\n"
"}",
format("void NS_InvokeByIndex(void *that, unsigned int methodIndex) {\n"
" __asm {\n"
@@ -2204,6 +2204,10 @@
" call [edx][eax*4] // stdcall\n"
" }\n"
"}"));
+ verifyFormat("void function() {\n"
+ " // comment\n"
+ " asm(\"\");\n"
+ "}");
}
TEST_F(FormatTest, FormatTryCatch) {