From 4674804d298d4afba7c2a66b28d7899d9e7f5474 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 9 Apr 2002 19:41:42 +0000 Subject: [PATCH] Move FunctionArgument out of iOther.h into Argument.h and rename class to be 'Argument' instead of FunctionArgument. Rename some yacc type names to be more concise. Change jump table to use a vector instead of a list. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2214 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AsmParser/llvmAsmParser.y | 36 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index b9f9887ca38..91f4574a192 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -16,6 +16,7 @@ #include "llvm/iTerminators.h" #include "llvm/iMemory.h" #include "llvm/iPHINode.h" +#include "llvm/Argument.h" #include "Support/STLExtras.h" #include "Support/DepthFirstIterator.h" #include @@ -612,7 +613,7 @@ Module *RunVMAsmParser(const string &Filename, FILE *F) { %union { Module *ModuleVal; Function *FunctionVal; - std::pair *MethArgVal; + std::pair *ArgVal; BasicBlock *BasicBlockVal; TerminatorInst *TermInstVal; Instruction *InstVal; @@ -622,12 +623,12 @@ Module *RunVMAsmParser(const string &Filename, FILE *F) { PATypeHolder *TypeVal; Value *ValueVal; - std::list > *FunctionArgList; + std::list > *ArgList; std::vector *ValueList; std::list *TypeList; std::list > *PHIList; // Represent the RHS of PHI node - std::list > *JumpTable; + std::vector > *JumpTable; std::vector *ConstVector; int64_t SInt64Val; @@ -654,8 +655,8 @@ Module *RunVMAsmParser(const string &Filename, FILE *F) { %type Inst InstVal MemoryInst %type ConstVal %type ConstVector -%type ArgList ArgListH -%type ArgVal +%type ArgList ArgListH +%type ArgVal %type PHIList %type ValueRefList ValueRefListE // For call param lists %type IndexList // For GEP derived indices @@ -1127,7 +1128,7 @@ FunctionList : FunctionList Function { OptVAR_ID : VAR_ID | /*empty*/ { $$ = 0; } ArgVal : Types OptVAR_ID { - $$ = new pair(new FunctionArgument(*$1), $2); + $$ = new pair(new Argument(*$1), $2); delete $1; // Delete the type handle.. } @@ -1137,14 +1138,13 @@ ArgListH : ArgVal ',' ArgListH { delete $1; } | ArgVal { - $$ = new list >(); + $$ = new list >(); $$->push_front(*$1); delete $1; } | DOTDOTDOT { - $$ = new list >(); - $$->push_front(pair( - new FunctionArgument(Type::VoidTy), 0)); + $$ = new list >(); + $$->push_front(pair(new Argument(Type::VoidTy), 0)); } ArgList : ArgListH { @@ -1160,7 +1160,7 @@ FunctionHeaderH : OptInternal TypesV STRINGCONSTANT '(' ArgList ')' { vector ParamTypeList; if ($5) - for (list >::iterator I = $5->begin(); + for (list >::iterator I = $5->begin(); I != $5->end(); ++I) ParamTypeList.push_back(I->first->getType()); @@ -1202,7 +1202,7 @@ FunctionHeaderH : OptInternal TypesV STRINGCONSTANT '(' ArgList ')' { if ($5 && !CurMeth.isDeclare) { // Is null if empty... Function::ArgumentListType &ArgList = M->getArgumentList(); - for (list >::iterator I = $5->begin(); + 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!"); @@ -1214,8 +1214,8 @@ FunctionHeaderH : OptInternal TypesV STRINGCONSTANT '(' ArgList ')' { delete $5; // We're now done with the argument list } else if ($5) { // If we are a declaration, we should free the memory for the argument list! - for (list >::iterator I = $5->begin(); - I != $5->end(); ++I) { + for (list >::iterator I = $5->begin(), E = $5->end(); + I != E; ++I) { if (I->second) free(I->second); // Free the memory for the name... delete I->first; // Free the unused function argument } @@ -1349,9 +1349,9 @@ BBTerminatorInst : RET ResolvedVal { // Return with a result... cast(getVal(Type::LabelTy, $6))); $$ = S; - list >::iterator I = $8->begin(), - end = $8->end(); - for (; I != end; ++I) + vector >::iterator I = $8->begin(), + E = $8->end(); + for (; I != E; ++I) S->dest_push_back(I->first, I->second); } | INVOKE TypesV ValueRef '(' ValueRefListE ')' TO ResolvedVal @@ -1419,7 +1419,7 @@ JumpTable : JumpTable IntType ConstValueRef ',' LABEL ValueRef { $$->push_back(make_pair(V, cast(getVal($5, $6)))); } | IntType ConstValueRef ',' LABEL ValueRef { - $$ = new list >(); + $$ = new vector >(); Constant *V = cast(getValNonImprovising($1, $2)); if (V == 0) -- 2.34.1