[llvm-commits] CVS: llvm/lib/Transforms/TransformInternals.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Oct 17 13:05:02 PDT 2003


Changes in directory llvm/lib/Transforms:

TransformInternals.cpp updated: 1.38 -> 1.39

---
Log message:

Do not crash on empty structures


---
Diffs of the changes:  (+5 -0)

Index: llvm/lib/Transforms/TransformInternals.cpp
diff -u llvm/lib/Transforms/TransformInternals.cpp:1.38 llvm/lib/Transforms/TransformInternals.cpp:1.39
--- llvm/lib/Transforms/TransformInternals.cpp:1.38	Sun Oct 12 22:32:08 2003
+++ llvm/lib/Transforms/TransformInternals.cpp	Fri Oct 17 13:03:54 2003
@@ -53,6 +53,11 @@
   uint64_t ThisOffset;
   const Type *NextType;
   if (const StructType *STy = dyn_cast<StructType>(Ty)) {
+    if (STy->getElementTypes().empty()) {
+      Offset = 0;
+      return STy;
+    }
+
     ThisOffset = Offset;
     NextType = getStructOffsetStep(STy, ThisOffset, Indices, TD);
   } else if (const ArrayType *ATy = dyn_cast<ArrayType>(Ty)) {





More information about the llvm-commits mailing list