summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/unreachable-code.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Revert "[Analysis] -Wunreachable-code shouldn't fire on the increment of a ↵Sam McCall2019-02-151-5/+0
| | | | | | | | foreach loop" This reverts commit r354102. llvm-svn: 354109
* [Analysis] -Wunreachable-code shouldn't fire on the increment of a foreach loopSam McCall2019-02-151-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The idea is that the code here isn't written, so doesn't indicate a bug. Similar to code expanded from macros. This means the warning no longer fires on this code: for (auto C : collection) { process(C); return; } handleEmptyCollection(); Unclear whether this is more often a bug or not in practice, I think it's a reasonable idiom in some cases. Either way, if we want to warn on "loop that doesn't loop", I think it should be a separate warning, and catch `while(1) break;` Reviewers: ilya-biryukov, ioeric Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58134 llvm-svn: 354102
* [-Wunreachable-code] add a specialized diagnostic for unreachable increment ↵Ted Kremenek2014-03-211-2/+2
| | | | | | expressions of loops. llvm-svn: 204430
* Start breaking -Wunreachable-code up into different diagnostic groups.Ted Kremenek2014-03-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recent work on -Wunreachable-code has focused on suppressing uninteresting unreachable code that center around "configuration values", but there are still some set of cases that are sometimes interesting or uninteresting depending on the codebase. For example, a dead "break" statement may not be interesting for a particular codebase, potentially because it is auto-generated or simply because code is written defensively. To address these workflow differences, -Wunreachable-code is now broken into several diagnostic groups: -Wunreachable-code: intended to be a reasonable "default" for most users. and then other groups that turn on more aggressive checking: -Wunreachable-code-break: warn about dead break statements -Wunreachable-code-trivial-return: warn about dead return statements that return "trivial" values (e.g., return 0). Other return statements that return non-trivial values are still reported under -Wunreachable-code (this is an area subject to more refinement). -Wunreachable-code-aggressive: supergroup that enables all these groups. The goal is to eventually make -Wunreachable-code good enough to either be in -Wall or on-by-default, thus finessing these warnings into different groups helps achieve maximum signal for more users. TODO: the tests need to be updated to reflect this extra control via diagnostic flags. llvm-svn: 203994
* [-Wunreachable-code] Handle idiomatic do...while() with an uninteresting ↵Ted Kremenek2014-03-061-2/+14
| | | | | | | | | | condition. Sometimes do..while() is used to create a scope that can be left early. In such cases, the unreachable 'while()' test is not usually interesting unless it actually does something that is observable. llvm-svn: 203051
* Add -fcxx-exceptions to all tests that use C++ exceptions.Anders Carlsson2011-02-281-1/+1
| | | | llvm-svn: 126599
* Pass -fexceptions to all tests that use try/catch/throw.Anders Carlsson2011-02-191-1/+1
| | | | llvm-svn: 126037
* Explicitly handle CXXExprWithTemporaries during CFG construction by just ↵Ted Kremenek2010-08-281-0/+17
| | | | | | visiting the subexpression. While we don't do anything intelligent right now, this obviates a bogus -Wunreahable-code warning reported in PR 6130. llvm-svn: 112334
* Add an unreachable code checker.Mike Stump2010-01-131-0/+41
llvm-svn: 93287
OpenPOWER on IntegriCloud