[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


================
@@ -373,6 +380,33 @@ static void emitDirectivesDecl(const RecordKeeper &Records, raw_ostream &OS) {
   OS << "#endif // LLVM_" << Lang << "_INC\n";
 }
 
+// Given a list of spellings (for a given clause/directive), order them
+// in a way that allows the use of binary search to locate a spelling
+// for a specified version.
+static std::vector<Spelling::Value>
+orderSpellings(ArrayRef<Spelling::Value> Spellings) {
+  std::vector<Spelling::Value> List(Spellings.begin(), Spellings.end());
+
+  // There are two intertwined orderings: (1) the order between spellings
+  // (used here), and (2) the order between a spelling and a version (used
+  // at runtime).
+  // Define order (2) as such that the first A that is not less than V
----------------
kparzysz wrote:

The comment is wrong (leftover from older version), deleted.

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


More information about the llvm-commits mailing list