History log of /external/clang/test/Sema/switch.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
176edba5311f6eff0cad2631449885ddf4fbc9ea 01-Dec-2014 Stephen Hines <srhines@google.com> Update aosp/master Clang for rebase to r222490.

Change-Id: Ic557ac55e97fbf6ee08771c7b7c3594777b0aefd
/external/clang/test/Sema/switch.c
651f13cea278ec967336033dd032faef0e9fc2ec 24-Apr-2014 Stephen Hines <srhines@google.com> Updated to Clang 3.5a.

Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
/external/clang/test/Sema/switch.c
7af7de7d6b121132dfe8c3b9b5febe2b37aafd62 30-May-2012 Richard Trieu <rtrieu@google.com> Add new -Wunique-enum which will warn on enums which all elements have the
same value and were initialized with literals. Clang will warn on code like
this:

enum A {
FIRST = 1,
SECOND = 1
};



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157666 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
3940ce83438e2332ba541f4e65e700fbefe0c7a8 16-May-2012 Douglas Gregor <dgregor@apple.com> Produce more useful 'duplicate case' diagnostics. Fixes PR9243, from Terry Long!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156904 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
54faba4f7f3f0e8f1376da1c459312596ad5486d 21-Mar-2012 Fariborz Jahanian <fjahanian@apple.com> For enums with no tag name, display its location in
the diagnostic instead of displaying ''.
// rdar://11082110


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153219 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
625bb569df0c34feec0d52c0ec5215f21ef2e054 14-Feb-2012 Dmitri Gribenko <gribozavr@gmail.com> Generalize -Wempty-body: warn when statement body is empty (closes: PR11329)

* if, switch, range-based for: warn if semicolon is on the same line.
* for, while: warn if semicolon is on the same line and either next
statement is compound statement or next statement has more
indentation.

Replacing the semicolon with {} or moving the semicolon to the next
line will always silence the warning.

Tests from SemaCXX/if-empty-body.cpp merged into SemaCXX/warn-empty-body.cpp.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150515 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
1a2b8e27135ec72f183dd4510612f6d5d7ee088a 08-Feb-2012 Ted Kremenek <kremenek@apple.com> Move -Wcovered-switch-default out of -Wswitch (and -Wall), and make it an opt-in warning.

This is a great warning, but it was observed that a ton of real world code violates
it all the time for (semi-)legitimate reasons. This warnings is fairly pedantic, which is good,
but not for everyone. For example, there is a fair amount of idiomatic code out there
that does "default: abort()", and similar idioms.

Addresses <rdar://problem/10814651>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150055 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
282e7e66748cc6dd14d6f7f2cb52e5373c531e61 04-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> In C++11 mode, when an integral constant expression is desired and we have a
value of class type, look for a unique conversion operator converting to
integral or unscoped enumeration type and use that. Implements [expr.const]p5.

Sema::VerifyIntegerConstantExpression now performs the conversion and returns
the converted result. Some important callers of Expr::isIntegralConstantExpr
have been switched over to using it (including all of those required for C++11
conformance); this switch brings a side-benefit of improved diagnostics and, in
several cases, simpler code. However, some language extensions and attributes
have not been moved across and will not perform implicit conversions on
constant expressions of literal class type where an ICE is required.

In passing, fix static_assert to perform a contextual conversion to bool on its
argument.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149776 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
2dd52e3815d040e340a5d953d838cd2268e25372 24-Jan-2012 David Blaikie <dblaikie@gmail.com> Reword/rename -Wswitch-unreachable-default.

Rewording the diagnostic to be more precise/correct: "default label in switch
which covers all enumeration values" and changed the switch to
-Wcovered-switch-default

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148783 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
e1d82deb6839bf972aa6301da40f06e8926f0af5 24-Jan-2012 David Blaikie <dblaikie@gmail.com> Improve -Wswitch-enum diagnostic message.

