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

Adrian McCarthy via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 20 16:32:14 PDT 2016


amccarth added a subscriber: amccarth.

================
Comment at: lib/Support/CommandLine.cpp:141
@@ -122,1 +140,3 @@
+
+  void addOption(Option *O, SubCommand *SC) {
     bool HadErrors = false;
----------------
addOption seems very similar to addLiteralOption.  Is it possible to reduce the code duplication by having addOption just forward to addLiteralOption with `O->ArgStr` as the Name argument?  Am I missing some subtle difference?

================
Comment at: lib/Support/CommandLine.cpp:192
@@ -154,1 +191,3 @@
+
+  void removeOption(Option *O, SubCommand *SC) {
     SmallVector<StringRef, 16> OptionNames;
----------------
It appears this method should never be called with AllSubCommands.  Is that true?  If not, can you document that and maybe have the code check to prevent it.



http://reviews.llvm.org/D21485





More information about the llvm-commits mailing list