Skip to content

Commit

Permalink
[clang-tidy] Exclude forward decls from fuchsia-multiple-inheritance
Browse files Browse the repository at this point in the history
Addresses b39770.

Differential Revision: https://reviews.llvm.org/D64813

llvm-svn: 366354
  • Loading branch information
Julie Hockett committed Jul 17, 2019
1 parent b53e13c commit 337aea4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Expand Up @@ -93,7 +93,8 @@ void MultipleInheritanceCheck::registerMatchers(MatchFinder *Finder) {
return;

// Match declarations which have bases.
Finder->addMatcher(cxxRecordDecl(hasBases()).bind("decl"), this);
Finder->addMatcher(
cxxRecordDecl(allOf(hasBases(), isDefinition())).bind("decl"), this);
}

void MultipleInheritanceCheck::check(const MatchFinder::MatchResult &Result) {
Expand Down
Expand Up @@ -41,6 +41,9 @@ class Interface_with_A_Parent : public Base_A {
virtual int baz() = 0;
};

// Shouldn't warn on forward declarations.
class Bad_Child1;

// Inherits from multiple concrete classes.
// CHECK-MESSAGES: [[@LINE+2]]:1: warning: inheriting mulitple classes that aren't pure virtual is discouraged [fuchsia-multiple-inheritance]
// CHECK-NEXT: class Bad_Child1 : public Base_A, Base_B {};
Expand Down

0 comments on commit 337aea4

Please sign in to comment.