summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/switch-implicit-fallthrough.cpp
Commit message (Collapse)AuthorAgeFilesLines
* -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