summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/switch.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Sema] Avoid "case value not in enumerated type" warning for C++11 opaque enumsAlex Lorenz2016-12-081-0/+30
| | | | | | | | | | | | This commit ensures that the switch warning "case value not in enumerated type" isn't shown for opaque enums. We don't know the actual list of values in opaque enums, so that warning is incorrect. rdar://29230764 Differential Revision: https://reviews.llvm.org/D27299 llvm-svn: 289055
* Refactor places which perform contextual implicit conversions to go through aRichard Smith2013-05-211-0/+15
| | | | | | | | | | | | | common function. The C++1y contextual implicit conversion rules themselves are not yet implemented, however. This also fixes a subtle bug where template instantiation context notes were dropped for diagnostics coming from conversions for integral constant expressions -- we were implicitly slicing a SemaDiagnosticBuilder into a DiagnosticBuilder when producing these diagnostics, and losing their context notes in the process. llvm-svn: 182406
* Reject continue/break statements within members of local functions nested withinRichard Smith2012-02-171-1/+22
| | | | | | | | | | | | | | | loop and switch statements, by teaching Scope that a function scope never has a continue/break parent for the purposes of control flow. Remove the hack in block and lambda expressions which worked around this by pretending that such expressions were continue/break scopes. Remove Scope::ControlParent, since it's unused. In passing, teach default statements to recover properly from a missing ';', and add a fixit for same to both default and case labels (the latter already recovered correctly). llvm-svn: 150776
* Move -Wswitch-enum to -WswitchDavid Blaikie2012-01-221-1/+1
| | | | | | | | | | | | | | | This matches GCC's documented (& actual) behavior. What Clang had implemented as -Wswitch-enum was actually GCC's -Wswitch behavior. -Wswitch is on by default (part of -Wall) and warns if a switch-over-enum, without a default case, covers all enum values. -Wswitch-enum, on the other hand, does not have the default clause and should fire even in the presence of a default. This warning is off by default. With this change the -Wswitch-enum flag is off-by-default in Clang but has no functionality at the moment. I'll add that in a future commit. llvm-svn: 148648
* Expand the coverage of the warning for constants on the RHS of logical operands:Chandler Carruth2011-05-311-1/+1
| | | | | | | | | | | | return f() || -1; where the user meant to write '|'. This bootstraps without any additional warnings. Patch by Richard Trieu. llvm-svn: 132327
* compute the integer width, not the memory width here. We want to know thatChris Lattner2011-02-241-0/+7
| | | | | | | _Bool is 1 bit, not 8. This fixes an assertion on the testcase, which is PR9304 and rdar://9045501. llvm-svn: 126368
* turn down the logical bitwise confusion warning to not warn Chris Lattner2010-07-241-2/+1
| | | | | | | | | when the RHS of the ||/&& is ever 0 or 1. This handles a variety of creative idioms for "true" used in C programs and fixes many false positives at the expense of a few false negatives. This fixes rdar://8230351. llvm-svn: 109314
* Add a warning to catch a bug recently caught by code review, like this:Chris Lattner2010-07-131-1/+2
| | | | | | | | | | | t2.c:2:12: warning: use of logical && with constant operand; switch to bitwise & or remove constant [-Wlogical-bitwise-confusion] return x && 4; ^ ~ wording improvement suggestions are welcome. llvm-svn: 108260
* If a switch condition is constant, don't warn about missing enum cases.John McCall2010-05-181-1/+18
| | | | | | | | If a switch condition is constant, warn if there's no case for it. Constant switch conditions do come up in reasonable template code. llvm-svn: 104010
* 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
* Require a class type to be complete before probing its conversionDouglas Gregor2009-11-231-0/+7
| | | | | | | functions for a switch condition's conversion to integral or enumeration type. llvm-svn: 89656
* Implement conversion from a switch condition with class type to anDouglas Gregor2009-11-231-0/+20
| | | | | | integral or enumeration type (vi user-defined conversions). Fixes PR5518. llvm-svn: 89655
* Fix for PR5190, Credit to Zhanyong Wan.Edward O'Callaghan2009-10-171-0/+15
llvm-svn: 84346
OpenPOWER on IntegriCloud