@@ -519,9 +519,9 @@ int clangTidyMain(int argc, const char **argv) {
519
519
std::vector<clang::tidy::ClangTidyOptionsProvider::OptionsSource>
520
520
RawOptions = OptionsProvider->getRawOptions (FilePath);
521
521
for (const std::string &Check : EnabledChecks) {
522
- for (auto It = RawOptions. rbegin (); It != RawOptions. rend (); ++It ) {
523
- if (It-> first .Checks && GlobList (*It-> first .Checks ).contains (Check)) {
524
- llvm::outs () << " '" << Check << " ' is enabled in the " << It-> second
522
+ for (const auto &[Opts, Source] : llvm::reverse (RawOptions) ) {
523
+ if (Opts .Checks && GlobList (*Opts .Checks ).contains (Check)) {
524
+ llvm::outs () << " '" << Check << " ' is enabled in the " << Source
525
525
<< " .\n " ;
526
526
break ;
527
527
}
@@ -557,20 +557,16 @@ int clangTidyMain(int argc, const char **argv) {
557
557
NamesAndOptions Valid =
558
558
getAllChecksAndOptions (AllowEnablingAnalyzerAlphaCheckers);
559
559
bool AnyInvalid = false ;
560
- for (const std::pair<ClangTidyOptions, std::string> &OptionWithSource :
561
- RawOptions) {
562
- const ClangTidyOptions &Opts = OptionWithSource.first ;
560
+ for (const auto &[Opts, Source] : RawOptions) {
563
561
if (Opts.Checks )
564
- AnyInvalid |=
565
- verifyChecks (Valid.Names , *Opts.Checks , OptionWithSource.second );
562
+ AnyInvalid |= verifyChecks (Valid.Names , *Opts.Checks , Source);
566
563
567
564
for (auto Key : Opts.CheckOptions .keys ()) {
568
565
if (Valid.Options .contains (Key))
569
566
continue ;
570
567
AnyInvalid = true ;
571
- auto &Output =
572
- llvm::WithColor::warning (llvm::errs (), OptionWithSource.second )
573
- << " unknown check option '" << Key << ' \' ' ;
568
+ auto &Output = llvm::WithColor::warning (llvm::errs (), Source)
569
+ << " unknown check option '" << Key << ' \' ' ;
574
570
llvm::StringRef Closest = closest (Key, Valid.Options );
575
571
if (!Closest.empty ())
576
572
Output << " ; did you mean '" << Closest << ' \' ' ;
0 commit comments