1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

Fix for: test/Regression/Assembler/2002-03-08-NameCollision.ll

llvm-svn: 1836
This commit is contained in:
Chris Lattner 2002-03-08 18:41:32 +00:00
parent 8c292eb226
commit 49c5f320ff

View File

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