summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/array-init.c
Commit message (Collapse)AuthorAgeFilesLines
* Initialization improvements: addition of string initialization and a fewEli Friedman2009-12-191-1/+1
| | | | | | | | small bug fixes in SemaInit, switch over SemaDecl to use it more often, and change a bunch of diagnostics which are different with the new initialization code. llvm-svn: 91767
* 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
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-9/+8
| | | | llvm-svn: 81346
* Prep for new warning.Mike Stump2009-07-221-3/+3
| | | | llvm-svn: 76709
* Make sure we don't give the wrong warning, and make sure not to set Eli Friedman2009-05-291-0/+2
| | | | | | | hadError (suppressing future diagnostics) if we didn't print an error. llvm-svn: 72588
* PR3009: Get rid of bogus warning for scalar compound literals.Eli Friedman2009-05-161-1/+1
| | | | | | | | | This patch isn't quite ideal in that it eliminates the warning for constructs like "int a = {1};", where the braces are in fact redundant. However, that would have required a bunch of refactoring, and it's much less likely to cause confusion compared to redundant nested braces. llvm-svn: 71939
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-1/+1
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* Allow flexible array initializers that are not surrounded byDouglas Gregor2009-03-201-2/+2
| | | | | | | | braces. We now build the appropriate fully-structured initializer list for such things. Per PR3618, verified that we're getting the right code generation. llvm-svn: 67353
* Downgrade the "excess elements in initializer" errors to warnings *inDouglas Gregor2009-02-181-10/+10
| | | | | | C*. They're required errors in C++. llvm-svn: 64964
* Implement semantic analysis for the GNU flexible array initializationDouglas Gregor2009-02-041-6/+5
| | | | | | | | | | | | | extension. The interaction with designated initializers is a bit... interesting... but we follow GNU's lead and don't permit too much crazy code in this area. Also, make the "excess initializers" error message a bit more informative. Addresses PR2561: http://llvm.org/bugs/show_bug.cgi?id=2561 llvm-svn: 63785
* Upgrade the "excess elements in array initializer" warning to anDouglas Gregor2009-01-301-9/+9
| | | | | | | error, since both C99 and C++ consider it an error. For reference, GCC makes this a warning while G++ makes it an error. llvm-svn: 63435
* Code generation support for C99 designated initializers.Douglas Gregor2009-01-281-2/+26
| | | | | | | | | | | | | | | | | | | | The approach I've taken in this patch is relatively straightforward, although the code itself is non-trivial. Essentially, as we process an initializer list we build up a fully-explicit representation of the initializer list, where each of the subobject initializations occurs in order. Designators serve to "fill in" subobject initializations in a non-linear way. The fully-explicit representation makes initializer lists (both with and without designators) easy to grok for codegen and later semantic analyses. We keep the syntactic form of the initializer list linked into the AST for those clients interested in exactly what the user wrote. Known limitations: - Designating a member of a union that isn't the first member may result in bogus initialization (we warn about this) - GNU array-range designators are not supported (we warn about this) llvm-svn: 63242
* 64-bit test fixes.Sebastian Redl2008-11-121-5/+5
| | | | llvm-svn: 59165
* readd test as it passes correctly. nice, but weirdNuno Lopes2008-09-011-0/+14
| | | | llvm-svn: 55615
* Backing out r55607 due to logic errors and test regression.Eli Friedman2008-09-011-14/+0
| | | | | | I'll try to come up with a correct fix for the testcase sometime soon. llvm-svn: 55614
* fix one more this-is-not-a-constant error. test includedNuno Lopes2008-09-011-0/+3
| | | | llvm-svn: 55609
* make CheckArithmeticConstantExpression() aware of &foo and pointersNuno Lopes2008-09-011-0/+13
| | | | llvm-svn: 55607
* Support initialization of incomplete array with zero size (asDaniel Dunbar2008-08-181-1/+1
| | | | | | extension). llvm-svn: 54946
* wrap some long diagnostics, make 'initializer is not a constant' diagnosticChris Lattner2008-08-101-2/+2
| | | | | | a bit more clear (rdar://5646070) llvm-svn: 54606
* Count the number of initializable members correctly in structs/unions Eli Friedman2008-05-251-0/+6
| | | | | | with unnamed members. llvm-svn: 51557
* Diagnose implicit init list for empty aggregate, like struct {}. Fixes Eli Friedman2008-05-251-0/+4
| | | | | | PR2151 (by not creating the empty implicit init list). llvm-svn: 51556
* Move the error checking for variable-sized objects so we don't Eli Friedman2008-05-251-0/+4
| | | | | | double-report errors; fixes PR2362. llvm-svn: 51555
* Switch on SemaInit; this makes some code in SemaDecl dead, but I'll give Eli Friedman2008-05-191-2/+2
| | | | | | it a few days to make sure there aren't any significant regressions. llvm-svn: 51273
* Fix PR2017 and silence some bogus errors.Chris Lattner2008-04-021-3/+2
| | | | llvm-svn: 49068
* Fix PR1992 by computing the right type for string literals, whichChris Lattner2008-02-111-5/+5
| | | | | | | | is an array type not a pointer type. This requires updating some diags that change and updating the code generator to handle the proper form of strings. llvm-svn: 46941
* Fix a bug with struct initializers (in Sema::CheckInitializerListTypes()). Steve Naroff2008-01-281-0/+5
| | | | | | | Test case included from bz1948 (thanks Neil!). Also fixed an 80 column violation... llvm-svn: 46430
* Replace Sema::CheckVariableInitList, CheckConstantInitList, and ↵Steve Naroff2008-01-251-4/+41
| | | | | | | | | | CheckForCharArrayInitializer with CheckInitializerListTypes. The new routine now supports struct/union initializers. This is a modified version of a patch by Eli Friedman. This version passes all of the clang tests and supports vectors:-) Note that Eli and I are still unsatisfied the implementation of CheckInitializerListTypes(). We'd like to find a more elegant implementation. Nevertheless, this is a complex part of the standard (and may be hard to simplify). Since the complexity is localized to this routine, we can iterate without too much disruption:-) llvm-svn: 46339
* Sema::CheckInitializerTypes(). Start simpliying and cleaning up...Steve Naroff2008-01-211-0/+5
| | | | llvm-svn: 46234
* add comments for the various AssignConvertType's, and split int->pointer ↵Chris Lattner2008-01-041-3/+3
| | | | | | from pointer->int. llvm-svn: 45591
* Merge all the 'assignment' diagnostic code into one routine, decloning Chris Lattner2008-01-041-3/+3
| | | | | | | | | | | | | it from several places. This merges the diagnostics, making them more uniform and fewer in number. This also simplifies and cleans up the code. Some highlights: 1. This removes a bunch of very-similar diagnostics. 2. This renames AssignmentCheckResult -> AssignConvertType 3. This merges PointerFromInt + IntFromPointer which were always treated the same. 4. This updates a bunch of test cases that have minor changes to the produced diagnostics. llvm-svn: 45589
* Add support for initializing char arrays from string literals.Steve Naroff2007-12-101-0/+25
| | | | | | Adapted from a patch by Anders Carlsson. llvm-svn: 44816
* Fix the following bug...Steve Naroff2007-10-181-0/+5
| | | | | | | | | | | | | | | | | unsigned char asso_values[] = { 34 }; int legal2() { return asso_values[0]; } The code that creates the new constant array type was operating on the original type. As a result, the constant type being generated was "unsigned char [1][]" (which is wrong). The fix is to operate on the element type - in this case, the correct type is "unsigned char [1]" I added this case to array-init.c, which clearly didn't catch this bogosity... llvm-svn: 43112
* rename -parse-ast-print to -ast-printChris Lattner2007-10-111-1/+1
| | | | | | | rename -parse-ast-dump to -ast-dump remove -parse-ast, which is redundant with -fsyntax-only llvm-svn: 42852
* Removed option "-parse-ast-check" from clang driver. This is now implementedTed Kremenek2007-09-261-1/+1
| | | | | | | | | | | | using "-parse-ast -verify". Updated all test cases (using a sed script) that invoked -parse-ast-check to now use -parse-ast -verify. Fixed a bug where using "-verify" instead of "-parse-ast-check" would not correctly create the DiagClient needed to accumulate diagnostics. llvm-svn: 42365
* Remove a FIXME. Replace a couple asserts with an appropriate errorSteve Naroff2007-09-121-0/+4
| | | | | | diagnostic for illegal initializers. llvm-svn: 41889
* More fun with initializers! Steve Naroff2007-09-041-1/+83
| | | | | | | | | - Fixed many bugs, enhanced test case considerably, added a diagnostic, etc. - Refactored CheckInitList() into CheckVariableInitList()/CheckConstantInitList(). - Added CheckInitExpr(). - Support for multi-dimensional arrays looking good. llvm-svn: 41690
* Finish getting "array-init.c" to work properly.Steve Naroff2007-09-031-3/+11
| | | | | | | | Array scalar initialization is now is reasonable shape. Next step, structure and array of structure initializers. llvm-svn: 41681
* More progress on array initializers.Steve Naroff2007-09-021-1/+5
| | | | | | | | - Added Expr::isConstantExpr(). - Added type checking for InitListExpr elements. - Added diagnostic for trying to initialize a variable sized object. llvm-svn: 41674
* More semantic analysis of initializers.Steve Naroff2007-09-021-0/+9
| | | | | | Added 2 errors and one warning, updated test case. llvm-svn: 41672
* Start implementing semantic analysis for C initializers.Steve Naroff2007-09-021-0/+27
Step 1: Start instantiating InitListExpr's. Step 2: Call newly added function Sema::CheckInitializer() from Sema::ParseDeclarator(). Step 3: Give InitListExpr's a preliminary type. Step 4: Start emitting diagnostics for simple assignments. Note: As a result of step 1, the CodeGen/mandel.c test asserts "Unimplemented agg expr!", which is expected. As a result of step 4, the test below now fails. This isn't expected and needs to be investigated (it appears type checking for C++ references is flawed in some way). ******************** TEST 'Sema/cxx-references.cpp' FAILED! ******************** Command: clang -fsyntax-only Sema/cxx-references.cpp Output: Sema/cxx-references.cpp:8:12: warning: incompatible pointer types assigning 'int &*' to 'int *' int *p = &r; ^~ Sema/cxx-references.cpp:10:20: error: incompatible types assigning 'int (int)' to 'int (&)(int)' int (&rg)(int) = g; ^ Sema/cxx-references.cpp:13:18: error: incompatible types assigning 'int [3]' to 'int (&)[3]' int (&ra)[3] = a; ^ Sema/cxx-references.cpp:16:14: error: incompatible types assigning 'int *' to 'int *&' int *& P = Q; ^ 4 diagnostics generated. ******************** TEST 'Sema/cxx-references.cpp' FAILED! ******************** llvm-svn: 41671
OpenPOWER on IntegriCloud