aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/TargetMachine/TargetData.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-09-10 20:10:02 +0000
committerChris Lattner <sabre@nondot.org>2001-09-10 20:10:02 +0000
commit79a4aeb61c5af98e39dd657d7fff952908540de6 (patch)
treeb639c99d96a859c02a4fb7caf01ae2e52a7ac202 /lib/CodeGen/TargetMachine/TargetData.cpp
parent1a4f8ae3c8f859b5ff6a84ba93810b563e8015d6 (diff)
Use correct casts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@542 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/TargetMachine/TargetData.cpp')
-rw-r--r--lib/CodeGen/TargetMachine/TargetData.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/CodeGen/TargetMachine/TargetData.cpp b/lib/CodeGen/TargetMachine/TargetData.cpp
index a3db47fc10..fd9dd26d28 100644
--- a/lib/CodeGen/TargetMachine/TargetData.cpp
+++ b/lib/CodeGen/TargetMachine/TargetData.cpp
@@ -147,16 +147,14 @@ unsigned char TargetData::getTypeAlignment(const Type *Ty) const {
unsigned TargetData::getIndexedOffset(const Type *ptrTy,
const vector<ConstPoolVal*> &Idx) const {
- const PointerType *PtrTy = ptrTy->isPointerType(); // Returns null if not
- assert(PtrTy && "getIndexedOffset on nonpointer!");
-
+ const PointerType *PtrTy = ptrTy->castPointerType();
unsigned Result = 0;
// Get the type pointed to...
const Type *Ty = PtrTy->getValueType();
for (unsigned CurIDX = 0; CurIDX < Idx.size(); ++CurIDX) {
- if (const StructType *STy = Ty->isStructType()) {
+ if (const StructType *STy = Ty->dyncastStructType()) {
assert(Idx[CurIDX]->getType() == Type::UByteTy && "Illegal struct idx");
unsigned FieldNo = ((ConstPoolUInt*)Idx[CurIDX++])->getValue();
@@ -170,7 +168,7 @@ unsigned TargetData::getIndexedOffset(const Type *ptrTy,
// Update Ty to refer to current element
Ty = STy->getElementTypes()[FieldNo];
- } else if (const ArrayType *ATy = Ty->isArrayType()) {
+ } else if (const ArrayType *ATy = Ty->dyncastArrayType()) {
assert(0 && "Loading from arrays not implemented yet!");
} else {
assert(0 && "Indexing type that is not struct or array?");