[llvm-commits] [llvm-gcc-4.2] r118749 - /llvm-gcc-4.2/trunk/gcc/c-typeck.c

Stuart Hastings stuart at apple.com
Wed Nov 10 16:33:13 PST 2010


Author: stuart
Date: Wed Nov 10 18:33:13 2010
New Revision: 118749

URL: http://llvm.org/viewvc/llvm-project?rev=118749&view=rev
Log:
Support taking the address of a block function within a block.
Radar 8521187.
Needs a test case.

Modified:
    llvm-gcc-4.2/trunk/gcc/c-typeck.c

Modified: llvm-gcc-4.2/trunk/gcc/c-typeck.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-typeck.c?rev=118749&r1=118748&r2=118749&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-typeck.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-typeck.c Wed Nov 10 18:33:13 2010
@@ -4976,7 +4976,27 @@
     warning (OPT_Wtraditional, "traditional C rejects automatic "
 	     "aggregate initialization");
 
-  DECL_INITIAL (decl) = value;
+  /* LLVM LOCAL begin 8521187 */
+  {
+    bool was_error_mark = (DECL_INITIAL(decl) == error_mark_node);
+    extern void * TheTreeToLLVM;        /* llvm-internal.h is not available here.  Ugh.  */
+
+    DECL_INITIAL (decl) = value;
+
+    /*
+     * If we're updating the initialization of a variable or function decl,
+     * and we're inside a function body (not initializing a global or static),
+     * and the previous value was the placeholder 'error_mark_node',
+     * then tell LLVM we updated the initialization.
+     */
+    if ((TREE_CODE(decl) == VAR_DECL || TREE_CODE(decl) == FUNCTION_DECL)
+        && TREE_STATIC(decl) && was_error_mark && TheTreeToLLVM)
+      {
+        extern void reset_type_and_initializer_llvm(tree);
+        reset_type_and_initializer_llvm(decl);
+      }
+  }
+  /* LLVM LOCAL end 8521187 */
 
   /* ANSI wants warnings about out-of-range constant initializers.  */
   STRIP_TYPE_NOPS (value);





More information about the llvm-commits mailing list