aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-11-13 04:59:58 +0000
committerChris Lattner <sabre@nondot.org>2001-11-13 04:59:58 +0000
commite72c557dff15eb3d386fffe37aaebd9dbc641ac6 (patch)
tree72da9c9f3959b5dee3fd0197f289ac6cf954db23 /lib/VMCore
parent3d775c3f39bf8ac2eb945e32865a5ace7b12a29e (diff)
downloadexternal_llvm-e72c557dff15eb3d386fffe37aaebd9dbc641ac6.zip
external_llvm-e72c557dff15eb3d386fffe37aaebd9dbc641ac6.tar.gz
external_llvm-e72c557dff15eb3d386fffe37aaebd9dbc641ac6.tar.bz2
Minor style cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1287 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/iMemory.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/VMCore/iMemory.cpp b/lib/VMCore/iMemory.cpp
index cc24ca1..e980d60 100644
--- a/lib/VMCore/iMemory.cpp
+++ b/lib/VMCore/iMemory.cpp
@@ -27,13 +27,12 @@ const Type* MemAccessInst::getIndexedType(const Type *Ptr,
if (Ptr->isStructType()) {
unsigned CurIDX = 0;
- while (Ptr->isStructType()) {
+ while (const StructType *ST = dyn_cast<StructType>(Ptr)) {
if (Idx.size() == CurIDX)
return AllowStructLeaf ? Ptr : 0; // Can't load a whole structure!?!?
if (Idx[CurIDX]->getType() != Type::UByteTy) return 0; // Illegal idx
unsigned NextIdx = ((ConstPoolUInt*)Idx[CurIDX++])->getValue();
-
- const StructType *ST = (const StructType *)Ptr;
+ if (NextIdx >= ST->getElementTypes().size()) return 0;
Ptr = ST->getElementTypes()[NextIdx];
}
return Ptr;