diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index aab868abb97..fb024ed8794 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -623,7 +623,7 @@ Module *RunVMAsmParser(const string &Filename, FILE *F) { %union { Module *ModuleVal; Method *MethodVal; - MethodArgument *MethArgVal; + std::pair *MethArgVal; BasicBlock *BasicBlockVal; TerminatorInst *TermInstVal; Instruction *InstVal; @@ -633,7 +633,7 @@ Module *RunVMAsmParser(const string &Filename, FILE *F) { PATypeHolder *TypeVal; Value *ValueVal; - std::list *MethodArgList; + std::list > *MethodArgList; std::vector *ValueList; std::list > *TypeList; std::list(new MethodArgument(*$1), $2); + delete $1; // Delete the type handle.. } ArgListH : ArgVal ',' ArgListH { $$ = $3; - $3->push_front($1); + $3->push_front(*$1); + delete $1; } | ArgVal { - $$ = new list(); - $$->push_front($1); + $$ = new list >(); + $$->push_front(*$1); + delete $1; } | DOTDOTDOT { - $$ = new list(); - $$->push_front(new MethodArgument(Type::VoidTy)); + $$ = new list >(); + $$->push_front(pair( + new MethodArgument(Type::VoidTy), 0)); } ArgList : ArgListH { @@ -1161,8 +1164,9 @@ MethodHeaderH : OptInternal TypesV STRINGCONSTANT '(' ArgList ')' { vector ParamTypeList; if ($5) - for (list::iterator I = $5->begin(); I != $5->end(); ++I) - ParamTypeList.push_back((*I)->getType()); + for (list >::iterator I = $5->begin(); + I != $5->end(); ++I) + ParamTypeList.push_back(I->first->getType()); bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; if (isVarArg) ParamTypeList.pop_back(); @@ -1196,9 +1200,14 @@ MethodHeaderH : OptInternal TypesV STRINGCONSTANT '(' ArgList ')' { if ($5 && !CurMeth.isDeclare) { // Is null if empty... Method::ArgumentListType &ArgList = M->getArgumentList(); - for (list::iterator I = $5->begin(); I != $5->end(); ++I) { - InsertValue(*I); - ArgList.push_back(*I); + for (list >::iterator I = $5->begin(); + I != $5->end(); ++I) { + if (setValueName(I->first, I->second)) { // Insert into symtab... + assert(0 && "No arg redef allowed!"); + } + + InsertValue(I->first); + ArgList.push_back(I->first); } delete $5; // We're now done with the argument list }