[llvm-commits] CVS: llvm-gcc/gcc/llvm-types.c

Chris Lattner lattner at cs.uiuc.edu
Tue Jun 8 02:18:01 PDT 2004


Changes in directory llvm-gcc/gcc:

llvm-types.c updated: 1.8 -> 1.9

---
Log message:

Opaque structure types in function arguments mean that none of the function
arguments can be known.  Expand the function type as (...), which will allow
it to be overloaded later using the normal mechanisms used by the C frontend.

This fixes PR355: http://llvm.cs.uiuc.edu/PR355 


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

Index: llvm-gcc/gcc/llvm-types.c
diff -u llvm-gcc/gcc/llvm-types.c:1.8 llvm-gcc/gcc/llvm-types.c:1.9
--- llvm-gcc/gcc/llvm-types.c:1.8	Thu Jun  3 01:49:31 2004
+++ llvm-gcc/gcc/llvm-types.c	Tue Jun  8 02:12:43 2004
@@ -950,8 +950,17 @@
       llvm_type *ArgTy = llvm_type_get_from_tree(TREE_VALUE(Args));
       if (isPassedByInvisibleReference(TREE_VALUE(Args)))
         ArgTy = llvm_type_get_pointer(ArgTy);
-      assert(ArgTy->ID != OpaqueTyID && "Cannot pass opaque type by value!");
-      NumArgs += llvm_type_get_num_recursive_elements(ArgTy);
+      if (ArgTy->ID != OpaqueTyID)
+        NumArgs += llvm_type_get_num_recursive_elements(ArgTy);
+      else {
+        /* If an opaque struct is being passed by value, we don't know how many
+         * elements it will expand to.  At this point, codegen the prototype as
+         * (...).
+         */
+        NumArgs = 0;
+        Args = 0;
+        break;
+      }
     }
 
     /* If the function returns a struct, then it REALLY will be





More information about the llvm-commits mailing list