From 0760481f268cf59cba67f8669eb1e74a3a801201 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Fri, 12 Feb 2010 18:14:46 +0000 Subject: [PATCH] Fix a refacto that broke the clang-on-clang build. llvm-svn: 95994 --- clang/lib/CodeGen/CGVtable.cpp | 8 +------ .../CodeGenCXX/virtual-function-calls.cpp | 21 ++++++++++++++++++- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/clang/lib/CodeGen/CGVtable.cpp b/clang/lib/CodeGen/CGVtable.cpp index 93153e31b6b7..16c38002bc34 100644 --- a/clang/lib/CodeGen/CGVtable.cpp +++ b/clang/lib/CodeGen/CGVtable.cpp @@ -1924,8 +1924,6 @@ void CGVtableInfo::ComputeMethodVtableIndices(const CXXRecordDecl *RD) { if (!MD->isVirtual()) continue; - bool ShouldAddEntryForMethod = true; - // Check if this method overrides a method in the primary base. if (const CXXMethodDecl *OverriddenMD = OverridesMethodInPrimaryBase(MD, PrimaryBases)) { @@ -1948,14 +1946,10 @@ void CGVtableInfo::ComputeMethodVtableIndices(const CXXRecordDecl *RD) { } // We don't need to add an entry for this method. - ShouldAddEntryForMethod = false; - break; + continue; } } - if (!ShouldAddEntryForMethod) - continue; - if (const CXXDestructorDecl *DD = dyn_cast(MD)) { if (MD->isImplicit()) { assert(!ImplicitVirtualDtor && diff --git a/clang/test/CodeGenCXX/virtual-function-calls.cpp b/clang/test/CodeGenCXX/virtual-function-calls.cpp index 0b3a684301eb..46e7b2d37f77 100644 --- a/clang/test/CodeGenCXX/virtual-function-calls.cpp +++ b/clang/test/CodeGenCXX/virtual-function-calls.cpp @@ -1,6 +1,8 @@ // RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s // PR5021 +namespace PR5021 { + struct A { virtual void f(char); }; @@ -16,4 +18,21 @@ struct B : virtual A { void f(B * b) { b->f(); -} \ No newline at end of file +} + +} + +namespace Test1 { + struct A { + virtual ~A(); + }; + + struct B : A { + virtual ~B(); + virtual void f(); + }; + + void f(B *b) { + b->f(); + } +}