CXXThisDecl->Destroy(getContext());
// Set the right linkage.
- llvm::GlobalValue::LinkageTypes ThunkLinkage;
-
- if (CGM.getFunctionLinkage(MD) == llvm::Function::InternalLinkage)
- ThunkLinkage = llvm::Function::InternalLinkage;
- else
- ThunkLinkage = llvm::Function::WeakAnyLinkage;
-
- Fn->setLinkage(ThunkLinkage);
+ Fn->setLinkage(CGM.getFunctionLinkage(MD));
// Set the right visibility.
CGM.setGlobalVisibility(Fn, MD);
virtual void f();
};
-// CHECK: define weak void @_ZThn8_N5Test11C1fEv(
+// CHECK: define void @_ZThn8_N5Test11C1fEv(
void C::f() { }
}
virtual void f();
};
-// CHECK: define weak void @_ZTv0_n24_N5Test21B1fEv(
+// CHECK: define void @_ZTv0_n24_N5Test21B1fEv(
void B::f() { }
}
virtual V2 *f();
};
-// CHECK: define weak %{{.*}}* @_ZTch0_v0_n24_N5Test31B1fEv(
+// CHECK: define %{{.*}}* @_ZTch0_v0_n24_N5Test31B1fEv(
V2 *B::f() { return 0; }
}
virtual void f();
};
-// CHECK: define weak protected void @_ZThn8_N5Test41C1fEv(
+// CHECK: define protected void @_ZThn8_N5Test41C1fEv(
void C::f() { }
}
+// This is from Test5:
+// CHECK: define linkonce_odr void @_ZTv0_n24_N5Test51B1fEv
+
// Check that the thunk gets internal linkage.
namespace {
c.f();
}
+
+namespace Test5 {
+
+// Check that the thunk for 'B::f' gets the same linkage as the function itself.
+struct A {
+ virtual void f();
+};
+
+struct B : virtual A {
+ virtual void f() { }
+};
+
+void f(B b) {
+ b.f();
+}
+}
+
+