diff options
author | Mike Stump <mrs@apple.com> | 2009-11-20 00:02:19 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-11-20 00:02:19 +0000 |
commit | a84b4044b79f2cc424c6ae7ee5edb97e948ba806 (patch) | |
tree | 0822999698e50d2c24f0626a3a299b13b05907f1 /lib/CodeGen | |
parent | 73460a32bc5299a5927d23d2e464d72af796eabf (diff) |
Fixup key function calculations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89412 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CGRecordLayoutBuilder.cpp | 8 | ||||
-rw-r--r-- | lib/CodeGen/CodeGenModule.cpp | 4 |
2 files changed, 5 insertions, 7 deletions
diff --git a/lib/CodeGen/CGRecordLayoutBuilder.cpp b/lib/CodeGen/CGRecordLayoutBuilder.cpp index a63c8325ff..edf19f78c8 100644 --- a/lib/CodeGen/CGRecordLayoutBuilder.cpp +++ b/lib/CodeGen/CGRecordLayoutBuilder.cpp @@ -345,12 +345,8 @@ static const CXXMethodDecl *GetKeyFunction(const RecordDecl *D) { if (MD->isPure()) continue; - // FIXME: This doesn't work. If we have an out of line body, that body will - // set the MD to have a body, what we want to know is, was the body present - // inside the declaration of the class. For now, we just avoid the problem - // by pretending there is no key function. - return 0; - if (MD->getBody()) + const FunctionDecl *fn; + if (MD->getBody(fn) && !fn->isOutOfLine()) continue; // We found it. diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 195acc5bc1..1fbd3b9273 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -623,7 +623,9 @@ void CodeGenModule::EmitGlobalDefinition(GlobalDecl GD) { 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) + if (CGLayout.getKeyFunction() + && (CGLayout.getKeyFunction()->getCanonicalDecl() + == MD->getCanonicalDecl())) getVtableInfo().GenerateClassData(RD); } if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(D)) |