summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/enum.c
Commit message (Collapse)AuthorAgeFilesLines
* Update tests touched by r249656David Majnemer2015-10-081-1/+1
| | | | | | | | | These test updates almost exclusively around the change in behavior around enum: enums without a definition are considered incomplete except when targeting MSVC ABIs. Since these tests are interested in the 'incomplete-enum' behavior, restrict them to %itanium_abi_triple. llvm-svn: 249660
* [Sema] Avoid crash on tag-type mismatch (Fixes PR24610)Vedant Kumar2015-09-021-0/+4
| | | | | | Differential Revision: http://reviews.llvm.org/D12444 llvm-svn: 246618
* Fix a couple of nasty bugs involving negative enum constants. ↵Eli Friedman2012-02-071-0/+2
| | | | | | <rdar://problem/10760113>. llvm-svn: 149965
* Incomplete enum types not to be treated as integer typeFariborz Jahanian2010-11-291-0/+13
| | | | | | | when checking for integer signed/unsigned-ness. PR8694, // rdar://8707031 llvm-svn: 120345
* Document Clang's support for attributes on individual enumerators andJohn McCall2010-11-081-0/+2
| | | | | | | tweak the documentation for deprecation-with-message. Provide __has_feature tests for both. rdar://problem/8605692 llvm-svn: 118435
* Revert r114316, -Wunused-value enabled by default was intended.Argyrios Kyrtzidis2010-09-191-2/+2
| | | | llvm-svn: 114318
* Make -Wunused-value off by default, matching GCC. Fixes rdar://7126194.Argyrios Kyrtzidis2010-09-191-2/+2
| | | | llvm-svn: 114316
* Fix for PR7911 and PR7921: make isIntegralOrEnumerationType return falseEli Friedman2010-08-191-0/+6
| | | | | | | | | | | for incomplete enum types. An incomplete enum can't really be treated as an "integral or enumeration" type, and the incorrect treatment leads to bad behavior for many callers. This makes isIntegralOrEnumerationType equivalent to isIntegerType; I think we should globally replace the latter with the former; thoughts? llvm-svn: 111512
* Changed text of 'empty enum' diagnostics to say so.Fariborz Jahanian2010-05-281-1/+1
| | | | llvm-svn: 105013
* Empty enum in c is now error to match gcc's behavior.Fariborz Jahanian2010-05-281-1/+1
| | | | | | (radar 8040068). llvm-svn: 105011
* Improve diagnostics like "initializing <type> from an expression ofDouglas Gregor2010-04-091-1/+1
| | | | | | | type..." with "initializing <type> with an expression of type...", which reads better. Thanks to John for the improved wording. llvm-svn: 100873
* Improve diagnostics when we fail to convert from a source type to aDouglas Gregor2010-04-091-2/+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
* When diagnosing enumerator values outside of the range of 'int', beDouglas Gregor2010-02-171-1/+2
| | | | | | | sure that we get the "too large" vs. "too small" part of the diagnostic correct. llvm-svn: 96524
* Improve handling of enumerator values for C and C++, including:Douglas Gregor2010-02-011-0/+4
| | | | | | | | | | | | | | | | | - In C++, prior to the closing '}', set the type of enumerators based on the type of their initializer. Don't perform unary conversions on the enumerator values. - In C++, handle overflow when an enumerator has no initializer and its value cannot be represented in the type of the previous enumerator. - In C, handle overflow more gracefully, by complaining and then falling back to the C++ rules. - In C, if the enumerator value is representable in an int, convert the expression to the type 'int'. Fixes PR5854 and PR4515. llvm-svn: 95031
* Don't a.k.a. through the primary typedef of an anonymous tag decl.John McCall2010-01-131-0/+8
| | | | llvm-svn: 93362
* 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
* Ok, ok, I give in. Fix tests for unused result warning.Daniel Dunbar2009-08-011-1/+1
| | | | llvm-svn: 77780
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-1/+1
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* Add type checking for tentative definitions at the end of theDouglas Gregor2009-03-101-1/+3
| | | | | | | | | translation unit. Thread the various declarations of variables via VarDecl::getPreviousDeclaration. llvm-svn: 66601
* Partial fix for PR3310, concerning type-checking for tentativeDouglas Gregor2009-03-101-4/+2
| | | | | | | | | | | definitions. We were rejecting tentative definitions of incomplete (which is bad), and now we don't. This fix is partial because we don't do the end-of-translation-unit initialization for tentative definitions that don't ever have any initializers specified. llvm-svn: 66584
* Implement the GNU semantics for forward declarations of enum types inDouglas Gregor2009-03-061-0/+11
| | | | | | C and C++. Fixes PR3688. llvm-svn: 66282
* Centralize error reporting of improper uses of incomplete types in theDouglas Gregor2009-01-191-2/+9
| | | | | | | | | | 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
* Warn about typedefs of enums without any declarator name. Fixes ↵Douglas Gregor2009-01-171-0/+3
| | | | | | rdar://problem/6503878 llvm-svn: 62397
* Teach DeclContext how to find the primary declaration for any TagDeclDouglas Gregor2009-01-171-1/+0
| | | | | | | | | | | | | even when we are still defining the TagDecl. This is required so that qualified name lookup of a class name within its definition works (see the new bits in test/SemaCXX/qualified-id-lookup.cpp). As part of this, move the nested redefinition checking code into ActOnTag. This gives us diagnostics earlier (when we try to perform the nested redefinition, rather than when we try to complete the 2nd definition) and removes some code duplication. llvm-svn: 62386
* Create new EnumDecl nodes for redeclarations of enums, linking themDouglas Gregor2008-12-151-0/+6
| | | | | | | | | | together in the same way that we link RecordDecl/CXXRecordDecl nodes. Unify ActOnTag and ActOnTagStruct. Fixes PR clang/2753. llvm-svn: 61034
* Workaround for PR3173. The fix is correct in the sense that if the enum Eli Friedman2008-12-081-0/+3
| | | | | | | | | code were working correctly, it would be a no-op, but it's not really a proper fix. That said, I don't really want to touch the enum code at the moment because I don't understand it very well, and this seems to be a relatively visible regression. llvm-svn: 60680
* Make all the 'redefinition' diagnostics more consistent, and make the Chris Lattner2008-11-231-3/+3
| | | | | | "previously defined here" diagnostics all notes. llvm-svn: 59920
* Add test for nested enum redefinition.Daniel Dunbar2008-08-071-0/+4
| | | | | | - <rdar://problem/6093889> llvm-svn: 54470
* testcase for PR2416, which we already handle correctly.Chris Lattner2008-07-261-0/+3
| | | | llvm-svn: 54096
* fix diagnostics.Chris Lattner2008-07-251-2/+2
| | | | llvm-svn: 54079
* Fix rdar://6095136, various crashes with incomplete enum types.Chris Lattner2008-07-251-0/+15
| | | | llvm-svn: 54074
* Fix PR2020 by recovering by defining an anonymous enum, instead of recoveringChris Lattner2008-07-031-0/+5
| | | | | | by filling in the body of a union with enum constants. llvm-svn: 53069
* Sema::FinalizeDeclaratorGroup()...make sure we emit an diagnostic for ↵Steve Naroff2008-01-181-2/+2
| | | | | | tentative definitions with incomplete types. Touch up all test cases that are effected. llvm-svn: 46152
* Type::isArithmeticType(): disallow incomplete enum decls.Steve Naroff2008-01-161-0/+6
| | | | | | Bug submitted by Eli. llvm-svn: 46102
* 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
* compute the required destination type for an enum, emitting various warnings.Chris Lattner2007-08-281-0/+24
TODO: update the types of the constants and the enum. llvm-svn: 41532
OpenPOWER on IntegriCloud