diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2010-04-03 04:26:42 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2010-04-03 04:26:42 +0000 |
commit | 35d646133ba70e5d44bc2d112ffd5e2ca262dbee (patch) | |
tree | 3fe23de613cf6e946c431c880ea22862434bc0c0 /lib/CodeGen/CGVtable.cpp | |
parent | eea12d17ec3527f4f9474571fd3011f3d825c45a (diff) |
Don't produce a vtable for a class if we have an explicit template instantiation declaration and no key function. We will produce the vtable at the explicit template instantiation.
Fixes PR6748
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100266 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGVtable.cpp')
-rw-r--r-- | lib/CodeGen/CGVtable.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp index 2d1c73440b..fc6d1a8e37 100644 --- a/lib/CodeGen/CGVtable.cpp +++ b/lib/CodeGen/CGVtable.cpp @@ -3146,11 +3146,16 @@ void CodeGenVTables::EmitVTableRelatedData(GlobalDecl GD) { if (KeyFunction->getCanonicalDecl() != MD->getCanonicalDecl()) return; } else { + // If we have no key funcion and this is a explicit instantiation declaration, + // we will produce a vtable at the explicit instantiation. We don't need one + // here. + if (RDKind == clang::TSK_ExplicitInstantiationDeclaration) + return; + // If this is an explicit instantiation of a method, we don't need a vtable. // Since we have no key function, we will emit the vtable when we see // a use, and just defining a function is not an use. - if ((RDKind == TSK_ImplicitInstantiation || - RDKind == TSK_ExplicitInstantiationDeclaration) && + if (RDKind == TSK_ImplicitInstantiation && MDKind == TSK_ExplicitInstantiationDefinition) return; } |