[PATCH] D42918: [clang-tidy] Update fuchsia-multiple-inheritance to check for templates

Julie Hockett via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 16:36:16 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL324432: [clang-tidy] Update fuchsia-multiple-inheritance to check for templates (authored by juliehockett, committed by ).
Herald added subscribers: llvm-commits, klimek.

Changed prior to commit:
  https://reviews.llvm.org/D42918?vs=132860&id=133112#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D42918

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
@@ -64,7 +64,7 @@
 
   // 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 @@
     // 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());
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
@@ -129,3 +129,5 @@
 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 {};


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42918.133112.patch
Type: text/x-patch
Size: 1597 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180207/e2b31fbe/attachment.bin>


More information about the llvm-commits mailing list