Skip to content

Commit

Permalink
Revert "[clang-tidy] Sort options in --dump-config"
Browse files Browse the repository at this point in the history
This reverts commit 2cdb843.
  • Loading branch information
PiotrZSL committed Jul 27, 2023
1 parent a81e1f0 commit a8eb741
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 19 deletions.
20 changes: 6 additions & 14 deletions clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "llvm/Support/MemoryBufferRef.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/YAMLTraits.h"
#include <algorithm>
#include <optional>
#include <utility>

Expand Down Expand Up @@ -86,21 +85,14 @@ template <>
void yamlize(IO &IO, ClangTidyOptions::OptionMap &Options, bool,
EmptyContext &Ctx) {
if (IO.outputting()) {
// Ensure check options are sorted
std::vector<std::pair<StringRef, StringRef>> SortedOptions;
SortedOptions.reserve(Options.size());
for (auto &Key : Options) {
SortedOptions.emplace_back(Key.getKey(), Key.getValue().Value);
}
std::sort(SortedOptions.begin(), SortedOptions.end());

IO.beginMapping();
// Only output as a map
for (auto &Option : SortedOptions) {
bool UseDefault = false;
void *SaveInfo = nullptr;
IO.preflightKey(Option.first.data(), true, false, UseDefault, SaveInfo);
IO.scalarString(Option.second, needsQuotes(Option.second));
for (auto &Key : Options) {
bool UseDefault;
void *SaveInfo;
IO.preflightKey(Key.getKey().data(), true, false, UseDefault, SaveInfo);
StringRef S = Key.getValue().Value;
IO.scalarString(S, needsQuotes(S));
IO.postflightKey(SaveInfo);
}
IO.endMapping();
Expand Down
2 changes: 0 additions & 2 deletions clang-tools-extra/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ Improvements to clang-tidy
- Remove configuration option `AnalyzeTemporaryDestructors`, which was deprecated since
:program:`clang-tidy` 16.

- Improved `--dump-config` to print check options in alphabetical order.

New checks
^^^^^^^^^^

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,3 @@
// RUN: %S/Inputs/config-files/4/44/- -- | FileCheck %s -check-prefix=CHECK-CHILD6
// CHECK-CHILD6: Checks: {{.*-llvm-qualified-auto'? *$}}
// CHECK-CHILD6-NOT: modernize-use-using.IgnoreMacros

// Validate that check options are printed in alphabetical order:
// RUN: clang-tidy --checks="-*,readability-identifier-*" --dump-config | grep readability-identifier-naming | sort --check

0 comments on commit a8eb741

Please sign in to comment.