This revision was automatically updated to reflect the committed changes. Closed by commit rL366354: [clang-tidy] Exclude forward decls from fuchsia-multiple-inheritance (authored by juliehockett, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits.
Changed prior to commit: https://reviews.llvm.org/D64813?vs=210144&id=210367#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64813/new/ https://reviews.llvm.org/D64813 Files: clang-tools-extra/trunk/clang-tidy/fuchsia/MultipleInheritanceCheck.cpp clang-tools-extra/trunk/test/clang-tidy/fuchsia-multiple-inheritance.cpp Index: clang-tools-extra/trunk/clang-tidy/fuchsia/MultipleInheritanceCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/fuchsia/MultipleInheritanceCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/fuchsia/MultipleInheritanceCheck.cpp @@ -93,7 +93,8 @@ 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) { Index: clang-tools-extra/trunk/test/clang-tidy/fuchsia-multiple-inheritance.cpp =================================================================== --- clang-tools-extra/trunk/test/clang-tidy/fuchsia-multiple-inheritance.cpp +++ clang-tools-extra/trunk/test/clang-tidy/fuchsia-multiple-inheritance.cpp @@ -41,6 +41,9 @@ 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 {};
Index: clang-tools-extra/trunk/clang-tidy/fuchsia/MultipleInheritanceCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/fuchsia/MultipleInheritanceCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/fuchsia/MultipleInheritanceCheck.cpp @@ -93,7 +93,8 @@ 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) { Index: clang-tools-extra/trunk/test/clang-tidy/fuchsia-multiple-inheritance.cpp =================================================================== --- clang-tools-extra/trunk/test/clang-tidy/fuchsia-multiple-inheritance.cpp +++ clang-tools-extra/trunk/test/clang-tidy/fuchsia-multiple-inheritance.cpp @@ -41,6 +41,9 @@ 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 {};
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits