summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [clang-tidy] Disable Checks on If constexpr statements in template ↵Nathan2020-01-231-1/+4
| | | | | | | | | | | | | | | | | | Instantiations for BugproneBranchClone and ReadabilityBracesAroundStatements Summary: fixes [[ https://bugs.llvm.org/show_bug.cgi?id=32203 | readability-braces-around-statements broken for if constexpr]] and [[ https://bugs.llvm.org/show_bug.cgi?id=44229 | bugprone-branch-clone false positive with template functions and constexpr ]] by disabling the relevant checks on if constexpr statements while inside an instantiated template. This is due to how the else branch of an if constexpr statement is folded away to a null statement if the condition evaluates to false Reviewers: alexfh, hokein, aaron.ballman, xazax.hun Reviewed By: aaron.ballman, xazax.hun Subscribers: rnkovacs, JonasToth, Jim, lebedev.ri, xazax.hun, cfe-commits Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D71980 (cherry picked from commit f9c46229e4ac29053747c96e08c574c6c48d544b)
* 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
* Port getLocEnd -> getEndLocStephen Kelly2018-08-091-2/+2
| | | | | | | | Subscribers: nemanjai, ioeric, kbarton, cfe-commits Differential Revision: https://reviews.llvm.org/D50355 llvm-svn: 339401
* Port getLocStart -> getBeginLocStephen Kelly2018-08-091-2/+2
| | | | | | | | | | Reviewers: javed.absar Subscribers: nemanjai, kbarton, ilya-biryukov, ioeric, jkorous, arphaman, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D50354 llvm-svn: 339400
* (no commit message)Florian Gross2017-05-251-1/+1
| | | | llvm-svn: 303849
* [clang-tidy] readability-braces-around-statements false positive with char ↵Alexander Kornienko2017-05-221-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | literals Summary: Single-line if statements cause a false positive when the last token in the conditional statement is a char constant: ``` if (condition) return 'a'; ``` For some reason `findEndLocation` seems to skips too many (vertical) whitespaces in this case. The same problem already occured with string literals (https://reviews.llvm.org/D25558), and was fixed by adding a special check for this very case. I just extended the condition to also include char constants. No idea what really causes the issue though. Reviewers: alexfh Reviewed By: alexfh Subscribers: xazax.hun, cfe-commits Patch by Florian Gross! Differential Revision: https://reviews.llvm.org/D33354 llvm-svn: 303551
* [clang-tidy] Minor cleanup + a disabled test case for PR26228. NFCAlexander Kornienko2017-05-091-5/+5
| | | | llvm-svn: 302522
* [clang-tools-extra] Format sources with clang-format. NFC.Mandeep Singh Grang2016-11-081-4/+4
| | | | | | | | | | | | | | | | Summary: Ran clang-format on all .c/.cpp/.h files in clang-tools-extra. Excluded the test, unittests, clang-reorder-fields, include-fixer, modularize and pptrace directories. Reviewers: klimek, alexfh Subscribers: nemanjai Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D26329 llvm-svn: 286221
* [clang-tidy] Fix readability-braces-around-statements false positiveMarek Kurdej2016-10-141-1/+1
| | | | | | | | | | | | | | | | | Summary: This fixes a false-positive e.g. when string literals are returned from if statement. This patch includes as well a small fix to includes and renames of the test suite that collided with the name of the check. Reviewers: alexfh, hokein Subscribers: hokein Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D25558 llvm-svn: 284212
* [clang-tidy] Fix an assert failure of ForStmt in ↵Haojian Wu2016-02-161-2/+2
| | | | | | | | | | | | `readability-braces-around-statements` check. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D17134 llvm-svn: 260952
* [clang-tidy] Fix an assert failure in 'readability-braces-around-statements' ↵Haojian Wu2016-02-111-1/+4
| | | | | | | | | | | | | | | | | | check. Summary: The check will trigger a assert failure("CondEndLoc.isValid") when checking the IfStmt whose condition expression is not parsed. In this case, we should ignore that. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D17069 llvm-svn: 260505
* [clang-tidy] Don't use diag() for debug outputAlexander Kornienko2015-12-161-11/+3
| | | | llvm-svn: 255765
* [clang-tidy] Fix an assertion in the readability-braces-around-statements check.Alexander Kornienko2015-09-301-0/+10
| | | | llvm-svn: 248895
* Refactors AST matching code to use the new AST matcher names. This patch ↵Aaron Ballman2015-09-171-1/+1
| | | | | | correlates to r247885 which performs the AST matcher rename in Clang. llvm-svn: 247886
* [clang-tidy] Fix PR22785.Alexander Kornienko2015-09-091-5/+10
| | | | | | | | | | | Fix http://llvm.org/PR22785. Bug 22785 - readability-braces-around-statements doesn't work well with macros. http://reviews.llvm.org/D12729 Patch by Marek Kurdej! llvm-svn: 247163
* [clang-tidy] Force braces around leaf 'else if' for consistency.Samuel Benzaquen2015-06-041-3/+11
| | | | | | | | | | | | | | Summary: Force braces around leaf 'else if' for consistency. This complements r233697. Reviewers: alexfh Subscribers: curdeius, cfe-commits Differential Revision: http://reviews.llvm.org/D10245 llvm-svn: 239054
* Force braces on the else branch if they are being added to the if branch.Samuel Benzaquen2015-03-311-10/+12
| | | | | | | | | | | | | | Summary: Force braces on the else branch if they are being added to the if branch. This ensures consistency in the transformed code. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D8708 llvm-svn: 233697
* [clang-tidy] Move some of the misc checks to readability/Alexander Kornienko2014-10-151-0/+257
Summary: Some of the misc checks belong to readability/. I'm moving them there without changing check names for now. As the next step, I want to register some of these checks in the google and llvm modules with suitable settings (e.g. BracesAroundStatementsCheck). I'm not sure if we want to create a "readability" module, probably not. Reviewers: djasper Reviewed By: djasper Subscribers: curdeius, cfe-commits Differential Revision: http://reviews.llvm.org/D5792 llvm-svn: 219786
OpenPOWER on IntegriCloud