forked from OSchip/llvm-project
[clang-tidy] Update fuchsia-multiple-inheritance to check for templates
Updating fuchsia-multiple-inheritance to not crash when a record inherits a template. Fixes PR36052. Differential Revision: https://reviews.llvm.org/D42918 llvm-svn: 324432
This commit is contained in:
parent
a18b3bcf51
commit
7a76ada901
|
@ -64,7 +64,7 @@ bool MultipleInheritanceCheck::isInterface(const CXXRecordDecl *Node) {
|
|||
|
||||
// To be an interface, all base classes must be interfaces as well.
|
||||
for (const auto &I : Node->bases()) {
|
||||
if (I.isVirtual()) continue;
|
||||
if (I.isVirtual()) continue;
|
||||
const auto *Ty = I.getType()->getAs<RecordType>();
|
||||
assert(Ty && "RecordType of base class is unknown");
|
||||
const RecordDecl *D = Ty->getDecl()->getDefinition();
|
||||
|
@ -96,7 +96,7 @@ void MultipleInheritanceCheck::check(const MatchFinder::MatchResult &Result) {
|
|||
// concrete classes
|
||||
unsigned NumConcrete = 0;
|
||||
for (const auto &I : D->bases()) {
|
||||
if (I.isVirtual()) continue;
|
||||
if (I.isVirtual() || I.getType()->getAs<TemplateTypeParmType>()) continue;
|
||||
const auto *Ty = I.getType()->getAs<RecordType>();
|
||||
assert(Ty && "RecordType of base class is unknown");
|
||||
const auto *Base = cast<CXXRecordDecl>(Ty->getDecl()->getDefinition());
|
||||
|
|
|
@ -129,3 +129,5 @@ struct V13 : virtual Static_Base_2 { static void f(); };
|
|||
struct V14 : virtual Static_Base_2 { static void g(); };
|
||||
struct D8 : V13, V14 {};
|
||||
|
||||
template<typename T> struct A : T {};
|
||||
template<typename T> struct B : virtual T {};
|
||||
|
|
Loading…
Reference in New Issue