[llvm] [utils][TableGen] Handle versions on clause/directive spellings (PR #143021)

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 6 06:48:11 PDT 2025


================
@@ -381,14 +415,31 @@ static void generateGetName(ArrayRef<const Record *> Records, raw_ostream &OS,
   std::string Qual = getQualifier(DirLang);
   OS << "\n";
   OS << "llvm::StringRef " << Qual << "get" << Lang << Enum << "Name(" << Qual
-     << Enum << " Kind, unsigned) {\n";
+     << Enum << " Kind, unsigned Version) {\n";
   OS << "  switch (Kind) {\n";
   for (const Record *R : Records) {
-    OS << "    case " << getIdentifierName(R, Prefix) << ":\n";
-    // FIXME: This will need to recognize different spellings for different
-    // versions.
-    OS << "      return \"" << BaseRecord(R).getSpellingForIdentifier()
-       << "\";\n";
+    BaseRecord Rec(R);
+    std::string Ident = getIdentifierName(R, Prefix);
+    OS << "    case " << Ident << ":";
+    auto Spellings(orderSpellings(Rec.getSpellings()));
----------------
kparzysz wrote:

Done

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


More information about the llvm-commits mailing list