llvm-project/clang/lib
Yunzhong Gao cb77930d6b Implementing C99 partial re-initialization behavior (DR-253)
Based on previous discussion on the mailing list, clang currently lacks support
for C99 partial re-initialization behavior:
Reference: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-April/029188.html
Reference: http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_253.htm

This patch attempts to fix this problem.

Given the following code snippet,

struct P1 { char x[6]; };
struct LP1 { struct P1 p1; };

struct LP1 l = { .p1 = { "foo" }, .p1.x[2] = 'x' };
// this example is adapted from the example for "struct fred x[]" in DR-253;
// currently clang produces in l: { "\0\0x" },
//   whereas gcc 4.8 produces { "fox" };
// with this fix, clang will also produce: { "fox" };


Differential Review: http://reviews.llvm.org/D5789

llvm-svn: 239446
2015-06-10 00:27:52 +00:00
..
ARCMigrate Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types 2015-05-29 19:42:19 +00:00
AST Implementing C99 partial re-initialization behavior (DR-253) 2015-06-10 00:27:52 +00:00
ASTMatchers Move a test from static-assert.cpp to DeclPrinterTest 2015-06-05 22:40:53 +00:00
Analysis Append CXXDefaultInitExpr's wrapped expression to the CFG when visiting a constructor initializer 2015-06-03 10:12:40 +00:00
Basic [ItaniumMangle] Mangle long double as __float128 for some Power targets 2015-06-09 18:05:33 +00:00
CodeGen Implementing C99 partial re-initialization behavior (DR-253) 2015-06-10 00:27:52 +00:00
Driver clang-cl: Ignore the /o option when /P is specified. 2015-06-09 10:24:06 +00:00
Edit [edit] Don't hit an assert when trying to delete a trailing space at EOF 2015-03-29 18:07:29 +00:00
Format clang-format: Support //!-comments, increase test coverage. 2015-06-09 13:16:54 +00:00
Frontend Removing spurious semi colons; NFC. 2015-06-09 12:04:17 +00:00
FrontendTool Provide a BuryPointer for unique_ptrs. 2014-08-29 16:53:14 +00:00
Headers [PowerPC] Reformat altivec.h with clang-format 2015-06-09 14:39:47 +00:00
Index Rename MacroDefinition -> MacroDefinitionRecord, Preprocessor::MacroDefinition -> MacroDefinition. 2015-05-04 02:25:31 +00:00
Lex Remove unused defaulted argument `IncludeTextualHeaders`. 2015-06-04 23:38:11 +00:00
Parse Correct Loop Hint Diagnostic Message 2015-06-08 23:13:43 +00:00
Rewrite Remove empty non-virtual destructors or mark them =default when non-public 2015-04-11 15:58:30 +00:00
Sema Implementing C99 partial re-initialization behavior (DR-253) 2015-06-10 00:27:52 +00:00
Serialization Implementing C99 partial re-initialization behavior (DR-253) 2015-06-10 00:27:52 +00:00
StaticAnalyzer Implementing C99 partial re-initialization behavior (DR-253) 2015-06-10 00:27:52 +00:00
Tooling Allow replacements created from token ranges to specify language options. 2015-06-03 13:10:41 +00:00
CMakeLists.txt Fix build with various feature flag combinations 2014-07-14 22:17:22 +00:00
Makefile Make clang's rewrite engine a core feature 2014-07-16 16:48:33 +00:00