Index: clang-tidy/misc/DefinitionsInHeadersCheck.cpp =================================================================== --- clang-tidy/misc/DefinitionsInHeadersCheck.cpp +++ clang-tidy/misc/DefinitionsInHeadersCheck.cpp @@ -72,6 +72,10 @@ } void DefinitionsInHeadersCheck::check(const MatchFinder::MatchResult &Result) { + // Don't run the check in failing TUs. + if (Result.Context->getDiagnostics().hasErrorOccurred()) + return; + // C++ [basic.def.odr] p6: // There can be more than one definition of a class type, enumeration type, // inline function with external linkage, class template, non-static function