Changing wording to include the word "explicitly" (as in "enumeration value ...
not /explicitly/ handled by switch"), as suggested by Richard Smith.

Also, now that the diagnostic text differs between -Wswitch and -Wswitch-enum,
I've simplified the test cases a bit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148781 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
9366750a5a97c8aeae1df4898ea849b087865195 22-Jan-2012 David Blaikie <dblaikie@gmail.com> Fix -Wswitch to warn about out of bounds enum cases even when there's a default

For consistency with GCC & reasonable sanity. The FIXME suggests that the
original author was perhaps using the default check for some other purpose,
not realizing the more obvious limitation/false-negatives it creates, but this
doesn't seem to produce any regressions & fixes the included test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148649 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
31ceb61172bca7ebc3fb90e9125864c7a29c55c0 21-Jan-2012 David Blaikie <dblaikie@gmail.com> Add -Wswitch-enum-redundant-default.

This warning acts as the complement to the main -Wswitch-enum warning (which
warns whenever a switch over enum without a default doesn't cover all values of
the enum) & has been an an-doc coding convention in LLVM and Clang in my
experience. The purpose is to ensure there's never a "dead" default in a
switch-over-enum because this would hide future -Wswitch-enum errors.

The name warning has a separate flag name so it can be disabled but it's grouped
under -Wswitch-enum & is on-by-default because of this.

The existing violations of this rule in test cases have had the warning disabled
& I've added a specific test for the new behavior (many negative cases already
exist in the same test file - and none regressed - so I didn't add more).

Reviewed by Ted Kremenek ( http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120116/051690.html )

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148640 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
f48fdb0937e67f691393f9ffdf75653e5128ea13 09-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> C++11 constant expressions: Don't use CheckICE in C++11; instead, determine
whether an expression is a (core) constant expression as a side-effect of
evaluation. This takes us from accepting far too few expressions as ICEs to
accepting slightly too many -- fixes for the remaining cases are coming next.

The diagnostics produced when an expression is found to be non-constant are
currently quite poor (with generic wording but reasonable source locations),
and will be improved in subsequent commits.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146289 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
e24b575f06985336973bb721e198bd184bf7bdd3 14-Oct-2010 Douglas Gregor <dgregor@apple.com> Tweak the typo-correction implementation to determine corrections
solely based on the names it sees, rather than actual declarations it
gets. In essence, we determine the set of names that are "close
enough" to the typo'd name. Then, we perform name lookup for each of
those names, filtering out those that aren't actually visible, and
typo-correct from the remaining results.

Overall, there isn't much of a change in the behavior of typo
correction here. The only test-suite change comes from the fact that
we make good on our promise to require that the user type 3 characters
for each 1 character corrected.

The real intent behind this change is to set the stage for an
optimization to typo correction (so that we don't need to deserialize
all declarations in a translation unit) and future work in finding
missing qualification ("'vector' isn't in scope; did you mean
'std::vector'?). Plus, the code is cleaner this way.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116511 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
b7690b425845b636849f25074d64d30aad646473 24-Jul-2010 Chris Lattner <sabre@nondot.org> turn down the logical bitwise confusion warning to not warn
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109314 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
90a8f27f144233b53cac0c88a1595f7f05105b7e 13-Jul-2010 Chris Lattner <sabre@nondot.org> Add a warning to catch a bug recently caught by code review, like this:
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108260 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
6907fbe758d23e1aec4c0a67e7b633d1d855feb4 12-Jun-2010 John McCall <rjmccall@apple.com> When deciding whether an expression has the boolean nature, don't look through
explicit casts. Fixes PR7359.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105871 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
0fb97083cc0f8a82e404e22991ae80d2216e71d5 18-May-2010 John McCall <rjmccall@apple.com> If a switch condition is constant, don't warn about missing enum cases.
If a switch condition is constant, warn if there's no case for it.

Constant switch conditions do come up in reasonable template code.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104010 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
f9f627dbbc62fbf51b906c24c783b4249dc7e9bb 01-Mar-2010 Douglas Gregor <dgregor@apple.com> Don't warn about case-value conversions from a negative value to a
larger unsigned value, since this is implementation-defined
behavior. (We previously suppressed this warning when converting from
a signed value to an unsigned value of the same size).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97430 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
2853eac24e2e70a74d7da817653b0528b976039f 18-Feb-2010 Douglas Gregor <dgregor@apple.com> Don't diagnose overflow in case statements when the conversion is a
signed<->unsigned conversion with the same bit width. Fixes
<rdar://problem/7658121>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96545 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
30ab37122300a5f6664b8ae2d0b43b4396eb6bcb 18-Feb-2010 Douglas Gregor <dgregor@apple.com> For -Wswitch-enum warnings, be sure to look through typedefs of enum
types. Fixes <rdar://problem/7643909>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96531 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
ba915af51ced751c46e7c2b9c6f3b59d2e668825 08-Feb-2010 Douglas Gregor <dgregor@apple.com> Warn when cases are missing from a switch on a value of enumeration
type (-Wswitch), from Michal!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95592 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
539c5c34063066753f27bb0f39fdcde1acc06328 07-Jan-2010 Douglas Gregor <dgregor@apple.com> Fix the search for visible declarations within a Scope to ensure that
we look into a Scope that corresponds to a compound statement whose
scope was combined with the scope of the function that owns it. This
improves typo correction in many common cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92879 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
a5728872c7702ddd09537c95bc3cbd20e1f2fb09 15-Dec-2009 Daniel Dunbar <daniel@zuster.org> Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- 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
/external/clang/test/Sema/switch.c
be724bab2ba7ad47aebced25e7c8ec551eb72d28 25-Nov-2009 Douglas Gregor <dgregor@apple.com> When the condition of a switch() statement is semantically invalid,
still parse the body of the switch to try to avoid spurious
diagnostics. Fixes PR5606.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89847 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
5f04881eb025f61396d0555d8173730fe2759e0a 16-Oct-2009 Chris Lattner <sabre@nondot.org> Implement PR4407 - missing warnings on case value overflow,
patch by Zhanyong Wan!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84259 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
d7d5f0223bd30dfd618762349c6209dd1d5ea3e6 24-Mar-2009 Daniel Dunbar <daniel@zuster.org> Rename clang to clang-cc.

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
/external/clang/test/Sema/switch.c
d3a61d5ec5357d19b7c0b6b599231e68dc5e237f 01-Dec-2008 Anders Carlsson <andersca@mac.com> Use VerifyIntegerConstantExpression for case values.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60317 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
5f4a6829dc58cab2f76e2b98492859aa3b91e3f2 24-Nov-2008 Chris Lattner <sabre@nondot.org> Make all the 'redefinition' diagnostics more consistent, and make the
"previously defined here" diagnostics all notes.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59920 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
6dde0d5dc09f45f4d9508c964703e36fef1a0198 22-Nov-2008 Anders Carlsson <andersca@mac.com> Case values must be evaluated

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59884 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
51fe996231b1d7199f76e4005ff4c943d5deeecd 22-Nov-2008 Anders Carlsson <andersca@mac.com> Use Expr::Evaluate for case statements. Fixes PR2525

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59881 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
3b427b3ba518f7a7293458c2d3d92eebd8458d87 11-Oct-2007 Chris Lattner <sabre@nondot.org> rename -parse-ast-print to -ast-print
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
/external/clang/test/Sema/switch.c
9f3d942e9970bc8f51add390b2a2c46b5a2ab747 26-Sep-2007 Ted Kremenek <kremenek@apple.com> Removed option "-parse-ast-check" from clang driver. This is now implemented
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
/external/clang/test/Sema/switch.c
0471f5bc8191e39cdb61fabcaf1870e2af2d42e8 23-Aug-2007 Chris Lattner <sabre@nondot.org> finish off switch case overlap checking, adding support for
verifying case ranges.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41331 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
6efc4d3659632ddcea4a58cb62e9ee54ca4a373e 23-Aug-2007 Chris Lattner <sabre@nondot.org> detect and diagnose empty case ranges:

switch.c:16:8: warning: empty case range specified
case 100 ... 99: ; // expected-warning {{empty case range}}
^~~~~~~~~~



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41328 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
f334850cd2fc2d4ac9b585f80d97b4f0097a0348 23-Aug-2007 Chris Lattner <sabre@nondot.org> fix a segfault in cases where there are no cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41317 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
b2ec9d6fede9cccc170a202de7bf7f523dea8be4 23-Aug-2007 Chris Lattner <sabre@nondot.org> report duplicate case values. TODO: report duplicate/overlapping ranges.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41315 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
f4021e7d5228a2be5a380269dffa0331a6c78b95 23-Aug-2007 Chris Lattner <sabre@nondot.org> start checking case values of switch stmts more closely. Emit overflow
warnings when converting case values to the expression type.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41313 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c
8a87e57beb96212ee61dc08a5f691cd7f7710703 23-Jul-2007 Chris Lattner <sabre@nondot.org> correctly verify that default and case are in a switchstmt,
this fixes test/Sema/switch.c.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40438 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Sema/switch.c