[llvm-commits] CVS: llvm/include/llvm/Type.h

Chris Lattner lattner at cs.uiuc.edu
Fri Jul 2 20:19:28 PDT 2004


Changes in directory llvm/include/llvm:

Type.h updated: 1.45 -> 1.46

---
Log message:

Fix Type::isSized() to realize that "{ opaque }" is not sized


---
Diffs of the changes:  (+7 -2)

Index: llvm/include/llvm/Type.h
diff -u llvm/include/llvm/Type.h:1.45 llvm/include/llvm/Type.h:1.46
--- llvm/include/llvm/Type.h:1.45	Thu Jun 17 13:15:25 2004
+++ llvm/include/llvm/Type.h	Fri Jul  2 18:19:50 2004
@@ -206,8 +206,8 @@
   /// 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 @@
       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!
   }





More information about the llvm-commits mailing list