[PATCH] D156452: [clang-tidy] Sort options in --dump-config

Carlos Galvez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 27 10:32:24 PDT 2023


carlosgalvezp added a comment.

Looks great, small comments!



================
Comment at: clang-tools-extra/clang-tidy/ClangTidyOptions.cpp:89
   if (IO.outputting()) {
+    std::vector<std::pair<StringRef, StringRef>> SortedOptions;
+    SortedOptions.reserve(Options.size());
----------------
Maybe add a one-line comment like `Ensure check options are sorted` to more quickly grasp what the block of code below does?


================
Comment at: clang-tools-extra/clang-tidy/ClangTidyOptions.cpp:90
+    std::vector<std::pair<StringRef, StringRef>> SortedOptions;
+    SortedOptions.reserve(Options.size());
+    for (auto &Key : Options) {
----------------
I believe you can pass this directly to the constructor in the previous line, to skip the `reserve()` part.


================
Comment at: clang-tools-extra/test/clang-tidy/infrastructure/config-files.cpp:58
+
+// RUN: clang-tidy --checks="-*,readability-identifier-*" --dump-config | grep readability-identifier-naming | sort -c
----------------
Use the long name of the option, i.e. `--check`, so it's easier to see what it's doing without having to check the manual.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156452



More information about the cfe-commits mailing list