From c8b6f78bebeb130e99dd3003bbbb7ad922ffd7ba Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Tue, 12 Aug 2008 14:52:06 +0200 Subject: LLVM compiler: Fix Objective-C message argument handling. --- MLKLLVMCompiler.mm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/MLKLLVMCompiler.mm b/MLKLLVMCompiler.mm index 794f1ac..3c37eca 100644 --- a/MLKLLVMCompiler.mm +++ b/MLKLLVMCompiler.mm @@ -177,9 +177,18 @@ static Constant Value *sel = [self insertSelectorLookup:messageName]; - std::deque argd (argv->begin(), argv->end()); - argd.push_front (sel); - argd.push_front (object); + // XXX The following doesn't work. Why? + // std::deque argd (*argv); + // argd.push_front (sel); + // argd.push_front (object); + + std::vector argd; + argd.push_back (object); + argd.push_back (sel); + std::vector::iterator e; + for (e = argv->begin(); e != argv->end(); e++) + argd.push_back (*e); + return builder.CreateCall (function, argd.begin(), argd.end()); } @@ -391,7 +400,7 @@ static Constant builder.SetInsertPoint (loopInitBlock); function->getBasicBlockList().push_back (loopInitBlock); - Value *arg = builder.CreateVAArg (ap, PointerType::get(Type::Int8Ty, 0), "arg"); + Value *arg = builder.CreateVAArg (ap, PointerTy, "arg"); Value *cond = builder.CreateICmpEQ (arg, endmarker); builder.CreateCondBr (cond, joinBlock, loopBlock); builder.SetInsertPoint (loopBlock); -- cgit v1.2.3