[PATCH] Option parsing: allow alias arguments

Reid Kleckner rnk at google.com
Wed Jul 31 10:18:15 PDT 2013



================
Comment at: utils/TableGen/OptParserEmitter.cpp:160
@@ +159,3 @@
+    const Record &R = *Opts[i];
+    const ListInit *AliasArgs = R.getValueAsListInit("AliasArgs");
+    if (AliasArgs->size() == 0)
----------------
Can this use R.getValueAsListOfStrings()?


================
Comment at: unittests/Option/OptionParsingTest.cpp:35
@@ -32,1 +34,3 @@
 
+#define ALIASARGS(NAME, VALUE) const char *const NAME[] = VALUE;
+#include "Opts.inc"
----------------
I'm not thrilled about having another table on the side that needs to be implemented in both clang and lld.  What do you think about making a string like: "arg1\0arg2\0arg3\0"?

The termination condition is a double null character, where the second is inserted implicitly by the compiler.  This string can easily be split into multiple C strings.  Do we need empty string alias arguments?  If not, this would work.


http://llvm-reviews.chandlerc.com/D1245



More information about the llvm-commits mailing list