summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/switch-implicit-fallthrough.cpp
Commit message (Collapse)AuthorAgeFilesLines
* P0188R1: add support for standard [[fallthrough]] attribute. This is almostRichard Smith2016-03-081-4/+18
| | | | | | | | | | | | | | exactly the same as clang's existing [[clang::fallthrough]] attribute, which has been updated to have the same semantics. The one significant difference is that [[fallthrough]] is ill-formed if it's not used immediately before a switch label (even when -Wimplicit-fallthrough is disabled). To support that, we now build a CFG of any function that uses a '[[fallthrough]];' statement to check. In passing, fix some bugs with our support for statement attributes -- in particular, diagnose their use on declarations, rather than asserting. llvm-svn: 262881
* Revert r234786, it contained a bunch of stuff I did not mean to commit.Nico Weber2015-04-131-5/+1
| | | | llvm-svn: 234787
* Revert r234613 (and follow-ups 234614, 234616, 234618), it caused PR23216.Nico Weber2015-04-131-1/+5
| | | | llvm-svn: 234786
* Fix "warning: fallthrough annotation does not directly precede switch label" ↵Alexander Kornienko2014-06-241-19/+41
| | | | | | | | | | | | | | | | in lambdas. Summary: This patch fixes http://llvm.org/PR17864 - "warning: fallthrough annotation does not directly precede switch label" in lambdas. Reviewers: rsmith Reviewed By: rsmith Subscribers: rnk, cfe-commits Differential Revision: http://reviews.llvm.org/D4258 llvm-svn: 211599
* As of r202325, CFGBlock predecessors may be NULL. Ignore such preds. Fixes a ↵Nick Lewycky2014-02-271-0/+13
| | | | | | crasher, PR18983. llvm-svn: 202340
* Moved fallthrough regression test to switch-implicit-fallthrough.cpp.Alexander Kornienko2013-04-021-0/+18
| | | | llvm-svn: 178554
* -Wimplicit-fallthrough: fixed two cases where "fallthrough annotation in ↵Alexander Kornienko2013-02-071-11/+29
| | | | | | | | | | | | | | | | | | | | | | unreachable code" was issued incorrectly. Summary: -Wimplicit-fallthrough: fixed two cases where "fallthrough annotation in unreachable code" was issued incorrectly: 1. In actual unreachable code, but not immediately on a fall-through execution path "fallthrough annotation does not directly precede switch label" is better; 2. After default: in a switch with covered enum cases. Actually, these shouldn't be treated as unreachable code for our purpose. Reviewers: rsmith Reviewed By: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D374 llvm-svn: 174575
* Fixed segmentation fault when a CFGBlock has NULL successor.Alexander Kornienko2013-02-011-0/+5
| | | | llvm-svn: 174182
* Don't warn on fall-through from unreachable code.Alexander Kornienko2013-01-301-7/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: A motivating example: class ClassWithDtor { public: ~ClassWithDtor() {} }; void fallthrough3(int n) { switch (n) { case 2: do { ClassWithDtor temp; return; } while (0); // This generates a chain of unreachable CFG blocks. case 3: break; } } Reviewers: rsmith, doug.gregor, alexfh Reviewed By: alexfh CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D330 llvm-svn: 173889
* Silence unintended fallthrough diagnostic on a case label preceded with a ↵Alexander Kornienko2013-01-251-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | normal label. Summary: It's unlikely that a fallthrough is unintended in the following code: switch (n) { ... label: case 1: ... goto label; ... } Reviewers: rsmith, doug.gregor Reviewed By: doug.gregor CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D329 llvm-svn: 173486
* Don't suggest to insert [[clang::fallthrough]] before empty cases. Fix for ↵Alexander Kornienko2013-01-251-0/+2
| | | | | | multiple case labels. llvm-svn: 173458
* Added test with sizeof conditions (relies on to-be-implemented functionality ↵Alexander Kornienko2012-06-201-0/+18
| | | | | | of CFG, discussion: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120507/057370.html) llvm-svn: 158854
* Don't offer '[[clang::fallthrough]];' fix-it when a fall-through occurs to aAlexander Kornienko2012-05-261-0/+2
| | | | | | switch label immediately followed by a 'break;'. llvm-svn: 157508
* Add -Wimplicit-fallthrough warning flag, which warns on fallthrough betweenRichard Smith2012-05-031-0/+177
cases in switch statements. Also add a [[clang::fallthrough]] attribute, which can be used to suppress the warning in the case of intentional fallthrough. Patch by Alexander Kornienko! The handling of C++11 attribute namespaces in this patch is temporary, and will be replaced with a cleaner mechanism in a subsequent patch. llvm-svn: 156086
OpenPOWER on IntegriCloud