[clang] Patch series to reapply #118734 and substantially improve it (PR #120534)

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 3 16:39:59 PST 2025


================
@@ -482,17 +488,42 @@ void clang::EmitClangBuiltins(const RecordKeeper &Records, raw_ostream &OS) {
   for (const auto *BuiltinRecord :
        Records.getAllDerivedDefinitions("AtomicBuiltin"))
     collectBuiltins(BuiltinRecord, Builtins);
-
   unsigned NumAtomicBuiltins = Builtins.size();
 
   for (const auto *BuiltinRecord :
        Records.getAllDerivedDefinitions("Builtin")) {
     if (BuiltinRecord->isSubClassOf("AtomicBuiltin"))
       continue;
+    // Prefixed builtins are also special and we emit them last so they can have
+    // their own representation that skips the prefix.
+    if (BuiltinRecord->getValueAsOptionalDef("RequiredNamePrefix"))
+      continue;
+
     collectBuiltins(BuiltinRecord, Builtins);
   }
 
+  // Now collect (and count) the prefixed builtins.
+  unsigned NumPrefixedBuiltins = Builtins.size();
+  const Record *first_prefix = nullptr;
----------------
rnk wrote:

Super nit, just to prove I read all the code: Why the change in style here? `FirstPrefix`?

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


More information about the cfe-commits mailing list