[llvm] [RISCV][MC] Emit Better Token Diagnostics (PR #209700)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 15 01:57:42 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- llvm/utils/TableGen/AsmMatcherEmitter.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
index 91d2ffbaf..df9435dc9 100644
--- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp
+++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
@@ -2528,7 +2528,8 @@ static void emitRegisterMatchErrorFunc(AsmMatcherInfo &Info, raw_ostream &OS) {
   OS << "}\n\n";
 }
 
-/// emitTokenDiagFunction - Emit a function mapping token class kinds to diagnostics.
+/// emitTokenDiagFunction - Emit a function mapping token class kinds to
+/// diagnostics.
 static void emitTokenDiagFunction(AsmMatcherInfo &Info, raw_ostream &OS) {
   OS << "static unsigned getDiagKindFromTokenClass(MatchClassKind Kind) {\n";
   OS << "  switch (Kind) {\n";
@@ -2537,8 +2538,8 @@ static void emitTokenDiagFunction(AsmMatcherInfo &Info, raw_ostream &OS) {
   for (const auto &CI : Info.Classes) {
     if (CI.Kind == ClassInfo::Token && !CI.DiagnosticType.empty()) {
       OS << "  case " << CI.Name << ":\n";
-      OS << "    return " << Info.Target.getName()
-         << "AsmParser::Match_" << CI.DiagnosticType << ";\n";
+      OS << "    return " << Info.Target.getName() << "AsmParser::Match_"
+         << CI.DiagnosticType << ";\n";
     }
   }
   OS << "  }\n";

``````````

</details>


https://github.com/llvm/llvm-project/pull/209700


More information about the llvm-commits mailing list