summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-11-19 01:08:19 +0000
committerMike Stump <mrs@apple.com>2009-11-19 01:08:19 +0000
commit1a139f8fb5bd7205e0bcf3083a096a4d2bdff658 (patch)
treed8ba7b0f34803495657a640b9c89f72416d4f08e /clang/lib/CodeGen/CodeGenModule.cpp
parent46fffee081b583a617fa94397b0c758bdf3a4a80 (diff)
downloadbcm5719-llvm-1a139f8fb5bd7205e0bcf3083a096a4d2bdff658.tar.gz
bcm5719-llvm-1a139f8fb5bd7205e0bcf3083a096a4d2bdff658.zip
Improve instantiation control for rtti data and allow key functions to
instantiate a class. WIP. llvm-svn: 89289
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 0e6f4a63a42..195acc5bc15 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -616,6 +616,16 @@ void CodeGenModule::EmitGlobalDefinition(GlobalDecl GD) {
Context.getSourceManager(),
"Generating code for declaration");
+ if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D)) {
+ const CXXRecordDecl *RD = MD->getParent();
+ // We have to convert it to have a record layout.
+ Types.ConvertTagDeclType(RD);
+ const CGRecordLayout &CGLayout = Types.getCGRecordLayout(RD);
+ // A definition of a KeyFunction, generates all the class data, such
+ // as vtable, rtti and the VTT.
+ if (CGLayout.getKeyFunction() == MD)
+ getVtableInfo().GenerateClassData(RD);
+ }
if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(D))
EmitCXXConstructor(CD, GD.getCtorType());
else if (const CXXDestructorDecl *DD = dyn_cast<CXXDestructorDecl>(D))
OpenPOWER on IntegriCloud