[llvm] [TableGen] Fix compile error in GCC-7.4.0 after 928f70d38e34 (PR #194692)

via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 28 10:51:07 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-tablegen

Author: Krzysztof Parzyszek (kparzysz)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/194692.diff


1 Files Affected:

- (modified) llvm/utils/TableGen/Basic/DirectiveEmitter.cpp (+6-3) 


``````````diff
diff --git a/llvm/utils/TableGen/Basic/DirectiveEmitter.cpp b/llvm/utils/TableGen/Basic/DirectiveEmitter.cpp
index ba6e10f7042cc..35df0ff18b6b5 100644
--- a/llvm/utils/TableGen/Basic/DirectiveEmitter.cpp
+++ b/llvm/utils/TableGen/Basic/DirectiveEmitter.cpp
@@ -848,8 +848,9 @@ static void generateGetDirectiveAssociation(const DirectiveLanguage &DirLang,
       OS << "    return Association::" << GetAssocName(F->second) << ";\n";
     }
   }
+  OS << "  default:\n";
+  OS << "    llvm_unreachable(\"Unexpected directive\");\n";
   OS << "  } // switch (Dir)\n";
-  OS << "  llvm_unreachable(\"Unexpected directive\");\n";
   OS << "}\n";
 }
 
@@ -866,8 +867,9 @@ static void generateGetDirectiveCategory(const DirectiveLanguage &DirLang,
     OS << "    return Category::" << D.getCategory()->getValueAsString("name")
        << ";\n";
   }
+  OS << "  default:\n";
+  OS << "    llvm_unreachable(\"Unexpected directive\");\n";
   OS << "  } // switch (Dir)\n";
-  OS << "  llvm_unreachable(\"Unexpected directive\");\n";
   OS << "}\n";
 }
 
@@ -891,8 +893,9 @@ static void generateGetDirectiveLanguages(const DirectiveLanguage &DirLang,
         " | ");
     OS << ";\n";
   }
+  OS << "  default:\n";
+  OS << "    llvm_unreachable(\"Unexpected directive\");\n";
   OS << "  } // switch(D)\n";
-  OS << "  llvm_unreachable(\"Unexpected directive\");\n";
   OS << "}\n";
 }
 

``````````

</details>


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


More information about the llvm-commits mailing list