[clang-tools-extra] r366354 - [clang-tidy] Exclude forward decls from fuchsia-multiple-inheritance
Julie Hockett via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 17 10:40:53 PDT 2019
Author: juliehockett
Date: Wed Jul 17 10:40:53 2019
New Revision: 366354
URL: http://llvm.org/viewvc/llvm-project?rev=366354&view=rev
Log:
[clang-tidy] Exclude forward decls from fuchsia-multiple-inheritance
Addresses b39770.
Differential Revision: https://reviews.llvm.org/D64813
Modified:
clang-tools-extra/trunk/clang-tidy/fuchsia/MultipleInheritanceCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/fuchsia-multiple-inheritance.cpp
Modified: clang-tools-extra/trunk/clang-tidy/fuchsia/MultipleInheritanceCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/fuchsia/MultipleInheritanceCheck.cpp?rev=366354&r1=366353&r2=366354&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/fuchsia/MultipleInheritanceCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/fuchsia/MultipleInheritanceCheck.cpp Wed Jul 17 10:40:53 2019
@@ -93,7 +93,8 @@ void MultipleInheritanceCheck::registerM
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) {
Modified: clang-tools-extra/trunk/test/clang-tidy/fuchsia-multiple-inheritance.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/fuchsia-multiple-inheritance.cpp?rev=366354&r1=366353&r2=366354&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/fuchsia-multiple-inheritance.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/fuchsia-multiple-inheritance.cpp Wed Jul 17 10:40:53 2019
@@ -41,6 +41,9 @@ public:
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 {};
More information about the cfe-commits
mailing list