summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-11-20 00:02:19 +0000
committerMike Stump <mrs@apple.com>2009-11-20 00:02:19 +0000
commita7a1b7e78004321f28cf482dc5b59cb1a066aa8f (patch)
tree76aafc30b91c5552dbb0da470a82982799e54c43 /clang/lib
parent772f922acb42524d3bd49dd1d0042ca181b0eb2b (diff)
downloadbcm5719-llvm-a7a1b7e78004321f28cf482dc5b59cb1a066aa8f.tar.gz
bcm5719-llvm-a7a1b7e78004321f28cf482dc5b59cb1a066aa8f.zip
Fixup key function calculations.
llvm-svn: 89412
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGRecordLayoutBuilder.cpp8
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp4
2 files changed, 5 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp b/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp
index a63c8325ffa..edf19f78c87 100644
--- a/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp
+++ b/clang/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/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 195acc5bc15..1fbd3b92735 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/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))
OpenPOWER on IntegriCloud