[PATCH] D21485: [cl] Teach cl to support the notion of sub commands (e.g. "git checkout <foo>")

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 21 17:00:12 PDT 2016


beanz added inline comments.

================
Comment at: lib/Support/CommandLine.cpp:141
@@ -122,1 +140,3 @@
+
+  void addOption(Option *O, SubCommand *SC) {
     bool HadErrors = false;
----------------
Yes, addOption could call addLiteralOption and reduce duplication. The methods do serve different purposes, so they both need to be present. The, poorly named (by me), addLiteralOption adds the option's string and cl::Option to the global option mapping.

================
Comment at: lib/Support/CommandLine.cpp:192
@@ -154,1 +191,3 @@
+
+  void removeOption(Option *O, SubCommand *SC) {
     SmallVector<StringRef, 16> OptionNames;
----------------
It needs to work if it is used with AllSubCommands, and TopLevelSubCommand. If it doesn't that will regress functionality.


http://reviews.llvm.org/D21485





More information about the llvm-commits mailing list