aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-02-12 18:14:46 +0000
committerAnders Carlsson <andersca@mac.com>2010-02-12 18:14:46 +0000
commitc1eec891eb008cf3bc89d69d90af82678513f79b (patch)
tree0f372ce4bc1540134cc5e808bc03075cd3aab9c0
parent52b2e1e0775a7a50616b02be4af92295c61e37f5 (diff)
Fix a refacto that broke the clang-on-clang build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95994 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CGVtable.cpp8
-rw-r--r--test/CodeGenCXX/virtual-function-calls.cpp21
2 files changed, 21 insertions, 8 deletions
diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp
index 93153e31b6..16c38002bc 100644
--- a/lib/CodeGen/CGVtable.cpp
+++ b/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<CXXDestructorDecl>(MD)) {
if (MD->isImplicit()) {
assert(!ImplicitVirtualDtor &&
diff --git a/test/CodeGenCXX/virtual-function-calls.cpp b/test/CodeGenCXX/virtual-function-calls.cpp
index 0b3a684301..46e7b2d37f 100644
--- a/test/CodeGenCXX/virtual-function-calls.cpp
+++ b/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();
+ }
+}