| 813 | //----------------------------------------------------------------------------- |
| 814 | |
| 815 | static void ProcessFields(CXXRecordDecl* recordDecl, const CXXRecordDecl* rd) |
| 816 | { |
| 817 | RETURN_IF(not rd->hasDefinition()) |
| 818 | |
| 819 | auto AddField = [&](const FieldDecl* field) { |
| 820 | recordDecl->addDecl(mkFieldDecl(recordDecl, GetName(*field), field->getType())); |
| 821 | }; |
| 822 | |
| 823 | // Insert field from base classes |
| 824 | for(const auto& base : rd->bases()) { |
| 825 | // XXX: ignoring TemplateSpecializationType |
| 826 | if(const auto* rdBase = dyn_cast_or_null<CXXRecordDecl>(base.getType().getCanonicalType()->getAsRecordDecl())) { |
| 827 | ProcessFields(recordDecl, rdBase); |
| 828 | } |
| 829 | } |
| 830 | |
| 831 | // insert vtable pointer if required |
| 832 | if(rd->isPolymorphic() and (rd->getNumBases() == 0)) { |
| 833 | recordDecl->addDecl(CfrontCodeGenerator::VtableData().VtblPtrField(rd)); |
| 834 | } |
| 835 | |
| 836 | // insert own fields |
| 837 | for(const auto* d : rd->fields()) { |
| 838 | AddField(d); |
| 839 | } |
| 840 | |
| 841 | if(recordDecl->field_empty()) { |
| 842 | AddField(mkFieldDecl(recordDecl, "__dummy"sv, GetGlobalAST().CharTy)); |
| 843 | } |
| 844 | } |
| 845 | //----------------------------------------------------------------------------- |
| 846 | |
| 847 | static std::string GetFirstPolymorphicBaseName(const RecordDecl* decl, const RecordDecl* to) |
no test coverage detected