[llvm] [utils][TableGen] Handle versions on clause/directive spellings (PR #143021)
Rahul Joshi via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 6 04:36:09 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
----------------
jurahul wrote:
nit: Define order (2) such that (drop the as)
https://github.com/llvm/llvm-project/pull/143021
More information about the llvm-commits
mailing list