]> granicus.if.org Git - clang/commitdiff
Call CGM.SetLLVMFunctionAttributesForDefinition on thunks so that they get
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 21 Sep 2012 20:39:32 +0000 (20:39 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 21 Sep 2012 20:39:32 +0000 (20:39 +0000)
attributes like uwtable. Without uwtable a stack unwinder would be unable
to go past the thunks.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164411 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGVTables.cpp
test/CodeGenCXX/thunks.cpp

index 76d2e9bc4bdb0fe3119e6b125067aa1bf346c6a3..774def26e9c79765d9e8aec2efe6a0d18f078f48 100644 (file)
@@ -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
index bf3b03e4e42430c66dd90500657541db4a21fcd1..0659259c1799fd6cd867d25321906dbc17cd3f37 100644 (file)
@@ -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: