aboutsummaryrefslogtreecommitdiffstats
path: root/lib/AsmParser
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-06-27 23:41:11 +0000
committerChris Lattner <sabre@nondot.org>2001-06-27 23:41:11 +0000
commit7fc9fe34390c66ca58646d09a87f7dbaacb6c1f8 (patch)
treefd083cad8506b9f54d19b8429dfae825f264c35b /lib/AsmParser
parent138a124f09de272b2ab93cfd6e2a8a283d18029b (diff)
downloadexternal_llvm-7fc9fe34390c66ca58646d09a87f7dbaacb6c1f8.zip
external_llvm-7fc9fe34390c66ca58646d09a87f7dbaacb6c1f8.tar.gz
external_llvm-7fc9fe34390c66ca58646d09a87f7dbaacb6c1f8.tar.bz2
Miscellaneous cleanups:
* Convert post to pre-increment for for loops * Use generic programming more * Use new Value::cast* instructions * Use new Module, Method, & BasicBlock forwarding methods * Use new facilities in STLExtras.h * Use new Instruction::isPHINode() method git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser')
-rw-r--r--lib/AsmParser/llvmAsmParser.cpp14
-rw-r--r--lib/AsmParser/llvmAsmParser.y14
2 files changed, 14 insertions, 14 deletions
diff --git a/lib/AsmParser/llvmAsmParser.cpp b/lib/AsmParser/llvmAsmParser.cpp
index 98417c4..9f18db0 100644
--- a/lib/AsmParser/llvmAsmParser.cpp
+++ b/lib/AsmParser/llvmAsmParser.cpp
@@ -1569,7 +1569,7 @@ case 74:
{
MethodType::ParamTypes ParamTypeList;
if (yyvsp[-1].MethodArgList)
- for (list<MethodArgument*>::iterator I = yyvsp[-1].MethodArgList->begin(); I != yyvsp[-1].MethodArgList->end(); I++)
+ for (list<MethodArgument*>::iterator I = yyvsp[-1].MethodArgList->begin(); I != yyvsp[-1].MethodArgList->end(); ++I)
ParamTypeList.push_back((*I)->getType());
const MethodType *MT = MethodType::getMethodType(yyvsp[-4].TypeVal, ParamTypeList);
@@ -1585,7 +1585,7 @@ case 74:
if (yyvsp[-1].MethodArgList) { // Is null if empty...
Method::ArgumentListType &ArgList = M->getArgumentList();
- for (list<MethodArgument*>::iterator I = yyvsp[-1].MethodArgList->begin(); I != yyvsp[-1].MethodArgList->end(); I++) {
+ for (list<MethodArgument*>::iterator I = yyvsp[-1].MethodArgList->begin(); I != yyvsp[-1].MethodArgList->end(); ++I) {
InsertValue(*I);
ArgList.push_back(*I);
}
@@ -1658,9 +1658,9 @@ case 85:
{
Value *D = getVal(Type::TypeTy, yyvsp[0].ValIDVal, true);
if (D == 0) ThrowException("Invalid user defined type: " + yyvsp[0].ValIDVal.getName());
- assert (D->getValueType() == Value::ConstantVal &&
- "Internal error! User defined type not in const pool!");
- ConstPoolType *CPT = (ConstPoolType*)D;
+
+ // User defined type not in const pool!
+ ConstPoolType *CPT = (ConstPoolType*)D->castConstantAsserting();
yyval.TypeVal = CPT->getValue();
;
break;}
@@ -1805,7 +1805,7 @@ case 105:
list<pair<ConstPoolVal*, BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(),
end = yyvsp[-1].JumpTable->end();
- for (; I != end; I++)
+ for (; I != end; ++I)
S->dest_push_back(I->first, I->second);
;
break;}
@@ -1916,7 +1916,7 @@ case 118:
const MethodType *Ty = (const MethodType*)yyvsp[-4].TypeVal;
Value *V = getVal(Ty, yyvsp[-3].ValIDVal);
- if (V->getValueType() != Value::MethodVal || V->getType() != Ty)
+ if (!V->isMethod() || V->getType() != Ty)
ThrowException("Cannot call: " + yyvsp[-3].ValIDVal.getName() + "!");
// Create or access a new type that corresponds to the function call...
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y
index 3f71274..6fa817f 100644
--- a/lib/AsmParser/llvmAsmParser.y
+++ b/lib/AsmParser/llvmAsmParser.y
@@ -643,7 +643,7 @@ ArgList : ArgListH {
MethodHeaderH : TypesV STRINGCONSTANT '(' ArgList ')' {
MethodType::ParamTypes ParamTypeList;
if ($4)
- for (list<MethodArgument*>::iterator I = $4->begin(); I != $4->end(); I++)
+ for (list<MethodArgument*>::iterator I = $4->begin(); I != $4->end(); ++I)
ParamTypeList.push_back((*I)->getType());
const MethodType *MT = MethodType::getMethodType($1, ParamTypeList);
@@ -659,7 +659,7 @@ MethodHeaderH : TypesV STRINGCONSTANT '(' ArgList ')' {
if ($4) { // Is null if empty...
Method::ArgumentListType &ArgList = M->getArgumentList();
- for (list<MethodArgument*>::iterator I = $4->begin(); I != $4->end(); I++) {
+ for (list<MethodArgument*>::iterator I = $4->begin(); I != $4->end(); ++I) {
InsertValue(*I);
ArgList.push_back(*I);
}
@@ -713,9 +713,9 @@ ValueRef : INTVAL { // Is it an integer reference...?
Types : ValueRef {
Value *D = getVal(Type::TypeTy, $1, true);
if (D == 0) ThrowException("Invalid user defined type: " + $1.getName());
- assert (D->getValueType() == Value::ConstantVal &&
- "Internal error! User defined type not in const pool!");
- ConstPoolType *CPT = (ConstPoolType*)D;
+
+ // User defined type not in const pool!
+ ConstPoolType *CPT = (ConstPoolType*)D->castConstantAsserting();
$$ = CPT->getValue();
}
| TypesV '(' TypeList ')' { // Method derived type?
@@ -811,7 +811,7 @@ BBTerminatorInst : RET Types ValueRef { // Return with a result...
list<pair<ConstPoolVal*, BasicBlock*> >::iterator I = $8->begin(),
end = $8->end();
- for (; I != end; I++)
+ for (; I != end; ++I)
S->dest_push_back(I->first, I->second);
}
@@ -894,7 +894,7 @@ InstVal : BinaryOps Types ValueRef ',' ValueRef {
const MethodType *Ty = (const MethodType*)$2;
Value *V = getVal(Ty, $3);
- if (V->getValueType() != Value::MethodVal || V->getType() != Ty)
+ if (!V->isMethod() || V->getType() != Ty)
ThrowException("Cannot call: " + $3.getName() + "!");
// Create or access a new type that corresponds to the function call...