[PATCH] D86137: Add ignore-unknown-options flag to clang-format.

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 7 01:39:19 PDT 2020


MyDeveloperDay added subscribers: sammccall, JDevlieghere, aaron.ballman.
MyDeveloperDay added a comment.

> Regarding not touching the LLVM support library: I'd love to find a way, but as clang-format uses the >> operator

We need to find some reviewers who look after a wider area of LLVM, if you want to make a change out there in LLVM/support, but it above my pay grade to approve ;-) maybe one of the more experienced devs could help identify the correct person @aaron.ballman @sammccall or alternatively take a look via git log as to who has been maintaining that file @JDevlieghere, they may have an opinion about how this should be done.



================
Comment at: clang/tools/clang-format/ClangFormat.cpp:108
+static cl::opt<bool>
+    IgnoreUnkownOptions("ignore-unknown-options",
+                        cl::desc("If set, unknown format options are ignored."),
----------------
feels like a mouthful is there nothing shorter we could use?  -Wignore (or something)


================
Comment at: llvm/include/llvm/Support/YAMLTraits.h:792
   virtual void setError(const Twine &) = 0;
+  virtual void setIgnoreUnknown(bool) = 0;
 
----------------
I'm not a massive fan of functions with out parameter names, but I see your following the local style.


================
Comment at: llvm/include/llvm/Support/YAMLTraits.h:1520
   bool                                ScalarMatchFound = false;
+  bool IgnoreUnkown = false;
 };
----------------
is this clang-formatted?


================
Comment at: llvm/lib/Support/YAMLTraits.cpp:199
+  if (IgnoreUnkown)
+    return;
   for (const auto &NN : MN->Mapping) {
----------------
do we want to flat out ignore or just report but not fatally. (just a thought) silent failures are hard to diagnose


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86137



More information about the cfe-commits mailing list