[cfe-commits] r164411 - in /cfe/trunk: lib/CodeGen/CGVTables.cpp test/CodeGenCXX/thunks.cpp

Rafael Espindola rafael.espindola at gmail.com
Fri Sep 21 13:39:32 PDT 2012


Author: rafael
Date: Fri Sep 21 15:39:32 2012
New Revision: 164411

URL: http://llvm.org/viewvc/llvm-project?rev=164411&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/CodeGen/CGVTables.cpp
    cfe/trunk/test/CodeGenCXX/thunks.cpp

Modified: cfe/trunk/lib/CodeGen/CGVTables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.cpp?rev=164411&r1=164410&r2=164411&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTables.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTables.cpp Fri Sep 21 15:39:32 2012
@@ -466,6 +466,8 @@
     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

Modified: cfe/trunk/test/CodeGenCXX/thunks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/thunks.cpp?rev=164411&r1=164410&r2=164411&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/thunks.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/thunks.cpp Fri Sep 21 15:39:32 2012
@@ -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 @@
   // 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:





More information about the cfe-commits mailing list