mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 05:29:24 +00:00
Fix Type::isSized() to realize that "{ opaque }" is not sized
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14585 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cf27afb64e
commit
c5f143b6e7
@ -206,8 +206,8 @@ public:
|
|||||||
/// TargetData subsystem to do this.
|
/// TargetData subsystem to do this.
|
||||||
///
|
///
|
||||||
bool isSized() const {
|
bool isSized() const {
|
||||||
return ID != VoidTyID && ID != TypeTyID &&
|
return (ID >= BoolTyID && ID <= DoubleTyID) || ID == PointerTyID ||
|
||||||
ID != FunctionTyID && ID != LabelTyID && ID != OpaqueTyID;
|
isSizedDerivedType();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getPrimitiveSize - Return the basic size of this type if it is a primative
|
/// getPrimitiveSize - Return the basic size of this type if it is a primative
|
||||||
@ -306,6 +306,11 @@ public:
|
|||||||
RefCountIsZero();
|
RefCountIsZero();
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
|
/// isSizedDerivedType - Derived types like structures and arrays are sized
|
||||||
|
/// iff all of the members of the type are sized as well. Since asking for
|
||||||
|
/// their size is relatively uncommon, move this operation out of line.
|
||||||
|
bool isSizedDerivedType() const;
|
||||||
|
|
||||||
virtual void RefCountIsZero() const {
|
virtual void RefCountIsZero() const {
|
||||||
abort(); // only on derived types!
|
abort(); // only on derived types!
|
||||||
}
|
}
|
||||||
|
@ -159,6 +159,21 @@ unsigned Type::getPrimitiveSize() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// isSizedDerivedType - Derived types like structures and arrays are sized
|
||||||
|
/// iff all of the members of the type are sized as well. Since asking for
|
||||||
|
/// their size is relatively uncommon, move this operation out of line.
|
||||||
|
bool Type::isSizedDerivedType() const {
|
||||||
|
if (const ArrayType *ATy = dyn_cast<ArrayType>(this))
|
||||||
|
return ATy->getElementType()->isSized();
|
||||||
|
|
||||||
|
if (!isa<StructType>(this)) return false;
|
||||||
|
|
||||||
|
// Okay, our struct is sized if all of the elements are...
|
||||||
|
for (subtype_iterator I = subtype_begin(), E = subtype_end(); I != E; ++I)
|
||||||
|
if (!(*I)->isSized()) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/// getForwardedTypeInternal - This method is used to implement the union-find
|
/// getForwardedTypeInternal - This method is used to implement the union-find
|
||||||
/// algorithm for when a type is being forwarded to another type.
|
/// algorithm for when a type is being forwarded to another type.
|
||||||
|
Loading…
Reference in New Issue
Block a user