diff options
author | Julie Hockett <juliehockett@google.com> | 2018-02-13 15:40:40 +0000 |
---|---|---|
committer | Julie Hockett <juliehockett@google.com> | 2018-02-13 15:40:40 +0000 |
commit | 18a5daacdd71ca1f5f3fa2858aac403dbbf3e647 (patch) | |
tree | e626d79ef2ad3255fc5209062edc07d290c715fc /clang-tidy/fuchsia | |
parent | 6bc06d7181966902b4ac02bc7a2bda28d53fa96a (diff) |
[clang-tidy] Update fuchsia-multiple-inheritance to not fail
Updating the fuchsia-multiple-inheritance to gracefully handle unknown
record types (e.g. templatized classes) by simply continuing, rather
than asserting and failing.
Fixes PR36052.
Differential Revision: https://reviews.llvm.org/D43223
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@325015 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'clang-tidy/fuchsia')
-rw-r--r-- | clang-tidy/fuchsia/MultipleInheritanceCheck.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/clang-tidy/fuchsia/MultipleInheritanceCheck.cpp b/clang-tidy/fuchsia/MultipleInheritanceCheck.cpp index f0cc31fd..4893b215 100644 --- a/clang-tidy/fuchsia/MultipleInheritanceCheck.cpp +++ b/clang-tidy/fuchsia/MultipleInheritanceCheck.cpp @@ -66,7 +66,7 @@ bool MultipleInheritanceCheck::isInterface(const CXXRecordDecl *Node) { for (const auto &I : Node->bases()) { if (I.isVirtual()) continue; const auto *Ty = I.getType()->getAs<RecordType>(); - assert(Ty && "RecordType of base class is unknown"); + if (!Ty) continue; const RecordDecl *D = Ty->getDecl()->getDefinition(); if (!D) continue; const auto *Base = cast<CXXRecordDecl>(D); @@ -96,9 +96,9 @@ void MultipleInheritanceCheck::check(const MatchFinder::MatchResult &Result) { // concrete classes unsigned NumConcrete = 0; for (const auto &I : D->bases()) { - if (I.isVirtual() || I.getType()->getAs<TemplateTypeParmType>()) continue; + if (I.isVirtual()) continue; const auto *Ty = I.getType()->getAs<RecordType>(); - assert(Ty && "RecordType of base class is unknown"); + if (!Ty) continue; const auto *Base = cast<CXXRecordDecl>(Ty->getDecl()->getDefinition()); if (!isInterface(Base)) NumConcrete++; } @@ -107,7 +107,7 @@ void MultipleInheritanceCheck::check(const MatchFinder::MatchResult &Result) { // non-virtual base. for (const auto &V : D->vbases()) { const auto *Ty = V.getType()->getAs<RecordType>(); - assert(Ty && "RecordType of base class is unknown"); + if (!Ty) continue; const auto *Base = cast<CXXRecordDecl>(Ty->getDecl()->getDefinition()); if (!isInterface(Base)) NumConcrete++; } |