[PATCH] D38171: [clang-tidy] Implement clang-tidy check aliases

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 14 06:34:57 PDT 2018


alexfh added a comment.

I apologize for completely ignoring this for a long time.

I'm totally fine taking full control of clang-diagnostic- "checks", i.e. automatically adding corresponding -W flags and removing all other -W flags (or prepending -Wno-everything).

However, could we split the aliases stuff to a separate patch? My concerns w.r.t. the current implementation:

1. it doesn't allow more than one alias to each diagnostic
2. it's not clear that clang diagnostic aliases need to be separate from aliases for native clang-tidy checks. It might be better to add a more high-level API to register aliases (e.g. `registerCheckAlias(<alias name>, <check name>, <custom check options>)`).



================
Comment at: clang-tidy/ClangTidy.cpp:406
+  for (const auto &Diag : Context.getEnabledClangDiagnostics())
+    CheckNames.push_back("clang-diagnostic-" + Diag);
+
----------------
The "clang-diagnostic-" string is now repeated multiple times. Could you pull it out to a constant (or maybe `llvm::StringRef getClangDiagnosticPrefix()`)?


================
Comment at: clang-tidy/ClangTidyModule.h:96
+  virtual void addWarningCheckAliases(
+      llvm::DenseMap<llvm::StringRef, llvm::StringRef> &WarningCheckAliases) {}
+
----------------
Consider using `llvm::StringMap`.


https://reviews.llvm.org/D38171





More information about the cfe-commits mailing list