summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/readability/ElseAfterReturnCheck.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [clang-tidy] Fixed crash 44745 in readability-else-after-returnNathan James2020-02-031-0/+4
| | | | | | | | | | | | | | | | Summary: Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=44745 | readability-else-after-return crashes ]] Reviewers: aaron.ballman, alexfh, hokein, JonasToth, gribozavr2 Reviewed By: alexfh Subscribers: merge_guards_bot, xazax.hun, cfe-commits Tags: #clang, #clang-tools-extra Differential Revision: https://reviews.llvm.org/D73841 (cherry picked from commit d591bdce6d623208d4aeb335a762d839f0f8f0f7)
* Handle init statements in readability-else-after-returnNathan James2020-01-021-28/+210
| | | | | | | | | | Adds a new ASTMatcher condition called 'hasInitStatement()' that matches if, switch and range-for statements with an initializer. Reworked clang-tidy readability-else-after-return to handle variables in the if condition or init statements in c++17 ifs. Also checks if removing the else would affect object lifetimes in the else branch. Fixes PR44364.
* [clang-tidy] Work around http://llvm.org/PR40392Alexander Kornienko2019-01-211-4/+10
| | | | | | | | | The readability-else-after-return check should be smarter about cases where the variable defined in the condition is used in the `else` branch. This patch makes it just ignore such cases, but alternative solutions may be better (added a FIXME). llvm-svn: 351751
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Convert two more files that were using Windows line endings and removeChandler Carruth2019-01-191-58/+58
| | | | | | | a stray single '\r' from one file. These are the last line ending issues I can find in the files containing parts of LLVM's file headers. llvm-svn: 351634
* [clang-tidy] Resolve readability-else-after-return false positive for ↵Marek Kurdej2018-10-191-57/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | constexpr if. Summary: It fixes the false positive when using constexpr if and where else cannot be removed: Example: ``` if constexpr (sizeof(int) > 4) // ... return /* ... */; else // This else cannot be removed. // ... return /* ... */; ``` Reviewers: alexfh, aaron.ballman Reviewed By: aaron.ballman Subscribers: lebedev.ri, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D53372 llvm-svn: 344785
* [clang-tidy] Ignore ExprWithCleanups when looking for else-after-throwMalcolm Parsons2017-11-281-1/+2
| | | | | | | | | | | | | | | | | Summary: The readability-else-after-return check was not warning about an else after a throw of an exception that had arguments that needed to be cleaned up. Reviewers: aaron.ballman, alexfh, djasper Reviewed By: aaron.ballman Subscribers: lebedev.ri, klimek, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D40505 llvm-svn: 319174
* [clang-tidy] Fixed readability-else-after-return for cascade statementsMalcolm Parsons2016-11-041-1/+1
| | | | | | | | | | | | | | | | | | Summary: Fix generated by this check changed program semantics in the case where 'if' was a part (direct child) of other statement. Fixes PR30652. Patch by Paweł Żukowski. Reviewers: malcolm.parsons, alexfh, djasper Subscribers: mgehre, omtcyfz, cfe-commits Differential Revision: https://reviews.llvm.org/D26125 llvm-svn: 285999
* [clang-tidy] enhance readability-else-after-returnKirill Bobyrev2016-08-101-7/+16
| | | | | | | | | | | | `readability-else-after-return` only warns about `return` calls, but LLVM Coding Standars stat that `throw`, `continue`, `goto`, etc after `return` calls are bad, too. Reviwers: alexfh, aaron.ballman Differential Revision: https://reviews.llvm.org/D23265 llvm-svn: 278257
* [clang-tidy] Refactoring of FixHintUtilsEtienne Bergeron2016-05-111-6/+4
| | | | | | | | | | | | | | Summary: Refactor some checkers to use the tooling re-writing API. see: http://reviews.llvm.org/D19941 Reviewers: klimek, alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19807 llvm-svn: 269210
* clang-tidy: [readability-else-after-return] Fix false positive. ThisDaniel Jasper2015-04-271-3/+5
| | | | | | | might be a little too strict now, but better be too strict than do the wrong thing. llvm-svn: 235932
* [clang-tidy] Refactor: Move readability checks to namespace ↵Alexander Kornienko2015-03-021-1/+2
| | | | | | | | | | | | | clang::tidy::readability clang-tidy checks are organized into modules. This refactoring moves the readability module checks into the namespace clang::tidy::readability http://reviews.llvm.org/D7997 Patch by Richard Thomson! llvm-svn: 230946
* clang-tidy: Add initial check for "Don't use else after return".Daniel Jasper2015-01-141-0/+46
As per the LLVM coding standards: http://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return Initial version, probably still quite a bit to do until this is really useful. Review: http://reviews.llvm.org/D6927 llvm-svn: 226025
OpenPOWER on IntegriCloud