Skip to content

Commit

Permalink
Tell clang-tidy explicitly to consider code c++20.
Browse files Browse the repository at this point in the history
Even though the -std=c++20 makes it into the
compilation DB, clang-tidy does not pick it up.

So be explicit and add it to the --extra-args on
invocation.

Thie fixes all reported [clang-diagnostic-error] that
were due to clang-tidy not recognizing c++20 constructs
and also some misc-include-cleaner warnings in which it
previously flagged some includes because it was tripping
over some other problem in the file in question.

<    21 [misc-include-cleaner]
<    20 [clang-diagnostic-error]
---
>    15 [misc-include-cleaner]

PiperOrigin-RevId: 678427605
  • Loading branch information
hzeller authored and copybara-github committed Sep 24, 2024
1 parent b3a7203 commit e5bcb56
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion xls/dev_tools/run_clang_tidy_cached.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ inline bool ConsiderExtension(const std::string& extension) {

// Configuration of clang-tidy itself.
static constexpr std::string_view kClangConfigFile = ".clang-tidy";
static constexpr std::string_view kExtraArgs[] = {"-Wno-unknown-pragmas"};
static constexpr std::string_view kExtraArgs[] = {"-Wno-unknown-pragmas",
"-std=c++20"};

// If the compilation DB changed, it might be worthwhile revisiting
// sources that previously had issues. This flag enables that.
Expand Down

0 comments on commit e5bcb56

Please sign in to comment.