summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/readability
Commit message (Collapse)AuthorAgeFilesLines
...
* [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] Make readability-container-size-empty work with inline ↵Gabor Horvath2016-02-091-18/+21
| | | | | | namespaces. Fix PR25812. llvm-svn: 260217
* [clang-tidy] Replace a custom ASTMatcher with a built-in one.Gabor Horvath2016-02-091-4/+2
| | | | llvm-svn: 260212
* Reverting r260096; it causes build bot failures:Aaron Ballman2016-02-082-138/+162
| | | | | | | http://bb.pgr.jp/builders/cmake-clang-tools-x86_64-linux/builds/23351 http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/492 llvm-svn: 260097
* Expand the simplify boolean expression check to handle implicit conversion ↵Aaron Ballman2016-02-082-162/+138
| | | | | | | | | | | | of integral types to bool and improve the handling of implicit conversion of member pointers to bool. Implicit conversion of member pointers are replaced with explicit comparisons to nullptr. Implicit conversions of integral types are replaced with explicit comparisons to 0. Patch by Richard Thomson. llvm-svn: 260096
* Sort checks alphabetically in ReadabilityTidyModule.cpp.Eugene Zelenko2016-02-011-4/+4
| | | | llvm-svn: 259393
* Add a new check, readability-redundant-control-flow, that check for some ↵Aaron Ballman2016-02-014-0/+154
| | | | | | | | forms of redundant control flow statements. Currently checks for return statements at the end of a function with a void return type and continue statements at the end of looping statements. Patch by Richard Thomson. llvm-svn: 259362
* Remove autoconf supportChris Bieneman2016-01-261-12/+0
| | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "Now I am become Death, the destroyer of worlds." -J. Robert Oppenheimer Reviewers: chandlerc, grosbach, bob.wilson, echristo Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D16475 llvm-svn: 258864
* Test commit. Fix typo in comment.Jonathan Coe2016-01-261-1/+1
| | | | llvm-svn: 258835
* [clang-tidy] Use proper capitalization and punctuation for diagnostic messages.Alexander Kornienko2016-01-081-1/+1
| | | | | | Use diagnostic parameters where possible instead of string concatenation. llvm-svn: 257176
* [clang-tidy] Fix a use-after-free bug found by asanAlexander Kornienko2015-12-291-2/+3
| | | | llvm-svn: 256562
* [clang-tidy] Fix a false positive case in ContainerSizeEmpty check.Gabor Horvath2015-12-281-4/+9
| | | | llvm-svn: 256504
* [clang-tidy] Preserve comments and preprocessor directives when simplifying ↵Alexander Kornienko2015-12-282-39/+72
| | | | | | | | | | | | | | | | | | boolean expressions This changeset still emits the diagnostic that the expression could be simplified, but it doesn't generate any fix-its that would lose comments or preprocessor directives within the text that would be replaced. Fixes PR25842 Reviewers: alexfh Subscribers: xazax.hun, cfe-commits Patch by Richard Thomson! (+a naming style fix) Differential Revision: http://reviews.llvm.org/D15737 llvm-svn: 256492
* Fix a false positive case in ContainerSizeEmpty check (PR25893).Gabor Horvath2015-12-211-0/+5
| | | | llvm-svn: 256142
* [clang-tidy] google-readability-namespace-comments: ignore stray semicolonsAlexander Kornienko2015-12-161-1/+2
| | | | llvm-svn: 255772
* [clang-tidy] Don't use diag() for debug outputAlexander Kornienko2015-12-161-11/+3
| | | | llvm-svn: 255765
* [clang-tidy] Fix PR25812.Gabor Horvath2015-12-121-25/+26
| | | | llvm-svn: 255431
* clang-tidy readability identifiers: better diagnostic locationMike Aizatsky2015-12-041-1/+1
| | | | | | | | | | | | Summary: With this change the error reported is on the identifier location itself. It was declaration location before. Reviewers: alexfh Differential Revision: http://reviews.llvm.org/D15203 llvm-svn: 254766
* [clang-tidy] Fix message style (capitalization, trailing period).Alexander Kornienko2015-11-091-3/+2
| | | | llvm-svn: 252471
* [clang-tidy] readability-named-parameter: don't complain about implicit ↵Alexander Kornienko2015-11-061-0/+2
| | | | | | | | parameters Fixes http://llvm.org/PR24464. llvm-svn: 252248
* Drop dead return after llvm_unreachable. NFC.Benjamin Kramer2015-10-261-1/+0
| | | | llvm-svn: 251279
* assert(false) -> llvm_unreachable.Benjamin Kramer2015-10-251-1/+1
| | | | llvm-svn: 251265
* [clang-tidy] Add return value for non-assert builds.Daniel Jasper2015-10-251-0/+1
| | | | llvm-svn: 251262
* [clang-tidy] Add check readability-implicit-bool-castPiotr Dziwinski2015-10-254-0/+476
| | | | | | | | | | | | | | | | | | | | | Summary: This is another check that I ported to clang-tidy from colobot-lint tool. As previously discussed on cfe-dev mailing list, this is one of those checks that I think is general and useful enough for contribution to clang-tidy. This patch contains implementation of check taken from colobot-lint, but it is extended a great deal, including FixIt hints for automated refactoring, exhaustive testcases, and user documentation. Reviewers: sbenza, aaron.ballman, alexfh Subscribers: Eugene.Zelenko Differential Revision: http://reviews.llvm.org/D13635 llvm-svn: 251235
* Test commitPiotr Dziwinski2015-10-241-2/+2
| | | | llvm-svn: 251204
* Added check uniqueptr-delete-release to replace "delete x.release()" with "x ↵Samuel Benzaquen2015-10-194-0/+108
| | | | | | | | | | = nullptr" Reviewers: alexfh Differential Revision: http://reviews.llvm.org/D13179 llvm-svn: 250742
* Make a bunch of static arrays const.Craig Topper2015-10-181-1/+1
| | | | llvm-svn: 250641
* [clang-tidy] Implement FixitHints for identifier references in ↵Alexander Kornienko2015-10-011-14/+116
| | | | | | | | | | | | | | IdentifierNamingCheck This diff requires http://reviews.llvm.org/D13079 to be applied first. I wasn't sure about how to make patch series in Phabricator, and I wanted to keep the two separate for clarity. It looks like that most cases can be supported with this patch. I'm not totally sure about the actual coverage though. I think that the matchers are very generic, but I'm still not totally fluent with the AST. Patch by Beren Minor! Differential revision: http://reviews.llvm.org/D13081 llvm-svn: 248996
* [clang-tidy] Fix an assertion in the readability-braces-around-statements check.Alexander Kornienko2015-09-301-0/+10
| | | | llvm-svn: 248895
* [clang-tidy] Code factorization and cleanup in IdentifierNamingCheckAlexander Kornienko2015-09-282-38/+49
| | | | | | | | | | | | | | | This is to level the ground a little bit, in preparation for the changes in http://reviews.llvm.org/D13081. Code factorization replaces all insertions to NamingCheckFailures map with a unique addUsage function that does the job. There is also no more difference between the declaration and the references to a given identifier, both cases are treated as ranges in the Usage vector. There is also a check to avoid duplicated ranges to be inserted, which sometimes triggered erroneous replacements. References can now also be added before the declaration of the identifier is actually found; this looks to be the case for example when a templated class uses its parameters to specialize its templated base class. Patch by Beren Minor! Differential revision: http://reviews.llvm.org/D13079 llvm-svn: 248700
* Pass SourceLocation by value instead of by const reference since its just a ↵Craig Topper2015-09-211-1/+1
| | | | | | 32-bit integer. NFC llvm-svn: 248139
* Refactors AST matching code to use the new AST matcher names. This patch ↵Aaron Ballman2015-09-176-54/+63
| | | | | | correlates to r247885 which performs the AST matcher rename in Clang. llvm-svn: 247886
* [clang-tidy] Add inconsistent declaration parameter name checkAlexander Kornienko2015-09-104-0/+385
| | | | | | | | | | | | | | | | | | | | This is first of series of patches, porting code from my project colobot-lint, as I mentioned recently in cfe-dev mailing list. This patch adds a new check in readability module: readability-inconsistent-declaration-parameter-name. I also added appropriate testcases and documentation. I chose readability module, as it seems it is the best place for it. I think I followed the rules of LLVM coding guideline, but I may have missed something, as I usually use other code formatting style. http://reviews.llvm.org/D12462 Patch by Piotr Dziwinski! llvm-svn: 247261
* [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
* Disable clang-tidy readability checkers when not compiling in C++ mode. None ↵Aaron Ballman2015-09-024-1/+19
| | | | | | of the checkers require additional testing as the tests will not compile for other languages or modes, or the checkers would never match a valid construct. llvm-svn: 246661
* [clang-tidy] Move misc-use-override and readability-shrink-to-fit to ↵Alexander Kornienko2015-08-314-145/+0
| | | | | | | | | "modernize/" These checks are focusing on migrating the code from C++98/03 to C++11, so they belong to the modernize module. llvm-svn: 246437
* [clang-tidy] Update docs for clang-tidy checks. NFCAlexander Kornienko2015-08-2711-75/+118
| | | | | | | | | | | Changes mostly address formatting and unification of the style. Use MarkDown style for inline code snippets and lists. Added some text for a few checks. The idea is to move most of the documentation out to separate rST files and have implementation files refer to the corresponding documentation files. llvm-svn: 246169
* [clang-tidy] Add new IdentifierNaming checkAlexander Kornienko2015-08-194-0/+664
| | | | | | | | | | | | | | | | | | | | This check will try to enforce coding guidelines on the identifiers naming. It supports lower_case, UPPER_CASE, camelBack and CamelCase casing and tries to convert from one to another if a mismatch is detected. It also supports a fixed prefix and suffix that will be prepended or appended to the identifiers, regardless of the casing. Many configuration options are available, in order to be able to create different rules for different kind of identifier. In general, the rules are falling back to a more generic rule if the specific case is not configured. http://reviews.llvm.org/D10933 Patch by Beren Minor! llvm-svn: 245429
* [clang-tidy] Enhance clang-tidy readability-simplify-boolean-expr...Alexander Kornienko2015-07-012-29/+276
| | | | | | | | | | | | | | | | | | | | Enhance clang-tidy readability-simplify-boolean-expr to handle 'if (e) return true; return false;' and improve replacement expressions. This changeset extends the simplify boolean expression check in clang-tidy to simplify if (e) return true; return false; to return e; (note the lack of an else clause on the if statement.) By default, chained conditional assignment is left unchanged, unless a configuration parameter is set to non-zero to override this behavior. It also improves the handling of replacement expressions to apply static_cast<bool>(expr) when expr is not of type bool. http://reviews.llvm.org/D9810 Patch by Richard Thomson! llvm-svn: 241155
* [clang-tidy] Move user-defined matches to unnamed namespaces to prevent ODR ↵Alexander Kornienko2015-06-172-10/+6
| | | | | | violations. llvm-svn: 239904
* [clang-tidy] Force braces around leaf 'else if' for consistency.Samuel Benzaquen2015-06-042-5/+14
| | | | | | | | | | | | | | 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
* [clang-tidy] Enhance clang-tidy readability-simplify-boolean-expr check...Alexander Kornienko2015-05-172-16/+55
| | | | | | | | | | | | | | | | Enhance clang-tidy readability-simplify-boolean-expr check to handle chained conditional assignment and chained conditional return. Based on feedback from applying this tool to the clang/LLVM codebase, this changeset improves the readability-simplify-boolean-expr check so that conditional assignment or return statements at the end of a chain of if/else if statements are left unchanged unless a configuration option is supplied. http://reviews.llvm.org/D8996 Patch by Richard Thomson! llvm-svn: 237541
* 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] Remove static StringSet in favor of binary search.Benjamin Kramer2015-04-172-37/+29
| | | | | | | | The number of strings is so small that performance doesn't matter and adding the thread safe static initialization and destruction overhead is just not worth it. No functional change intended. llvm-svn: 235192
* [clang-tidy] Add readability-simplify-boolean-expr check to clang-tidyAlexander Kornienko2015-04-104-1/+482
| | | | | | | | | | | | | | | | | | | | | | | | | | | This check looks for comparisons between boolean expressions and boolean constants and simplifies them to just use the appropriate boolean expression directly. if (b == true) becomes if (b) if (b == false) becomes if (!b) if (b && true) becomes if (b) if (b && false) becomes if (false) if (b || true) becomes if (true) if (b || false) becomes if (b) e ? true : false becomes e e ? false : true becomes !e if (true) t(); else f(); becomes t(); if (false) t(); else f(); becomes f(); if (e) return true; else return false; becomes return (e); if (e) return false; else return true; becomes return !(e); if (e) b = true; else b = false; becomes b = e; if (e) b = false; else b = true; becomes b = !(e); http://reviews.llvm.org/D7648 Patch by Richard Thomson! llvm-svn: 234626
* [clang-tidy] Fix for http://llvm.org/PR23130Alexander Kornienko2015-04-081-3/+3
| | | | | | | NamespaceCommentCheck: Don't remove the token placed immediately after the namespace closing brace. llvm-svn: 234403
* Force braces on the else branch if they are being added to the if branch.Samuel Benzaquen2015-03-312-12/+15
| | | | | | | | | | | | | | 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
* Make helpers static. clang-tools edition.Benjamin Kramer2015-03-231-3/+4
| | | | | | Also purge dead code found by it. NFC. llvm-svn: 232948
* [clang-tidy] Move google-readability-function check to ↵Alexander Kornienko2015-03-164-0/+170
| | | | | | | | | | | | | | | | readability-named-parameter. Summary: The relevant style rule is going to be removed, thus the check is no longer needed in the Google module. Leaving the check in readability/ in case someone needs it. Reviewers: djasper Reviewed By: djasper Subscribers: curdeius, cfe-commits Differential Revision: http://reviews.llvm.org/D8261 llvm-svn: 232431
* Move remove-cstr-calls from a standalone executable to a clang-tidy check ↵Alexander Kornienko2015-03-164-7/+180
| | | | | | | | | | readability-redundant-string-cstr http://reviews.llvm.org/D7318 Patch by Richard Thomson! llvm-svn: 232338
OpenPOWER on IntegriCloud