[Lldb-commits] [lldb] r114484 - /lldb/trunk/source/Symbol/ClangASTContext.cpp
Greg Clayton
gclayton at apple.com
Tue Sep 21 14:22:23 PDT 2010
Author: gclayton
Date: Tue Sep 21 16:22:23 2010
New Revision: 114484
URL: http://llvm.org/viewvc/llvm-project?rev=114484&view=rev
Log:
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.
Modified:
lldb/trunk/source/Symbol/ClangASTContext.cpp
Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=114484&r1=114483&r2=114484&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Tue Sep 21 16:22:23 2010
@@ -1093,8 +1093,33 @@
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;
}
}
More information about the lldb-commits
mailing list