diff options
author | Matthias Andreas Benkard <matthias@benkard.de> | 2008-08-12 14:52:06 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <matthias@benkard.de> | 2008-08-12 14:52:06 +0200 |
commit | c8b6f78bebeb130e99dd3003bbbb7ad922ffd7ba (patch) | |
tree | 2f02c3399af2f956191f7f8810085c3f8bc67d36 | |
parent | 881d4f5cf7e85b87ed0f3bd55fd1542a7ca743f4 (diff) |
LLVM compiler: Fix Objective-C message argument handling.
-rw-r--r-- | MLKLLVMCompiler.mm | 17 |
1 files 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 <Value *> argd (argv->begin(), argv->end()); - argd.push_front (sel); - argd.push_front (object); + // XXX The following doesn't work. Why? + // std::deque <Value *> argd (*argv); + // argd.push_front (sel); + // argd.push_front (object); + + std::vector <Value *> argd; + argd.push_back (object); + argd.push_back (sel); + std::vector<Value *>::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); |