summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/array-constraint.c
Commit message (Collapse)AuthorAgeFilesLines
* Enhance the diagnostic for negative array sizes to include theChandler Carruth2011-01-041-1/+1
| | | | | | | | | | | declaration name of the array when present. This ensures that a poor-man's C++03 static_assert will include the user error message often embedded in the name. Update all the tests to reflect the new wording, and add a test for the name behavior. llvm-svn: 122802
* make clang print types as "const int *" instead of "int const*",Chris Lattner2010-09-051-1/+1
| | | | | | | which is should have done from the beginning. As usual, the most fun with this sort of change is updating all the testcases. llvm-svn: 113090
* Whenever we complain about a failed initialization of a function orDouglas Gregor2010-04-221-1/+1
| | | | | | | | | | | | | | | | | method parameter, provide a note pointing at the parameter itself so the user does not have to manually look for the function/method being called and match up parameters to arguments. For example, we now get: t.c:4:5: warning: incompatible pointer types passing 'long *' to parameter of type 'int *' [-pedantic] f(long_ptr); ^~~~~~~~ t.c:1:13: note: passing argument to parameter 'x' here void f(int *x); ^ llvm-svn: 102038
* Improve diagnostics when we fail to convert from a source type to aDouglas Gregor2010-04-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | destination type for initialization, assignment, parameter-passing, etc. The main issue fixed here is that we used rather confusing wording for diagnostics such as t.c:2:9: warning: initializing 'char const [2]' discards qualifiers, expected 'char *' [-pedantic] char *name = __func__; ^ ~~~~~~~~ We're not initializing a 'char const [2]', we're initializing a 'char *' with an expression of type 'char const [2]'. Similar problems existed for other diagnostics in this area, so I've normalized them all with more precise descriptive text to say what we're initializing/converting/assigning/etc. from and to. The warning for the code above is now: t.c:2:9: warning: initializing 'char *' from an expression of type 'char const [2]' discards qualifiers [-pedantic] char *name = __func__; ^ ~~~~~~~~ Fixes <rdar://problem/7447179>. llvm-svn: 100832
* 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
* Prep for new warning.Mike Stump2009-07-221-1/+1
| | | | llvm-svn: 76709
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-1/+1
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* GNU allows structs with flexible array members to be placed insideDouglas Gregor2009-02-101-1/+1
| | | | | | | arrays and other structs/unions as an extension. Downgrade our error to a warning. Fixes PR3540. llvm-svn: 64239
* Make one expected-diag directive match exactly one actual diagnostic.Sebastian Redl2009-02-071-1/+1
| | | | | | This uncovers some bugs, so several test cases now fail. llvm-svn: 64025
* Centralize error reporting of improper uses of incomplete types in theDouglas Gregor2009-01-191-1/+1
| | | | | | | | | | new DiagnoseIncompleteType. It provides additional information about struct/class/union/enum types when possible, either by pointing to the forward declaration of that type or by pointing to the definition (if we're in the process of defining that type). Fixes <rdar://problem/6500531>. llvm-svn: 62521
* a minor grammar fixChris Lattner2008-12-071-1/+1
| | | | llvm-svn: 60646
* Improve VLA diagnostics/sema checking. Fixes PR2361 and PR2352.Anders Carlsson2008-12-071-1/+1
| | | | llvm-svn: 60638
* Change diagnostic per suggestion, to make it a bit clearer what is Eli Friedman2008-05-271-1/+1
| | | | | | happening. llvm-svn: 51574
* Sema::FinalizeDeclaratorGroup(): Tighten up the tentative definition rule ↵Steve Naroff2008-01-181-1/+1
| | | | | | | | when dealing with arrays. Bug submitted by Eli. llvm-svn: 46179
* Sema::FinalizeDeclaratorGroup()...make sure we emit an diagnostic for ↵Steve Naroff2008-01-181-1/+2
| | | | | | tentative definitions with incomplete types. Touch up all test cases that are effected. llvm-svn: 46152
* Merge all the 'assignment' diagnostic code into one routine, decloning Chris Lattner2008-01-041-1/+1
| | | | | | | | | | | | | 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-1/+1
| | | | | | Adapted from a patch by Anders Carlsson. llvm-svn: 44816
* 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
* Removed Sema::VerifyConstantArrayType(). With the new ↵Steve Naroff2007-08-311-0/+10
| | | | | | | | | | | | | | | | | Array/ConstantArray/VariableArray nodes, this routine was causing more trouble than it was worth. Anders/Chris noticed that it could return an error code without emiting a diagnostic (which results in an silent invalid decl, which should *never* happen). In addition, this routine didn't work well for typedefs and field decls. Lastly, it didn't consider that initializers aren't in place yet. Added Type::getAsConstantArrayType(), Type::getAsVariableArrayType(), Type::getAsVariablyModifiedType(), and Type::isVariablyModifiedType(); Modified Sema::ParseDeclarator() and Sema::ParseField() to use the new predicates. Also added a FIXME for the initializer omission. Also added a missing test for "static" @ file scope. llvm-svn: 41647
* Final phase of array cleanup (for now), removing a FIXME from yesterday.Steve Naroff2007-08-301-0/+8
| | | | | | | | | | | | | | | | | | | | | | Moved several array constraints checks from Sema::VerifyConstantArrayType() to Sema::GetTypeForDeclarator(). VerifyConstantArrayType() is now very simple, and could be removed eventually. Now, we get the following (correct) messages for BlockVarDecls:-) [dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang x.c -pedantic x.c:4:20: error: size of array has non-integer type 'float' int size_not_int[f]; ^ x.c:5:21: error: array size is negative int negative_size[1-2]; ^~~ x.c:6:17: warning: zero size arrays are an extension int zero_size[0]; ^ 3 diagnostics generated. llvm-svn: 41624
* Move the "invalid decl" idiom up to Decl (where we have some bits to steal:-)Steve Naroff2007-08-281-0/+6
| | | | | | | | Converted ParmVarDecl, FileVarDecl, BlockVarDecl, and Sema::ParseIdentifierExpr() to use the idiom. Updated array-constraint.c to make sure we no longer get "undeclared identifier" errors:-) llvm-svn: 41552
* Fix bogus warnings (noticed by Chris) with array-constraints.c.Steve Naroff2007-08-261-1/+17
| | | | | | | | | Remove bogus type conversions in Sema::GetTypeForDeclarator(). This commit only deals with the array types (DeclaratorCheck::Array), though the rest of this routine should be reviewed. Given the complexity of C declarators, I don't want to change the entire routine now (will discuss with Chris tomorrow). llvm-svn: 41443
* steve's recent changes fixed this bogus warning.Chris Lattner2007-08-261-1/+1
| | | | llvm-svn: 41432
* oops, this is the real fix.Chris Lattner2007-08-021-1/+1
| | | | llvm-svn: 40766
* update testChris Lattner2007-08-021-1/+1
| | | | llvm-svn: 40765
* Fix a crasher that Neil reported: Sema::GetTypeForDeclarator should never Chris Lattner2007-07-191-0/+11
return a null type. If there is an error parsing the type, pick a new type for error recovery purposes. llvm-svn: 40029
OpenPOWER on IntegriCloud