[llvm] [CGData] Declare command line options in TableGen, one struct per library (PR #226087)
Alexis Engelke via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 25 05:46:25 PDT 2026
================
@@ -1593,6 +1638,24 @@ bool CommandLineParser::ParseCommandLineOptions(
Handler = LookupLongOption(SubCommand::getTopLevel(), ArgName, Value,
LongOptionsUseDoubleDash, HaveDoubleDash);
+ if (!Handler && (!LongOptionsUseDoubleDash || HaveDoubleDash)) {
+ if (LibraryOptions *L = lookupLibraryOption(ArgName.split('=').first)) {
+ // An option takes at most one separate value.
+ StringSaver Saver(LibraryArgAlloc);
+ const char *Args[2];
+ unsigned NumArgs = std::min(argc - i, 2);
+ for (unsigned J = 0; J != NumArgs; ++J)
+ Args[J] = Saver.save(argv[i + J]).data();
+ unsigned N = 1;
+ if (Error E = L->parse(ArrayRef(Args, NumArgs), N)) {
----------------
aengelke wrote:
We probably want to reuse the BumpPtrAllocator for storing argument lists in the future (and might not want to duplicate all argument strings, many arguments are integers/bools for which this is unnecessary). We can fix this later, but I expect that this interface will need changes.
https://github.com/llvm/llvm-project/pull/226087
More information about the llvm-commits
mailing list