[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Wed May 22 23:38:17 PDT 2024
================
@@ -1489,11 +1489,25 @@ TEST_F(TokenAnnotatorTest, RequiresDoesNotChangeParsingOfTheRest) {
TEST_F(TokenAnnotatorTest, UnderstandsAsm) {
auto Tokens = annotate("__asm{\n"
"a:\n"
- "};");
- ASSERT_EQ(Tokens.size(), 7u) << Tokens;
+ ": x\n"
+ ":};");
+ ASSERT_EQ(Tokens.size(), 10u) << Tokens;
EXPECT_TOKEN(Tokens[0], tok::kw_asm, TT_Unknown);
EXPECT_TOKEN(Tokens[1], tok::l_brace, TT_InlineASMBrace);
- EXPECT_TOKEN(Tokens[4], tok::r_brace, TT_InlineASMBrace);
+ EXPECT_TOKEN(Tokens[3], tok::colon, TT_InlineASMColon);
+ EXPECT_TOKEN(Tokens[4], tok::colon, TT_InlineASMColon);
+ EXPECT_TOKEN(Tokens[6], tok::colon, TT_InlineASMColon);
+ EXPECT_TOKEN(Tokens[7], tok::r_brace, TT_InlineASMBrace);
+
+ Tokens = annotate("__asm__ volatile (\n"
+ "a:\n"
+ ": x\n"
+ ":);");
----------------
owenca wrote:
Same question here. Can we use an example from https://en.cppreference.com/w/c/language/asm instead? Also, please add a test for `asm(...)`.
https://github.com/llvm/llvm-project/pull/92617
More information about the cfe-commits
mailing list