summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/designated-initializers.c
Commit message (Collapse)AuthorAgeFilesLines
* CodeGen: Skip unnamed bitfields when handling designated initializersDavid Majnemer2014-08-231-0/+3
| | | | | | | We would accidently initialize unnamed bitfields instead of the following field. llvm-svn: 216313
* Gracefully (and correctly) handle init of multiple union membersMatthew Curtis2013-10-031-0/+57
| | | | | | | | | | | | | | | We now emit warnings when doing so and code generation is consistent with GCC. Note that the C99 spec is unclear as to the precise behavior. See also ... Bug: http://llvm.org/bugs/show_bug.cgi?id=16644 and cfe-dev discussion: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-September/031918.html llvm-svn: 191890
* Correctly handle designated initializers which modify an array initializedEli Friedman2013-06-111-0/+30
| | | | | | | | | | with a string. This case is sort of tricky because we can't modify the StringLiteral used to represent such initializers. We are forced to decompose the string into individual characters. Fixes <rdar://problem/10465114>. llvm-svn: 183791
* fix an unintended behavior change in the type system rewrite, which caused ↵Chris Lattner2011-07-121-5/+5
| | | | | | | | | | | | | | | | | | | | | us to compile stuff like this: typedef struct { int x, y, z; } foo_t; foo_t g; into: %"struct.<anonymous>" = type { i32, i32, i32 } we now get: %struct.foo_t = type { i32, i32, i32 } This doesn't change the behavior of the compiler, but makes the IR much easier to read. llvm-svn: 134969
* clang side to match the LLVM IR type system rewrite patch.Chris Lattner2011-07-091-6/+6
| | | | llvm-svn: 134831
* Update to match mainline ConstantStruct::get API change. Also, use Chris Lattner2011-06-201-4/+4
| | | | | | | | | | | ConvertType on InitListExprs as they are being converted. This is needed for a forthcoming patch, and improves the IR generated anyway (see additional type names in testcases). This patch also converts a bunch of std::vector's in CGObjCMac to use C arrays. There are a ton more that should be converted as well. llvm-svn: 133413
* This patch fixes multiple issues in clang's designated init builder andDouglas Gregor2010-10-081-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | completes support for C1X anonymous struct/union init features: * Indexed anonymous member initializers should not be expanded. Doing so makes little sense and would cause unresolvable semantic ambiguity in valid code (regression introduced by r69153). * Subobject initialization of (possibly nested) anonymous members are now referred to with paths relative to the naming record context, eliminating the synthesis of incorrect implicit InitListExprs that caused CodeGen to assert. * Field lookup was missing a null check in IdentifierInfo comparison which caused lookup for a known (already resolved) field to match the first unnamed data member it encountered leading to silent miscompilation. * Subobject paths are no longer built using the general purpose Sema::BuildAnonymousStructUnionMemberPath(). If any corner cases crop up, we will now assert earlier in Sema instead of passing invalid InitListExprs through to CodeGen. Fixes PR6955, from Alp Toker! llvm-svn: 116098
* move the hackaround for PR6537 to catch unions as well,Chris Lattner2010-09-061-4/+23
| | | | | | fixing the ICE in PR7151 llvm-svn: 113130
* add another test for the undef patch just for to have peace of mind :)Nuno Lopes2010-04-161-0/+3
| | | | | | this follows from C99 6.7.8p10: if it is a union, the first named member is initialized llvm-svn: 101539
* emit padding as undef values, take 2Nuno Lopes2010-04-161-11/+23
| | | | | | merge also a few tests I had here for this feature, and FileCheck'ize one file llvm-svn: 101535
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-1/+1
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* Eliminate &&s in tests.Daniel Dunbar2009-11-081-2/+2
| | | | | | - 'for i in $(find . -type f); do sed -e 's#\(RUN:.*[^ ]\) *&& *$#\1#g' $i | FileUpdate $i; done', for the curious. llvm-svn: 86430
* Enable the new constant struct builder by default. The old code is still in ↵Anders Carlsson2009-07-271-2/+3
| | | | | | place but will be removed shortly. The new struct builder works on big endian systems. llvm-svn: 77185
* Fix <rdar://problem/6724396>, where we were silently droppingDouglas Gregor2009-03-271-1/+6
| | | | | | GNU-style array designators, causing us to emit broken initializers. llvm-svn: 67878
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-1/+1
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* Force triple for codegen tests which have expectations on outputDaniel Dunbar2009-02-031-1/+1
| | | | | | types. llvm-svn: 63669
* enable test as it already worksNuno Lopes2009-01-301-3/+2
| | | | llvm-svn: 63390
* Introduce a new expression node, ImplicitValueInitExpr, thatDouglas Gregor2009-01-291-0/+17
represents an implicit value-initialization of a subobject of a particular type. This replaces the (ab)use of CXXZeroValueInitExpr within initializer lists for the "holes" that occur due to the use of C99 designated initializers. The new test case is currently XFAIL'd, because CodeGen's ConstExprEmitter (in lib/CodeGen/CGExprConstant.cpp) needs to be taught to value-initialize when it sees ImplicitValueInitExprs. llvm-svn: 63317
OpenPOWER on IntegriCloud