[llvm-commits] [dragonegg] r137950 - /dragonegg/trunk/src/Types.cpp

Duncan Sands baldrick at free.fr
Thu Aug 18 10:20:31 PDT 2011


Author: baldrick
Date: Thu Aug 18 12:20:31 2011
New Revision: 137950

URL: http://llvm.org/viewvc/llvm-project?rev=137950&view=rev
Log:
When joining with an size zero type, discard the size zero type.
Currently this doesn't do anything since we don't consider size
zero types in the first place.

Modified:
    dragonegg/trunk/src/Types.cpp

Modified: dragonegg/trunk/src/Types.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Types.cpp?rev=137950&r1=137949&r2=137950&view=diff
==============================================================================
--- dragonegg/trunk/src/Types.cpp (original)
+++ dragonegg/trunk/src/Types.cpp Thu Aug 18 12:20:31 2011
@@ -955,12 +955,18 @@
 /// disjoint from this one).  After this the range will be the convex hull of
 /// the ranges of the two fields.
 void TypedRange::JoinWith(const TypedRange &S) {
+  if (S.R.empty())
+    return;
+  if (R.empty()) {
+    *this = S;
+    return;
+  }
   // Use an integer type that covers both ranges.  Turning everything into an
   // integer like this is pretty nasty, but as we only get here for bitfields
   // it is fairly harmless.
   R = R.Join(S.R);
-  Ty = R.empty() ? 0 : IntegerType::get(Context, R.getWidth());
-  Starts = R.empty() ? 0 : R.getFirst();
+  Ty = IntegerType::get(Context, R.getWidth());
+  Starts = R.getFirst();
 }
 
 static Type *ConvertRecord(tree type) {





More information about the llvm-commits mailing list