summaryrefslogtreecommitdiff
path: root/lib/Target/TargetData.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-06-02 05:21:06 +0000
committerChris Lattner <sabre@nondot.org>2003-06-02 05:21:06 +0000
commit4954f049147c88a1a6bb294fa7e6accee3006e68 (patch)
treeefea4eb7887ce60288c00d8c0a7d8536844c88c9 /lib/Target/TargetData.cpp
parent2e33430a0d256a3631b26602a54d7a20d62a9066 (diff)
downloadllvm-4954f049147c88a1a6bb294fa7e6accee3006e68.tar.gz
llvm-4954f049147c88a1a6bb294fa7e6accee3006e68.tar.bz2
llvm-4954f049147c88a1a6bb294fa7e6accee3006e68.tar.xz
Minor cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6535 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/TargetData.cpp')
-rw-r--r--lib/Target/TargetData.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp
index 1c6f9d1aa3..ede96f7aae 100644
--- a/lib/Target/TargetData.cpp
+++ b/lib/Target/TargetData.cpp
@@ -195,10 +195,10 @@ uint64_t TargetData::getIndexedOffset(const Type *ptrTy,
// Get the array index and the size of each array element.
// Both must be known constants, or the index shd be 0; else this fails.
int64_t arrayIdx = cast<ConstantSInt>(Idx[CurIDX])->getValue();
- Result += arrayIdx == 0? 0
- : (uint64_t) (arrayIdx * (int64_t) getTypeSize(Ty));
+ Result += arrayIdx * (int64_t)getTypeSize(Ty);
- } else if (const StructType *STy = dyn_cast<const StructType>(Ty)) {
+ } else {
+ const StructType *STy = cast<StructType>(Ty);
assert(Idx[CurIDX]->getType() == Type::UByteTy && "Illegal struct idx");
unsigned FieldNo = cast<ConstantUInt>(Idx[CurIDX])->getValue();
@@ -211,9 +211,6 @@ uint64_t TargetData::getIndexedOffset(const Type *ptrTy,
// Update Ty to refer to current element
Ty = STy->getElementTypes()[FieldNo];
- } else {
- assert(0 && "Indexing type that is not struct or array?");
- return 0; // Load directly through ptr
}
}