diff options
author | Chris Lattner <sabre@nondot.org> | 2004-07-02 23:20:17 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-07-02 23:20:17 +0000 |
commit | c5f143b6e7d287d0dc3e5c55b3c83a2670ca99f8 (patch) | |
tree | 4332b0a9fe8235e481e27f12170a19cb75770c41 /include/llvm/Type.h | |
parent | cf27afb64e3387a747a467072536df8259488213 (diff) |
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
Diffstat (limited to 'include/llvm/Type.h')
-rw-r--r-- | include/llvm/Type.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/llvm/Type.h b/include/llvm/Type.h index e25bfe1e0f..1598f0b97f 100644 --- a/include/llvm/Type.h +++ b/include/llvm/Type.h @@ -206,8 +206,8 @@ public: /// TargetData subsystem to do this. /// bool isSized() const { - return ID != VoidTyID && ID != TypeTyID && - ID != FunctionTyID && ID != LabelTyID && ID != OpaqueTyID; + return (ID >= BoolTyID && ID <= DoubleTyID) || ID == PointerTyID || + isSizedDerivedType(); } /// getPrimitiveSize - Return the basic size of this type if it is a primative @@ -306,6 +306,11 @@ public: RefCountIsZero(); } 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 { abort(); // only on derived types! } |