[clang] [clang-tools-extra] [lld] [lldb] [llvm] Rework the `Option` library to reduce dynamic relocations (PR #119198)

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 9 12:47:50 PST 2024


================
@@ -53,10 +53,8 @@ class OptTable {
 public:
   /// Entry for a single option instance in the option data table.
   struct Info {
-    /// A null terminated array of prefix strings to apply to name while
-    /// matching.
-    ArrayRef<StringLiteral> Prefixes;
-    StringLiteral PrefixedName;
+    unsigned PrefixesOffset;
----------------
rnk wrote:

It would be nice to have some kind of abstraction here rather than using raw integer types, especially if we plan to proceed to give this same treatment to the Clang BuiltinInfo struct. `class StrtabOffset` comes to mind. If could have some method, `StringRef StrtabOffset::toStr(StringRef StrTable)` that does the lookup, with bounds checking, or you could wrap a class on the string table and reorder the parameters. Clearly, the class would be trivial and 4 bytes.

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


More information about the llvm-commits mailing list