[clang-tidy] Don't run misc-definitions-in-headers check in failing TUs.

Reviewers: alexfh

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D21470

llvm-svn: 273849
This commit is contained in:
Haojian Wu 2016-06-27 08:04:01 +00:00
parent a45da385f8
commit e5d277923a
1 changed files with 4 additions and 0 deletions

View File

@ -72,6 +72,10 @@ void DefinitionsInHeadersCheck::registerMatchers(MatchFinder *Finder) {
}
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