aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/enum.c
AgeCommit message (Collapse)Author
2012-02-07Fix a couple of nasty bugs involving negative enum constants. ↵Eli Friedman
<rdar://problem/10760113>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149965 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-29Incomplete enum types not to be treated as integer typeFariborz Jahanian
when checking for integer signed/unsigned-ness. PR8694, // rdar://8707031 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120345 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-08Document Clang's support for attributes on individual enumerators andJohn McCall
tweak the documentation for deprecation-with-message. Provide __has_feature tests for both. rdar://problem/8605692 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118435 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-19Revert r114316, -Wunused-value enabled by default was intended.Argyrios Kyrtzidis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114318 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-19Make -Wunused-value off by default, matching GCC. Fixes rdar://7126194.Argyrios Kyrtzidis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114316 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19Fix for PR7911 and PR7921: make isIntegralOrEnumerationType return falseEli Friedman
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? git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111512 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-28Changed text of 'empty enum' diagnostics to say so.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105013 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-28Empty enum in c is now error to match gcc's behavior.Fariborz Jahanian
(radar 8040068). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105011 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09Improve diagnostics like "initializing <type> from an expression ofDouglas Gregor
type..." with "initializing <type> with an expression of type...", which reads better. Thanks to John for the improved wording. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100873 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09Improve diagnostics when we fail to convert from a source type to aDouglas Gregor
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>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100832 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-17When diagnosing enumerator values outside of the range of 'int', beDouglas Gregor
sure that we get the "too large" vs. "too small" part of the diagnostic correct. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96524 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-01Improve handling of enumerator values for C and C++, including:Douglas Gregor
- 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95031 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-13Don't a.k.a. through the primary typedef of an anonymous tag decl.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93362 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-15Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar
- 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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91446 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-01Ok, ok, I give in. Fix tests for unused result warning.Daniel Dunbar
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77780 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-24Rename clang to clang-cc.Daniel Dunbar
Tests and drivers updated, still need to shuffle dirs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67602 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10Add type checking for tentative definitions at the end of theDouglas Gregor
translation unit. Thread the various declarations of variables via VarDecl::getPreviousDeclaration. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66601 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10Partial fix for PR3310, concerning type-checking for tentativeDouglas Gregor
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66584 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06Implement the GNU semantics for forward declarations of enum types inDouglas Gregor
C and C++. Fixes PR3688. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66282 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-19Centralize error reporting of improper uses of incomplete types in theDouglas Gregor
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>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62521 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-17Warn about typedefs of enums without any declarator name. Fixes ↵Douglas Gregor
rdar://problem/6503878 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62397 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-17Teach DeclContext how to find the primary declaration for any TagDeclDouglas Gregor
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62386 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15Create new EnumDecl nodes for redeclarations of enums, linking themDouglas Gregor
together in the same way that we link RecordDecl/CXXRecordDecl nodes. Unify ActOnTag and ActOnTagStruct. Fixes PR clang/2753. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61034 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08Workaround for PR3173. The fix is correct in the sense that if the enum Eli Friedman
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60680 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-23Make all the 'redefinition' diagnostics more consistent, and make the Chris Lattner
"previously defined here" diagnostics all notes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59920 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-07Add test for nested enum redefinition.Daniel Dunbar
- <rdar://problem/6093889> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54470 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-26testcase for PR2416, which we already handle correctly.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54096 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25fix diagnostics.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54079 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25Fix rdar://6095136, various crashes with incomplete enum types.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54074 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03Fix PR2020 by recovering by defining an anonymous enum, instead of recoveringChris Lattner
by filling in the body of a union with enum constants. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53069 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-18Sema::FinalizeDeclaratorGroup()...make sure we emit an diagnostic for ↵Steve Naroff
tentative definitions with incomplete types. Touch up all test cases that are effected. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46152 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-16Type::isArithmeticType(): disallow incomplete enum decls.Steve Naroff
Bug submitted by Eli. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46102 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-11rename -parse-ast-print to -ast-printChris Lattner
rename -parse-ast-dump to -ast-dump remove -parse-ast, which is redundant with -fsyntax-only git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42852 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-26Removed option "-parse-ast-check" from clang driver. This is now implementedTed Kremenek
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42365 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-28compute the required destination type for an enum, emitting various warnings.Chris Lattner
TODO: update the types of the constants and the enum. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41532 91177308-0d34-0410-b5e6-96231b3b80d8