aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-05-05 22:55:13 +0000
committerChris Lattner <sabre@nondot.org>2010-05-05 22:55:13 +0000
commit7e21ffb97e1da7ee5470865859c5b4bfbe0b91a3 (patch)
treeedc15343f2638a9caba981519f4c265a410e800c
parent60a8fbb4242e2535ccddd1fa2d8257ec1bf749c2 (diff)
Pass the globaldecl into GetOrCreateLLVMFunction so that llvm
function attributes like byval get applied to the function definition. This fixes PR7058 and makes i386 llvm/clang bootstrap pass all the same tests as x86-64 bootstrap for me (the llvmc tests still fail in both). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103131 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CGVTables.cpp2
-rw-r--r--test/CodeGenCXX/x86_32-arguments.cpp31
2 files changed, 31 insertions, 2 deletions
diff --git a/lib/CodeGen/CGVTables.cpp b/lib/CodeGen/CGVTables.cpp
index 159753aa35..b18f91b876 100644
--- a/lib/CodeGen/CGVTables.cpp
+++ b/lib/CodeGen/CGVTables.cpp
@@ -2548,7 +2548,7 @@ llvm::Constant *CodeGenModule::GetAddrOfThunk(GlobalDecl GD,
getMangleContext().mangleThunk(MD, Thunk, Name);
const llvm::Type *Ty = getTypes().GetFunctionTypeForVTable(MD);
- return GetOrCreateLLVMFunction(Name, Ty, GlobalDecl());
+ return GetOrCreateLLVMFunction(Name, Ty, GD);
}
static llvm::Value *PerformTypeAdjustment(CodeGenFunction &CGF,
diff --git a/test/CodeGenCXX/x86_32-arguments.cpp b/test/CodeGenCXX/x86_32-arguments.cpp
index f8d655145b..141d3af44a 100644
--- a/test/CodeGenCXX/x86_32-arguments.cpp
+++ b/test/CodeGenCXX/x86_32-arguments.cpp
@@ -3,7 +3,7 @@
// Non-trivial dtors, should both be passed indirectly.
struct S {
~S();
- int s;
+ short s;
};
// CHECK: define void @_Z1fv(%struct.S* sret %
@@ -22,3 +22,32 @@ C g() { return C(); }
// CHECK: define void @_Z1f1C(%class.C*)
void f(C) { }
+
+
+
+
+// PR7058 - Missing byval on MI thunk definition.
+
+// CHECK: define void @_ZThn4_N18BasicAliasAnalysis13getModRefInfoE8CallSite
+// ...
+// CHECK: %struct.CallSite* byval %CS)
+struct CallSite {
+ unsigned Ptr;
+ CallSite(unsigned XX) : Ptr(XX) {}
+};
+
+struct AliasAnalysis {
+ virtual void xyz();
+ virtual void getModRefInfo(CallSite CS) = 0;
+};
+
+struct ModulePass {
+ virtual void xx();
+};
+
+struct BasicAliasAnalysis : public ModulePass, public AliasAnalysis {
+ void getModRefInfo(CallSite CS);
+};
+
+void BasicAliasAnalysis::getModRefInfo(CallSite CS) {
+}