diff options
author | Devang Patel <dpatel@apple.com> | 2008-02-23 00:47:00 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2008-02-23 00:47:00 +0000 |
commit | d7313c560855555796a7a0e1ec39b7c2059e0542 (patch) | |
tree | 04e88a8ad52fc21004eb4d3e8518e6ec7ed423cd | |
parent | 0cc83b6e851a16292a39d9529ba8aab9b07f0bf0 (diff) |
Use dyn_cast instead of isa + cast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47511 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Instructions.h | 6 | ||||
-rw-r--r-- | lib/VMCore/AsmWriter.cpp | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index 8d912f2370..1335031e5a 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -2375,7 +2375,11 @@ public: return getOperand(0); } - unsigned getIndex() { + inline unsigned getIndex() { + return Idx; + } + + inline const unsigned getIndex() const { return Idx; } diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index 8a7eec9b04..adbcd78c25 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -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)) { |