From e5d277923a80017dec16f0d65a793a59b80bc4c7 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Mon, 27 Jun 2016 08:04:01 +0000 Subject: [PATCH] [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 --- .../clang-tidy/misc/DefinitionsInHeadersCheck.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp b/clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp index e91cc9573f71..25fc09288b0c 100644 --- a/clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp @@ -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