[PATCH] D59746: [CommandLineParser] Add DefaultOption flag

Manuel Klimek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 12 01:47:48 PDT 2019


klimek added inline comments.


================
Comment at: llvm/lib/Support/CommandLine.cpp:101
 
+  SmallVector<Option*, 4> DefaultOptions;
+
----------------
A comment explaining what this contains and how it'll be used would help.


================
Comment at: llvm/lib/Support/CommandLine.cpp:152
+      // If it's a DefaultOption, check to make sure it isn't already there.
+      if (O->getMiscFlags() & cl::DefaultOption &&
+          SC->OptionsMap.find(O->ArgStr) != SC->OptionsMap.end())
----------------
This is used multiple times, add isDefault() to Option?


================
Comment at: llvm/lib/Support/CommandLine.cpp:196
+  void addOption(Option *O, bool ProcessDefaultOption = false) {
+    // Handle DefaultOptions
+    if (!ProcessDefaultOption && O->getMiscFlags() & cl::DefaultOption) {
----------------
I'd delete this comment, I don't think it helps.


================
Comment at: llvm/lib/Support/CommandLine.cpp:1199
 
+  // Handle DefaultOptions.
+  for (auto O: DefaultOptions) {
----------------
Same here, this comment doesn't say anything non-obvious.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59746/new/

https://reviews.llvm.org/D59746





More information about the cfe-commits mailing list