Fixup codegen for static dispatch to a virtual function that was
almost correct. :-)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80181 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp
index c72eca2..3c7115d 100644
--- a/lib/CodeGen/CGCXX.cpp
+++ b/lib/CodeGen/CGCXX.cpp
@@ -216,7 +216,7 @@
// Explicit qualification with the scope operator (5.1) suppresses the
// virtual call mechanism.
llvm::Value *Callee;
- if (MD->isVirtual() && !isa<CXXQualifiedMemberExpr>(CE)) {
+ if (MD->isVirtual() && !isa<CXXQualifiedMemberExpr>(ME)) {
Callee = BuildVirtualCall(MD, This, Ty);
} else
Callee = CGM.GetAddrOfFunction(GlobalDecl(MD), Ty);
diff --git a/test/CodeGenCXX/virt.cpp b/test/CodeGenCXX/virt.cpp
index 4d63ab0..cf7bbc1 100644
--- a/test/CodeGenCXX/virt.cpp
+++ b/test/CodeGenCXX/virt.cpp
@@ -137,8 +137,9 @@
// CHECK-LPOPT32-NEXT: movl (%eax), %ecx
// CHECK-LPOPT32-NEXT: movl %eax, (%esp)
// CHECK-LPOPT32-NEXT: call *4(%ecx)
-// FIXME: See EmitCXXMemberCallExpr
-// CHECK-LPOPT32-NEXT call __ZN8test12_A3fooEv
+// CHECK-LPOPT32-NEXT: movl _test12_pa, %eax
+// CHECK-LPOPT32-NEXT: movl %eax, (%esp)
+// CHECK-LPOPT32-NEXT: call L__ZN8test12_A3fooEv$stub
// CHECK-LPOPT64:__Z10test12_foov:
// CHECK-LPOPT64: movq _test12_pa(%rip), %rdi
@@ -159,8 +160,8 @@
// CHECK-LPOPT64-NEXT: movq _test12_pd(%rip), %rdi
// CHECK-LPOPT64-NEXT: movq (%rdi), %rax
// CHECK-LPOPT64-NEXT: call *8(%rax)
-// FIXME: See EmitCXXMemberCallExpr
-// CHECK-LPOPT64-NEXT call __ZN8test12_A3fooEv
+// CHECK-LPOPT64-NEXT: movq _test12_pa(%rip), %rdi
+// CHECK-LPOPT64-NEXT: call __ZN8test12_A3fooEv
struct test6_B2 { virtual void funcB2(); char b[1000]; };
struct test6_B1 : virtual test6_B2 { virtual void funcB1(); };