summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/readability
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang-tidy] Fixed header guards using clang-tidy llvm-header-guard check. NFC.Alexander Kornienko2015-03-092-6/+6
| | | | | | | | | | The patch was generated using this command: $ clang-tidy/tool/run-clang-tidy.py -header-filter=.*clang-tidy.* -fix \ -checks=-*,llvm-header-guard clang-tidy.* $ svn revert --recursive clangt-tidy/llvm/ (to revert a few buggy fixes) llvm-svn: 231669
* [clang-tidy] Refactor: Rename clang-tidy readability check files and classes ↵Alexander Kornienko2015-03-098-29/+28
| | | | | | | | | | | | | to follow naming conventions Classes are named WhateverCheck, files are WhateverCheck.cpp and` WhateverCheck.h` http://reviews.llvm.org/D8144 Patch by Richard Thomson! llvm-svn: 231650
* Use std::string instead of StringRef to prevent use-after-free.Daniel Jasper2015-03-051-1/+1
| | | | | | Discovered by asan. llvm-svn: 231421
* [clang-tidy] Replace unrecognized namespace ending comments.Alexander Kornienko2015-03-051-17/+22
| | | | | | | | | | | | | | | | | | | | | | Summary: Replace unrecognized namespace ending comments. This will help in particular when a namespace ending comment is mistyped or doesn't fit the regexp for other reason, e.g.: namespace a { namespace b { namespace { } // anoynmous namespace } // b } // namesapce a Reviewers: djasper Reviewed By: djasper Subscribers: curdeius, cfe-commits Differential Revision: http://reviews.llvm.org/D8078 llvm-svn: 231369
* [clang-tidy] Fix namespace comments. NFC.Alexander Kornienko2015-03-042-5/+5
| | | | llvm-svn: 231267
* [clang-tidy] Refactor: Move readability checks to namespace ↵Alexander Kornienko2015-03-024-2/+8
| | | | | | | | | | | | | 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
* Re-sort includes using the LLVM utils/sort_includes.py script.Chandler Carruth2015-02-132-7/+4
| | | | llvm-svn: 229087
* [clang-tidy] Use shrink_to_fit instead of copy and swap trickAlexander Kornienko2015-01-234-0/+148
| | | | | | | | | | | | | | | | The shrink_to_fit() method is more readable and more effective than the copy and swap trick to reduce the capacity of a shrinkable container. Note that, the shrink_to_fit() method is only available in C++11 and up. Example: std::vector<int>(v).swap(v); will be replaced with v.shrink_to_fit(); http://reviews.llvm.org/D7087 Patch by Gábor Horváth! llvm-svn: 226912
* [clang-tidy] Small readability-container-size-empty cleanupAlexander Kornienko2015-01-231-2/+1
| | | | | | | | | | Utilized the hasEitherOperand instead of explicit anyOf. http://reviews.llvm.org/D7142 Patch by Gábor Horváth! llvm-svn: 226911
* [clang-tidy] Use actual LangOptions.Alexander Kornienko2015-01-222-4/+4
| | | | llvm-svn: 226812
* [clang-tidy] Minor cleanups in readability-container-size-empty checkerAlexander Kornienko2015-01-221-13/+6
| | | | | | | | | | | * Removed an unused header * Simplified the custom ast_matchers http://reviews.llvm.org/D7088 Patch by Gábor Horváth! llvm-svn: 226810
* clang-tidy: 'size' call that could be replaced with 'empty' on STL containersAlexander Kornienko2015-01-154-0/+217
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We are porting some of the checkers at a company we developed to the Clang Tidy infrastructure. We would like to open source the checkers that may be useful for the community as well. This patch is the first checker that is being ported to Clang Tidy. We also added fix-it hints, and applied them to LLVM: http://reviews.llvm.org/D6924 The code compiled and the unit tests are passed after the fixits was applied. The documentation of the checker: /// The emptiness of a container should be checked using the empty method /// instead of the size method. It is not guaranteed that size is a /// constant-time function, and it is generally more efficient and also shows /// clearer intent to use empty. Furthermore some containers may implement the /// empty method but not implement the size method. Using empty whenever /// possible makes it easier to switch to another container in the future. It also uses some custom ASTMatchers. In case you find them useful I can submit them as separate patches to clang. I will apply your suggestions to this patch. http://reviews.llvm.org/D6925 Patch by Gábor Horváth! llvm-svn: 226172
* clang-tidy: Add initial check for "Don't use else after return".Daniel Jasper2015-01-144-0/+80
| | | | | | | | | | | 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
* [clang-tidy] Move the missing namespace comment warnings to the closing braceAlexander Kornienko2014-11-171-1/+9
| | | | | | | | | | | | | | | | | | | Summary: The google-readability-namespace-comments/llvm-namespace-comment warnings are quite confusing when they appear at the beginning of a long namespace and the closing brace is not in sight. For convenience added notes pointing to the start of the namespace. Reviewers: klimek Reviewed By: klimek Subscribers: curdeius, cfe-commits Differential Revision: http://reviews.llvm.org/D6251 llvm-svn: 222145
* [clang-tidy] Bring order to check registration.Alexander Kornienko2014-10-262-1/+46
| | | | | | | | | | | | | | | | Summary: Register readability checks in a separate module. Renamed the checks and test file names accordingly. Reviewers: djasper, klimek Reviewed By: klimek Subscribers: curdeius, cfe-commits Differential Revision: http://reviews.llvm.org/D5936 llvm-svn: 220631
* [clang-tidy] Minor fixes for the NamespaceCommentCheck.Alexander Kornienko2014-10-161-4/+6
| | | | | | | | * Make SmallVector size enough for all groups. * Allow trailing period in the comment. * Fix "// anonymous namespace qqq". llvm-svn: 219926
* [clang-tidy] Default options in modules.Alexander Kornienko2014-10-161-2/+1
| | | | | | | | | | | | | | | | | | | | | | | Summary: This patch allows modules to specify default options for the checks defined in them. This way a sufficiently configurable check can be registered in multiple modules with different default options. E.g. the SpacesBeforeComments option may be set to 1 for the "llvm-namespace-comments" check and to 2 for the "google-readability-namespace-comment" check without modifying or extending the check code. This patch also registers the google-readability-braces-around-statements check with suitable defaults. Reviewers: djasper Reviewed By: djasper Subscribers: curdeius, cfe-commits Differential Revision: http://reviews.llvm.org/D5798 llvm-svn: 219923
* [clang-tidy] Move some of the misc checks to readability/Alexander Kornienko2014-10-157-0/+636
| | | | | | | | | | | | | | | | | | | 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
* Add NamespaceCommentCheck to the Google module.Alexander Kornienko2014-09-224-0/+194
Summary: This uses a bit hacky way to set the defaults for the spaces before comments, but it's also one of the simplest ways. Fixed a bug with how the SpacesBeforeComments option was used. Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5410 llvm-svn: 218240
OpenPOWER on IntegriCloud