Fixed an issue with the clang type creation code for C++ classes where we wouldn't set a CXXRecordDecl to be NOT empty if we had base classes that were not empty or had virtual functions.

llvm-svn: 114484
This commit is contained in:
Greg Clayton 2010-09-21 21:22:23 +00:00
parent b0c0eaf579
commit 9e826e3292
1 changed files with 26 additions and 1 deletions

View File

@ -1093,8 +1093,33 @@ ClangASTContext::SetBaseClassesForClassType (void *class_clang_type, CXXBaseSpec
CXXRecordDecl *cxx_record_decl = dyn_cast<CXXRecordDecl>(record_type->getDecl());
if (cxx_record_decl)
{
//cxx_record_decl->setEmpty (false);
cxx_record_decl->setBases(base_classes, num_base_classes);
if (cxx_record_decl->isEmpty())
{
// set empty to false if any bases are virtual, or not empty.
CXXRecordDecl::base_class_const_iterator base_class, base_class_end;
for (base_class = cxx_record_decl->bases_begin(), base_class_end = cxx_record_decl->bases_end();
base_class != base_class_end;
++base_class)
{
if (base_class->isVirtual())
{
cxx_record_decl->setEmpty (false);
break;
}
else
{
const CXXRecordDecl *base_class_decl = cast<CXXRecordDecl>(base_class->getType()->getAs<RecordType>()->getDecl());
if (!base_class_decl->isEmpty())
{
cxx_record_decl->setEmpty (false);
break;
}
}
}
}
return true;
}
}