Specifically, adjust the leading "__asm {" and trailing "}" while still
leaving the assembly inside it alone.
This fixes llvm.org/PR22190.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225623
91177308-0d34-0410-b5e6-
96231b3b80d8
}
break;
case tok::kw_asm:
- FormatTok->Finalized = true;
nextToken();
if (FormatTok->is(tok::l_brace)) {
+ nextToken();
while (FormatTok && FormatTok->isNot(tok::eof)) {
- FormatTok->Finalized = true;
if (FormatTok->is(tok::r_brace)) {
nextToken();
break;
}
+ FormatTok->Finalized = true;
nextToken();
}
}
" : \"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"
" call [edx][eax*4] // stdcall\n"
" }\n"
"}"));
+ verifyFormat("void function() {\n"
+ " // comment\n"
+ " asm(\"\");\n"
+ "}");
}
TEST_F(FormatTest, FormatTryCatch) {