Use dyn_cast instead of isa + cast.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47511 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel 2008-02-23 00:47:00 +00:00
parent 0cc83b6e85
commit d7313c5608
2 changed files with 7 additions and 3 deletions

View File

@ -2375,7 +2375,11 @@ public:
return getOperand(0);
}
unsigned getIndex() {
inline unsigned getIndex() {
return Idx;
}
inline const unsigned getIndex() const {
return Idx;
}

View File

@ -1291,7 +1291,7 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
writeOperand(I.getOperand(op ), false); Out << ',';
writeOperand(I.getOperand(op+1), false); Out << " ]";
}
} else if (isa<GetResultInst>(I)) {
} else if (const GetResultInst *GRI = dyn_cast<GetResultInst>(&I)) {
const StructType *STy = cast<StructType>(I.getOperand(0)->getType());
unsigned NumElems = STy->getNumElements();
Out << " {";
@ -1303,7 +1303,7 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
}
Out << " }";
writeOperand(I.getOperand(0), false);
Out << ", " << cast<GetResultInst>(I).getIndex();
Out << ", " << GRI->getIndex();
} else if (isa<ReturnInst>(I) && !Operand) {
Out << " void";
} else if (const CallInst *CI = dyn_cast<CallInst>(&I)) {