[llvm-commits] CVS: llvm-gcc/gcc/llvm-out.h llvm-types.c toplev.c
Chris Lattner
lattner at cs.uiuc.edu
Fri May 7 14:20:02 PDT 2004
Changes in directory llvm-gcc/gcc:
llvm-out.h updated: 1.3 -> 1.4
llvm-types.c updated: 1.5 -> 1.6
toplev.c updated: 1.4 -> 1.5
---
Log message:
Fix PR329: http://llvm.cs.uiuc.edu/PR329 : [llvmgcc] type names are not emitted for structure typedefs
---
Diffs of the changes: (+24 -1)
Index: llvm-gcc/gcc/llvm-out.h
diff -u llvm-gcc/gcc/llvm-out.h:1.3 llvm-gcc/gcc/llvm-out.h:1.4
--- llvm-gcc/gcc/llvm-out.h:1.3 Thu Feb 5 10:05:45 2004
+++ llvm-gcc/gcc/llvm-out.h Fri May 7 14:20:26 2004
@@ -48,6 +48,11 @@
*/
void llvm_assemble_external(union tree_node *decl);
+/* llvm_emit_type_decl - This is called to emit type declarations for type-defs
+ * that are not already named.
+ */
+void llvm_emit_type_decl(union tree_node *decl);
+
/* llvm_c_expand_body - Expand the specified function into LLVM code
and emit it. */
void llvm_c_expand_body(union tree_node *);
Index: llvm-gcc/gcc/llvm-types.c
diff -u llvm-gcc/gcc/llvm-types.c:1.5 llvm-gcc/gcc/llvm-types.c:1.6
--- llvm-gcc/gcc/llvm-types.c:1.5 Fri May 7 13:34:32 2004
+++ llvm-gcc/gcc/llvm-types.c Fri May 7 14:20:26 2004
@@ -1409,3 +1409,19 @@
}
abort();
}
+
+
+/* llvm_emit_type_decl - This is called to emit type declarations for type-defs
+ * that are not already named.
+ */
+void llvm_emit_type_decl(tree decl) {
+ llvm_type *Ty = llvm_type_get_from_tree(TREE_TYPE(decl));
+
+ /* If this typedef provides a name for a structure type that does not have a
+ * tag, apply it now.
+ */
+ if (DECL_NAME(decl) && Ty->ID == StructTyID && Ty->x.Struct.TypeName == 0) {
+ const char *N = IDENTIFIER_POINTER(DECL_NAME(decl));
+ Ty->x.Struct.TypeName = get_type_name(N, "struct.", DECL_CONTEXT(decl));
+ }
+}
Index: llvm-gcc/gcc/toplev.c
diff -u llvm-gcc/gcc/toplev.c:1.4 llvm-gcc/gcc/toplev.c:1.5
--- llvm-gcc/gcc/toplev.c:1.4 Thu Feb 5 10:05:45 2004
+++ llvm-gcc/gcc/toplev.c Fri May 7 14:20:26 2004
@@ -1951,7 +1951,9 @@
}
}
else if (EMIT_LLVM) {
- /* Do not send to debugging */
+ /* Do not send to debug info. */
+ if (TREE_CODE(decl) == TYPE_DECL)
+ llvm_emit_type_decl(decl);
}
#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
else if ((write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
More information about the llvm-commits
mailing list