! Find the first polymorphic base class.
| 863 | |
| 864 | ///! Find the first polymorphic base class. |
| 865 | static const CXXRecordDecl* GetFirstPolymorphicBase(const RecordDecl* decl) |
| 866 | { |
| 867 | if(const auto* rdecl = dyn_cast_or_null<CXXRecordDecl>(decl); rdecl->getNumBases() >= 1) { |
| 868 | for(const auto& base : rdecl->bases()) { |
| 869 | const auto* rd = base.getType()->getAsRecordDecl(); |
| 870 | |
| 871 | if(const auto* cxxRd = dyn_cast_or_null<CXXRecordDecl>(rd); not cxxRd or not cxxRd->isPolymorphic()) { |
| 872 | continue; |
| 873 | } else if(const CXXRecordDecl* ret = GetFirstPolymorphicBase(rd)) { |
| 874 | return ret; |
| 875 | } |
| 876 | |
| 877 | break; |
| 878 | } |
| 879 | } |
| 880 | |
| 881 | return dyn_cast_or_null<CXXRecordDecl>(decl); |
| 882 | } |
| 883 | //----------------------------------------------------------------------------- |
| 884 | |
| 885 | void CfrontCodeGenerator::InsertArg(const CXXRecordDecl* stmt) |