mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-26 20:26:07 +00:00
Use correct casts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@542 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -147,16 +147,14 @@ unsigned char TargetData::getTypeAlignment(const Type *Ty) const {
|
|||||||
|
|
||||||
unsigned TargetData::getIndexedOffset(const Type *ptrTy,
|
unsigned TargetData::getIndexedOffset(const Type *ptrTy,
|
||||||
const vector<ConstPoolVal*> &Idx) const {
|
const vector<ConstPoolVal*> &Idx) const {
|
||||||
const PointerType *PtrTy = ptrTy->isPointerType(); // Returns null if not
|
const PointerType *PtrTy = ptrTy->castPointerType();
|
||||||
assert(PtrTy && "getIndexedOffset on nonpointer!");
|
|
||||||
|
|
||||||
unsigned Result = 0;
|
unsigned Result = 0;
|
||||||
|
|
||||||
// Get the type pointed to...
|
// Get the type pointed to...
|
||||||
const Type *Ty = PtrTy->getValueType();
|
const Type *Ty = PtrTy->getValueType();
|
||||||
|
|
||||||
for (unsigned CurIDX = 0; CurIDX < Idx.size(); ++CurIDX) {
|
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");
|
assert(Idx[CurIDX]->getType() == Type::UByteTy && "Illegal struct idx");
|
||||||
unsigned FieldNo = ((ConstPoolUInt*)Idx[CurIDX++])->getValue();
|
unsigned FieldNo = ((ConstPoolUInt*)Idx[CurIDX++])->getValue();
|
||||||
|
|
||||||
@@ -170,7 +168,7 @@ unsigned TargetData::getIndexedOffset(const Type *ptrTy,
|
|||||||
// Update Ty to refer to current element
|
// Update Ty to refer to current element
|
||||||
Ty = STy->getElementTypes()[FieldNo];
|
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!");
|
assert(0 && "Loading from arrays not implemented yet!");
|
||||||
} else {
|
} else {
|
||||||
assert(0 && "Indexing type that is not struct or array?");
|
assert(0 && "Indexing type that is not struct or array?");
|
||||||
|
Reference in New Issue
Block a user