Index: clang-tools-extra/clang-tidy/ClangTidy.cpp =================================================================== --- clang-tools-extra/clang-tidy/ClangTidy.cpp +++ clang-tools-extra/clang-tidy/ClangTidy.cpp @@ -615,6 +615,8 @@ TUD.MainSourceFile = std::string(MainFilePath); for (const auto &Error : Errors) { tooling::Diagnostic Diag = Error; + if (Error.IsWarningAsError) + Diag.DiagLevel = tooling::Diagnostic::Error; TUD.Diagnostics.insert(TUD.Diagnostics.end(), Diag); } Index: clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp =================================================================== --- clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp +++ clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp @@ -421,8 +421,6 @@ bool IsWarningAsError = DiagLevel == DiagnosticsEngine::Warning && Context.treatAsError(CheckName); - if (IsWarningAsError) - Level = ClangTidyError::Error; Errors.emplace_back(CheckName, Level, Context.getCurrentBuildDirectory(), IsWarningAsError); }