MCPcopy Create free account
hub / github.com/andreasfertig/cppinsights / GetFirstPolymorphicBase

Function GetFirstPolymorphicBase

CfrontCodeGenerator.cpp:865–882  ·  view source on GitHub ↗

! Find the first polymorphic base class.

Source from the content-addressed store, hash-verified

863
864///! Find the first polymorphic base class.
865static 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
885void CfrontCodeGenerator::InsertArg(const CXXRecordDecl* stmt)

Callers 1

InsertArgMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected