summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp4
-rw-r--r--clang/unittests/Format/FormatTest.cpp8
2 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 02d49a0e1e2..01c8acf0e66 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -660,15 +660,15 @@ void UnwrappedLineParser::parseStructuralElement() {
}
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();
}
}
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 3b3f5fb74ca..a49a35c1def 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -2191,11 +2191,11 @@ TEST_F(FormatTest, FormatsInlineASM) {
" : \"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 @@ TEST_F(FormatTest, FormatsInlineASM) {
" call [edx][eax*4] // stdcall\n"
" }\n"
"}"));
+ verifyFormat("void function() {\n"
+ " // comment\n"
+ " asm(\"\");\n"
+ "}");
}
TEST_F(FormatTest, FormatTryCatch) {
OpenPOWER on IntegriCloud