[cfe-commits] r67878 - in /cfe/trunk: lib/Parse/ParseInit.cpp test/CodeGen/designated-initializers.c

Douglas Gregor dgregor at apple.com
Fri Mar 27 16:40:30 PDT 2009


Author: dgregor
Date: Fri Mar 27 18:40:29 2009
New Revision: 67878

URL: http://llvm.org/viewvc/llvm-project?rev=67878&view=rev
Log:
Fix <rdar://problem/6724396>, where we were silently dropping
GNU-style array designators, causing us to emit broken initializers.


Modified:
    cfe/trunk/lib/Parse/ParseInit.cpp
    cfe/trunk/test/CodeGen/designated-initializers.c

Modified: cfe/trunk/lib/Parse/ParseInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseInit.cpp?rev=67878&r1=67877&r2=67878&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseInit.cpp (original)
+++ cfe/trunk/lib/Parse/ParseInit.cpp Fri Mar 27 18:40:29 2009
@@ -210,7 +210,8 @@
       (Desig.getDesignator(0).isArrayDesignator() ||
        Desig.getDesignator(0).isArrayRangeDesignator())) {
     Diag(Tok, diag::ext_gnu_missing_equal_designator);
-    return ParseInitializer();
+    return Actions.ActOnDesignatedInitializer(Desig, SourceLocation(),
+                                              true, ParseInitializer());
   }
 
   Diag(Tok, diag::err_expected_equal_designator);

Modified: cfe/trunk/test/CodeGen/designated-initializers.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/designated-initializers.c?rev=67878&r1=67877&r2=67878&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/designated-initializers.c (original)
+++ cfe/trunk/test/CodeGen/designated-initializers.c Fri Mar 27 18:40:29 2009
@@ -1,4 +1,5 @@
-// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm -o - | grep "<{ i8\* null, i32 1024 }>"
+// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm -o - | grep "<{ i8\* null, i32 1024 }>" &&
+// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm -o - | grep "i32 0, i32 22"
 
 struct foo {
     void *a;
@@ -14,3 +15,7 @@
         .b = 1024,
     };
 }
+
+int b[2] = {
+    [1] 22
+};





More information about the cfe-commits mailing list