[llvm-commits] CVS: llvm/lib/VMCore/Type.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri Jul 2 20:19:35 PDT 2004
Changes in directory llvm/lib/VMCore:
Type.cpp updated: 1.102 -> 1.103
---
Log message:
Fix Type::isSized() to realize that "{ opaque }" is not sized
---
Diffs of the changes: (+15 -0)
Index: llvm/lib/VMCore/Type.cpp
diff -u llvm/lib/VMCore/Type.cpp:1.102 llvm/lib/VMCore/Type.cpp:1.103
--- llvm/lib/VMCore/Type.cpp:1.102 Thu Jun 17 13:18:53 2004
+++ llvm/lib/VMCore/Type.cpp Fri Jul 2 18:20:17 2004
@@ -159,6 +159,21 @@
}
}
+/// 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
/// algorithm for when a type is being forwarded to another type.
More information about the llvm-commits
mailing list