[llvm-commits] [dragonegg] r97729 - in /dragonegg/trunk: llvm-internal.h llvm-types.cpp

Duncan Sands baldrick at free.fr
Thu Mar 4 05:05:25 PST 2010


Author: baldrick
Date: Thu Mar  4 07:05:25 2010
New Revision: 97729

URL: http://llvm.org/viewvc/llvm-project?rev=97729&view=rev
Log:
When converting a type, always convert the main variant instead.  This was
already the case for everything except enum types, and presumably was due
to problems with incomplete enum types.  Dragonegg doesn't seem to need this
(perhaps because it kicks in at a much later stage than llvm-gcc), so get rid
of the enum special case.  This change also means that the type name will be
based on the name of the main variant, rather than the original type, but this
seems at worst harmless and at best helpful.

Modified:
    dragonegg/trunk/llvm-internal.h
    dragonegg/trunk/llvm-types.cpp

Modified: dragonegg/trunk/llvm-internal.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-internal.h?rev=97729&r1=97728&r2=97729&view=diff
==============================================================================
--- dragonegg/trunk/llvm-internal.h (original)
+++ dragonegg/trunk/llvm-internal.h Thu Mar  4 07:05:25 2010
@@ -192,8 +192,7 @@
                                              AttrListPtr &PAL);
   
 private:
-  const Type *ConvertRECORD(tree_node *type, tree_node *orig_type);
-  const Type *ConvertUNION(tree_node *type, tree_node *orig_type);
+  const Type *ConvertRECORD(tree_node *type);
   void SetFieldIndex(tree_node *field_decl, unsigned int Index);
   bool DecodeStructFields(tree_node *Field, StructTypeConversionInfo &Info);
   void DecodeStructBitField(tree_node *Field, StructTypeConversionInfo &Info);

Modified: dragonegg/trunk/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-types.cpp?rev=97729&r1=97728&r2=97729&view=diff
==============================================================================
--- dragonegg/trunk/llvm-types.cpp (original)
+++ dragonegg/trunk/llvm-types.cpp Thu Mar  4 07:05:25 2010
@@ -643,11 +643,11 @@
 //                      Main Type Conversion Routines
 //===----------------------------------------------------------------------===//
 
-const Type *TypeConverter::ConvertType(tree orig_type) {
-  if (orig_type == error_mark_node) return Type::getInt32Ty(Context);
+const Type *TypeConverter::ConvertType(tree type) {
+  if (type == error_mark_node) return Type::getInt32Ty(Context);
 
   // LLVM doesn't care about variants such as const, volatile, or restrict.
-  tree type = TYPE_MAIN_VARIANT(orig_type);
+  type = TYPE_MAIN_VARIANT(type);
   const Type *Ty;
 
   switch (TREE_CODE(type)) {
@@ -662,22 +662,21 @@
   case RECORD_TYPE:
   case QUAL_UNION_TYPE:
   case UNION_TYPE:
-    Ty = ConvertRECORD(type, orig_type);
+    Ty = ConvertRECORD(type);
     break;
 
   case ENUMERAL_TYPE:
     // Use of an enum that is implicitly declared?
-    if (TYPE_SIZE(orig_type) == 0) {
+    if (TYPE_SIZE(type) == 0) {
       // If we already compiled this type, use the old type.
-      if ((Ty = GET_TYPE_LLVM(orig_type)))
+      if ((Ty = GET_TYPE_LLVM(type)))
         return Ty;
 
       Ty = OpaqueType::get(Context);
-      Ty = TypeDB.setType(orig_type, Ty);
+      Ty = TypeDB.setType(type, Ty);
       break;
     }
     // FALL THROUGH.
-    type = orig_type;
   case BOOLEAN_TYPE:
   case INTEGER_TYPE: {
     if ((Ty = GET_TYPE_LLVM(type))) return Ty;
@@ -859,7 +858,7 @@
     }
   }
 
-  NameType(Ty, orig_type);
+  NameType(Ty, type);
   return Ty;
 }
 
@@ -1927,7 +1926,7 @@
 // For LLVM purposes, we build a new type for B-within-D that 
 // has the correct size and layout for that usage.
 
-const Type *TypeConverter::ConvertRECORD(tree type, tree orig_type) {
+const Type *TypeConverter::ConvertRECORD(tree type) {
   if (const Type *Ty = GET_TYPE_LLVM(type)) {
     // If we already compiled this type, and if it was not a forward
     // definition that is now defined, use the old type.





More information about the llvm-commits mailing list