forked from OSchip/llvm-project
clang-format: Don't butcher __asm blocks.
Instead completely cop out of formatting them for now. This fixes llvm.org/PR20618. llvm-svn: 216501
This commit is contained in:
parent
7d4f2cebdf
commit
8f46365481
|
@ -658,6 +658,21 @@ void UnwrappedLineParser::parseStructuralElement() {
|
|||
break;
|
||||
}
|
||||
break;
|
||||
case tok::kw_asm:
|
||||
FormatTok->Finalized = true;
|
||||
nextToken();
|
||||
if (FormatTok->is(tok::l_brace)) {
|
||||
FormatTok->Finalized = true;
|
||||
while (FormatTok) {
|
||||
FormatTok->Finalized = true;
|
||||
if (FormatTok->is(tok::r_brace)) {
|
||||
nextToken();
|
||||
break;
|
||||
}
|
||||
nextToken();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case tok::kw_namespace:
|
||||
parseNamespace();
|
||||
return;
|
||||
|
|
|
@ -2070,6 +2070,21 @@ TEST_F(FormatTest, FormatsInlineASM) {
|
|||
" \"xchgq\\t%%rbx, %%rsi\\n\\t\"\n"
|
||||
" : \"=a\"(*rEAX), \"=S\"(*rEBX), \"=c\"(*rECX), \"=d\"(*rEDX)\n"
|
||||
" : \"a\"(value));");
|
||||
EXPECT_EQ(
|
||||
"void NS_InvokeByIndex(void *that, unsigned int methodIndex) {\n"
|
||||
" __asm {\n"
|
||||
" mov edx,[that] // vtable in edx\n"
|
||||
" mov eax,methodIndex\n"
|
||||
" call [edx][eax*4] // stdcall\n"
|
||||
" }\n"
|
||||
"}",
|
||||
format("void NS_InvokeByIndex(void *that, unsigned int methodIndex) {\n"
|
||||
" __asm {\n"
|
||||
" mov edx,[that] // vtable in edx\n"
|
||||
" mov eax,methodIndex\n"
|
||||
" call [edx][eax*4] // stdcall\n"
|
||||
" }\n"
|
||||
"}"));
|
||||
}
|
||||
|
||||
TEST_F(FormatTest, FormatTryCatch) {
|
||||
|
|
Loading…
Reference in New Issue