summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2012-09-21 20:39:32 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2012-09-21 20:39:32 +0000
commit86792438dc07ea1521ad254261536ecabffceb8a (patch)
tree50ab2128cd99c437b2f4d6a4f1c239ab53dbf35d
parent2efe53e448097e2f0f6d4a248c8aabfb716fec61 (diff)
downloadbcm5719-llvm-86792438dc07ea1521ad254261536ecabffceb8a.tar.gz
bcm5719-llvm-86792438dc07ea1521ad254261536ecabffceb8a.zip
Call CGM.SetLLVMFunctionAttributesForDefinition on thunks so that they get
attributes like uwtable. Without uwtable a stack unwinder would be unable to go past the thunks. llvm-svn: 164411
-rw-r--r--clang/lib/CodeGen/CGVTables.cpp2
-rw-r--r--clang/test/CodeGenCXX/thunks.cpp19
2 files changed, 19 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp
index 76d2e9bc4bd..774def26e9c 100644
--- a/clang/lib/CodeGen/CGVTables.cpp
+++ b/clang/lib/CodeGen/CGVTables.cpp
@@ -466,6 +466,8 @@ void CodeGenVTables::EmitThunk(GlobalDecl GD, const ThunkInfo &Thunk,
return;
}
+ CGM.SetLLVMFunctionAttributesForDefinition(GD.getDecl(), ThunkFn);
+
if (ThunkFn->isVarArg()) {
// Varargs thunks are special; we can't just generate a call because
// we can't copy the varargs. Our implementation is rather
diff --git a/clang/test/CodeGenCXX/thunks.cpp b/clang/test/CodeGenCXX/thunks.cpp
index bf3b03e4e42..0659259c179 100644
--- a/clang/test/CodeGenCXX/thunks.cpp
+++ b/clang/test/CodeGenCXX/thunks.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 %s -triple=x86_64-pc-linux-gnu -emit-llvm -o - | FileCheck %s
-// RUN: %clang_cc1 %s -triple=x86_64-pc-linux-gnu -fhidden-weak-vtables -emit-llvm -o - | FileCheck -check-prefix=HIDDEN %s
+// RUN: %clang_cc1 %s -triple=x86_64-pc-linux-gnu -munwind-tables -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-pc-linux-gnu -munwind-tables -fhidden-weak-vtables -emit-llvm -o - | FileCheck -check-prefix=HIDDEN %s
namespace Test1 {
@@ -327,6 +327,21 @@ namespace Test13 {
// CHECK: ret %"struct.Test13::D"*
}
+namespace Test14 {
+ class A {
+ virtual void f();
+ };
+ class B {
+ virtual void f();
+ };
+ class C : public A, public B {
+ virtual void f();
+ };
+ void C::f() {
+ }
+ // CHECK: define void @_ZThn8_N6Test141C1fEv({{.*}}) {{.*}} uwtable
+}
+
/**** The following has to go at the end of the file ****/
// This is from Test5:
OpenPOWER on IntegriCloud