[PATCH] D18694: [ClangTidy] Add an 'explain-checks' option to diagnose where each checks comes from.

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 18 06:45:58 PDT 2016


alexfh added a comment.

Looks better now, thanks!


================
Comment at: clang-tidy/ClangTidyOptions.cpp:163
@@ +162,3 @@
+DefaultOptionsProvider::getRawOptions(llvm::StringRef FileName) {
+  return {OptionsSource(DefaultOptions, OptionsSourceTypeDefaultBinary)};
+}
----------------
I'm not sure this will compile on VS2013.

================
Comment at: clang-tidy/ClangTidyOptions.cpp:179
@@ +178,3 @@
+      DefaultOptionsProvider::getRawOptions(FileName);
+  RawOptions.push_back(OptionsSource(ConfigOptions, OptionsSourceTypeConfigCommandLineOption));
+  RawOptions.push_back(OptionsSource(OverrideOptions, OptionsSourceTypeCheckCommandLineOption));
----------------
Maybe `emplace_back`?

================
Comment at: clang-tidy/ClangTidyOptions.h:129
@@ +128,3 @@
+    ClangTidyOptions Result;
+    for (const auto &Source: getRawOptions(FileName))
+      Result = Result.mergeWith(Source.first);
----------------
Clang-format, please.

================
Comment at: clang-tidy/ClangTidyOptions.h:245
@@ -205,3 +244,3 @@
   /// \c ConfigHandlers.
-  llvm::Optional<ClangTidyOptions> TryReadConfigFile(llvm::StringRef Directory);
+  llvm::Optional<OptionsSource> TryReadConfigFile(llvm::StringRef Directory);
 
----------------
nit: Name should start with a lower-case letter.

================
Comment at: clang-tidy/tool/ClangTidyMain.cpp:326
@@ +325,3 @@
+      for (auto It = RawOptions.rbegin(); It != RawOptions.rend(); ++It) {
+        if (It->first.Checks && GlobList(*(It->first.Checks)).contains(Check)) {
+          llvm::outs() << "'" << Check << "' is enabled in the " << It->second
----------------
No need for parentheses around `It->first.Checks`.


http://reviews.llvm.org/D18694





More information about the cfe-commits mailing list