summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/docs/clang-tidy
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang-tidy] Add the abseil-time-compare checkHyrum Wright2019-03-112-0/+24
| | | | | | | | | This is an analog of the abseil-duration-comparison check, but for the absl::Time domain. It has a similar implementation and tests. Differential Revision: https://reviews.llvm.org/D58977 llvm-svn: 355835
* [clang-tidy] add OverrideMacro to modernize-use-override checkPaul Hoad2019-02-281-1/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The usefulness of **modernize-use-override** can be reduced if you have to live in an environment where you support multiple compilers, some of which sadly are not yet fully C++11 compliant some codebases have to use override as a macro OVERRIDE e.g. ``` // GCC 4.7 supports explicit virtual overrides when C++11 support is enabled. ``` This allows code to be compiled with C++11 compliant compilers and get warnings and errors that clang, MSVC,gcc can give, while still allowing other legacy pre C++11 compilers to compile the code. This can be an important step towards modernizing C++ code whilst living in a legacy codebase. When it comes to clang tidy, the use of the **modernize-use-override** is one of the most useful checks, but the messages reported are inaccurate for that codebase if the standard approach is to use the macros OVERRIDE and/or FINAL. When combined with fix-its that introduce the C++11 override keyword, they become fatal, resulting in the modernize-use-override check being turned off to prevent the introduction of such errors. This revision, allows the possibility for the replacement **override **to be a macro instead, Allowing the clang-tidy check to be run on both pre and post C++11 code, and allowing fix-its to be applied. Reviewers: alexfh, JonasToth, hokein, Eugene.Zelenko, aaron.ballman Reviewed By: alexfh, JonasToth Subscribers: lewmpk, malcolm.parsons, jdoerfert, xazax.hun, cfe-commits, llvm-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D57087 llvm-svn: 355132
* [clang-tidy] fix documentation link in list of clang-tidy checksJonas Toth2019-02-281-1/+1
| | | | llvm-svn: 355108
* [clang-tidy] redirection in list of checks adjustedJonas Toth2019-02-281-1/+1
| | | | llvm-svn: 355102
* [clang-tidy] include cppcoreguidelines-explicit-virtual-functions in list of ↵Jonas Toth2019-02-282-1/+2
| | | | | | checks and fix redirection llvm-svn: 355100
* [clang-tidy] documentation fixing the actual correct fileJonas Toth2019-02-281-0/+1
| | | | llvm-svn: 355098
* [clang-tidy] tryfix documenation continuedJonas Toth2019-02-281-0/+1
| | | | llvm-svn: 355097
* [clang-tidy] another issue in documentation, double empty line seemed to ↵Jonas Toth2019-02-281-1/+0
| | | | | | confuse code-block llvm-svn: 355095
* [clang-tidy] attempt to fix documentation build-errorJonas Toth2019-02-281-3/+4
| | | | llvm-svn: 355094
* [clang-tidy] added cppcoreguidelines-explicit-virtual-functionsJonas Toth2019-02-282-1/+17
| | | | | | | | | | | | Addresses the bugzilla bug #30397. (https://bugs.llvm.org/show_bug.cgi?id=30397) modernize-use-override suggests that destructors require the override specifier and the CPP core guidelines do not recommend this. Patch by lewmpk. Differential Revision: https://reviews.llvm.org/D58731 llvm-svn: 355093
* [clang-tidy] Add the abseil-time-subtraction checkHyrum Wright2019-02-272-0/+38
| | | | | | Differential Revision: https://reviews.llvm.org/D58137 llvm-svn: 355024
* [clang-tidy] Fix links in docs.Alexander Kornienko2019-02-181-5/+6
| | | | llvm-svn: 354266
* [clang-tidy] Delete obsolete objc-property-declaration options ✂️Stephane Moore2019-02-161-12/+0
| | | | | | | | | | | | | | | | | | | | | | Summary: The Acronyms and IncludeDefaultAcronyms options were deprecated in https://reviews.llvm.org/D51832. These options can be removed. Tested by running the clang-tidy tests. This is an amended resubmission of https://reviews.llvm.org/D56945. Reviewers: Eugene.Zelenko, aaron.ballman Reviewed By: aaron.ballman Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57080 llvm-svn: 354195
* [clang-tidy] Add options to bugprone-argument-comment to add missing ↵Paul Hoad2019-02-081-0/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | argument comments to literals bugprone-argument-comment only supports identifying those comments which do not match the function parameter name This revision add 3 options to adding missing argument comments to literals (granularity on type is added to control verbosity of fixit) ``` CheckOptions: - key: bugprone-argument-comment.CommentBoolLiterals value: '1' - key: bugprone-argument-comment.CommentFloatLiterals value: '1' - key: bugprone-argument-comment.CommentIntegerLiterals value: '1' - key: bugprone-argument-comment.CommentStringLiterals value: '1' - key: bugprone-argument-comment.CommentCharacterLiterals value: '1' - key: bugprone-argument-comment.CommentUserDefinedLiterals value: '1' - key: bugprone-argument-comment.CommentNullPtrs value: '1' ``` After applying these options, literal arguments will be preceded with /*ParameterName=*/ Reviewers: JonasToth, Eugene.Zelenko, alexfh, hokein, aaron.ballman Reviewed By: aaron.ballman, Eugene.Zelenko Differential Revision: https://reviews.llvm.org/D57674 llvm-svn: 353535
* [clang-tidy] Expand and clarify the NOLINT documentation a bit.Alexander Kornienko2019-02-071-11/+32
| | | | llvm-svn: 353382
* [clang-tidy] modernize-avoid-c-arrays: avoid main function (PR40604)Roman Lebedev2019-02-061-0/+4
| | | | | | | | | | | | | | | | | | | | | Summary: The check should ignore the main function, the program entry point. It is not possible to use `std::array<>` for the `argv`. The alternative is to use `char** argv`. Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=40604 | PR40604 ]] Reviewers: JonasToth, aaron.ballman Reviewed By: aaron.ballman Subscribers: xazax.hun, hans, cfe-commits Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D57787 llvm-svn: 353327
* [clang-tidy] Add the abseil-duration-unnecessary-conversion checkHyrum Wright2019-02-042-0/+32
| | | | | | Differential Revision: https://reviews.llvm.org/D57353 llvm-svn: 353079
* Adjust documentation for git migration.James Y Knight2019-01-292-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes most references to the paths: llvm.org/svn/ llvm.org/git/ llvm.org/viewvc/ github.com/llvm-mirror/ github.com/llvm-project/ reviews.llvm.org/diffusion/ to instead point to https://github.com/llvm/llvm-project. This is *not* a trivial substitution, because additionally, all the checkout instructions had to be migrated to instruct users on how to use the monorepo layout, setting LLVM_ENABLE_PROJECTS instead of checking out various projects into various subdirectories. I've attempted to not change any scripts here, only documentation. The scripts will have to be addressed separately. Additionally, I've deleted one document which appeared to be outdated and unneeded: lldb/docs/building-with-debug-llvm.txt Differential Revision: https://reviews.llvm.org/D57330 llvm-svn: 352514
* [clang-tidy] Add the abseil-duration-addition checkHyrum Wright2019-01-282-0/+22
| | | | | | Differential Revision: https://reviews.llvm.org/D57185 llvm-svn: 352362
* [clang-tidy] Add check for underscores in googletest names.Haojian Wu2019-01-252-0/+35
| | | | | | | | | | | | | | | | | | Summary: Adds a clang-tidy warning for underscores in googletest names. Patch by Kar Epker! Reviewers: hokein, alexfh, aaron.ballman Reviewed By: hokein Subscribers: Eugene.Zelenko, JonasToth, MyDeveloperDay, lebedev.ri, xazax.hun, mgorny, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D56424 llvm-svn: 352183
* [doc] Fix svn property for bugprone-parent-virtual-call.rstZinovy Nis2019-01-231-0/+0
| | | | llvm-svn: 351925
* Revert rCTE351921 to fix documentation geneeration.Stephane Moore2019-01-231-0/+12
| | | | | | Original review: https://reviews.llvm.org/D56945 llvm-svn: 351922
* [clang-tidy] Delete obsolete objc-property-declaration options ✂️Stephane Moore2019-01-231-12/+0
| | | | | | | | | | | | | | | | | | | | Summary: The `Acronyms` and `IncludeDefaultAcronyms` options were deprecated in https://reviews.llvm.org/D51832. These options can be removed. Tested by running the clang-tidy tests. Reviewers: benhamilton, aaron.ballman Reviewed By: aaron.ballman Subscribers: Eugene.Zelenko, xazax.hun, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D56945 llvm-svn: 351921
* [doc] Replace 'class' with 'struct' for 'public' by defaultZinovy Nis2019-01-221-3/+3
| | | | | | Make sample syntax correct. llvm-svn: 351867
* [Documentation] Use HTTPS whenever possible.Eugene Zelenko2019-01-2211-14/+14
| | | | | | Differential revision: https://reviews.llvm.org/D56926 llvm-svn: 351862
* [clang-tidy] Fix whitespace in docs. NFCAlexander Kornienko2019-01-221-15/+14
| | | | | | Actually, just testing commits via monorepo ;) llvm-svn: 351814
* [clang-tidy] misc-non-private-member-variables-in-classes: ignore implicit ↵Miklos Vajna2019-01-201-5/+5
| | | | | | | | | | methods Otherwise we don't warn on a struct containing a single public int, but we warn on a struct containing a single public std::string, which is inconsistent. llvm-svn: 351686
* [clang-tidy] Add abseil-duration-conversion-cast checkHyrum Wright2019-01-172-0/+32
| | | | | | Differential Revision: https://reviews.llvm.org/D56532 llvm-svn: 351473
* [Documentation] Fix another link in docs/clang-tidy/Contributing.rst.Eugene Zelenko2019-01-171-6/+9
| | | | llvm-svn: 351468
* [Documentation] Another attempt to fix link in ↵Eugene Zelenko2019-01-171-14/+15
| | | | | | docs/clang-tidy/Contributing.rst. Use HTTPS for links. llvm-svn: 351467
* [Documentation] Fix link in docs/clang-tidy/Contributing.rst.Eugene Zelenko2019-01-171-2/+3
| | | | llvm-svn: 351466
* [Documentation] Add a chapter about Clang-tidy integrations.Eugene Zelenko2019-01-173-508/+626
| | | | | | | | Patch by Marina Kalashina. Differential Revision: https://reviews.llvm.org/D54945 llvm-svn: 351463
* [clang-tidy] add options documentation to readability-identifier-naming checkerPaul Hoad2019-01-151-8/+1913
| | | | | | | | | | | | | | | | | | | | | Summary: The documentation for this clang-checker did not explain what the options are. But this checkers only works with at least some options defined. To discover the options, you have to read the source code. This shouldn't be necessary for users who just have access to the clang-tidy binary. This revision, explains the options and gives an example. Patch by MyDeveloperDay. Reviewers: JonasToth, Eugene.Zelenko Reviewed By: JonasToth Subscribers: xazax.hun, Eugene.Zelenko Differential Revision: https://reviews.llvm.org/D56563 llvm-svn: 351261
* [clang-tidy] new check 'readability-redundant-preprocessor'Miklos Vajna2019-01-112-0/+62
| | | | | | | | | | Finds potentially redundant preprocessor directives. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D54349 llvm-svn: 350922
* [clang-tidy] another take at fixing docJonas Toth2019-01-091-8/+12
| | | | llvm-svn: 350765
* [clang-tidy] tryfix documentation buildJonas Toth2019-01-091-12/+13
| | | | llvm-svn: 350763
* [clang-tidy] Adding a new modernize use nodiscard checkerJonas Toth2019-01-092-0/+78
| | | | | | | | | | | | | | | | | | Summary: Adds a checker to clang-tidy to warn when a non void const member function, taking only parameters passed by value or const reference could be marked as '[[nodiscard]]' Patch by MyDeveloperDay. Reviewers: alexfh, stephenkelly, curdeius, aaron.ballman, hokein, JonasToth Reviewed By: curdeius, JonasToth Subscribers: Eugene.Zelenko, lefticus, lebedev.ri, mgorny, xazax.hun, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D55433 llvm-svn: 350760
* [Documentation] fix order of checks in checks/list.rstJonas Toth2019-01-051-3/+3
| | | | llvm-svn: 350466
* [clang-tidy] add IgnoreMacros option to readability-uppercase-literal-suffixMiklos Vajna2018-12-241-0/+5
| | | | | | | | | | | | | | And also enable it by default to be consistent with e.g. modernize-use-using. This helps e.g. when running this check on client code where the macro is provided by the system, so there is no easy way to modify it. Reviewed By: JonasToth, lebedev.ri Differential Revision: https://reviews.llvm.org/D56025 llvm-svn: 350056
* [clang-tidy] Add the abseil-duration-subtraction checkHyrum Wright2018-12-132-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This check uses the context of a subtraction expression as well as knowledge about the Abseil Time types, to infer the type of the second operand of some subtraction expressions in Duration conversions. For example: absl::ToDoubleSeconds(duration) - foo can become absl::ToDoubleSeconds(duration - absl::Seconds(foo)) This ensures that time calculations are done in the proper domain, and also makes it easier to further deduce the types of the second operands to these expressions. Reviewed By: JonasToth Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D55245 llvm-svn: 349073
* [clang-tidy]: Abseil: new check 'abseil-upgrade-duration-conversions'Eric Fiselier2018-12-072-0/+44
| | | | | | | | | | | | | Patch by Alex Strelnikov. Reviewed as D53830 Introduce a new check to upgrade user code based on upcoming API breaking changes to absl::Duration. The check finds calls to arithmetic operators and factory functions for absl::Duration that rely on an implicit user defined conversion to int64_t. These cases will no longer compile after proposed changes are released. Suggested fixes explicitly cast the argument int64_t. llvm-svn: 348633
* Revert "[clang-tidy] new check: bugprone-branch-clone"Jonas Toth2018-12-052-91/+0
| | | | | | | The patch broke on buildbot with assertion-failure. Revert until this is figured out. llvm-svn: 348344
* [clang-tidy] new check: bugprone-branch-cloneJonas Toth2018-12-052-0/+91
| | | | | | | | | | | | | | | | | | | | | | Summary: Implement a check for detecting if/else if/else chains where two or more branches are Type I clones of each other (that is, they contain identical code) and for detecting switch statements where two or more consecutive branches are Type I clones of each other. Patch by donat.nagy. Reviewers: alexfh, hokein, aaron.ballman, JonasToth Reviewed By: JonasToth Subscribers: MTC, lebedev.ri, whisperity, xazax.hun, Eugene.Zelenko, mgorny, rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D54757 llvm-svn: 348343
* [clang-tidy/checks] Update objc-property-declaration check to allow ↵Stephane Moore2018-12-051-17/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | arbitrary acronyms and initialisms 🔧 Summary: §1 Description This changes the objc-property-declaration check to allow arbitrary acronyms and initialisms instead of using whitelisted acronyms. In Objective-C it is relatively common to use project prefixes in property names for the purposes of disambiguation. For example, the CIColor¹ and CGColor² properties on UIColor both represent symbol prefixes being used in proeprty names outside of Apple's accepted acronyms³. The union of Apple's accepted acronyms and all symbol prefixes that might be used for disambiguation in property declarations effectively allows for any arbitrary sequence of capital alphanumeric characters to be acceptable in property declarations. This change updates the check accordingly. The test variants with custom configurations are deleted as part of this change because their configurations no longer impact behavior. The acronym configurations are currently preserved for backwards compatibility of check configuration. [1] https://developer.apple.com/documentation/uikit/uicolor/1621951-cicolor?language=objc [2] https://developer.apple.com/documentation/uikit/uicolor/1621954-cgcolor?language=objc [3] https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/APIAbbreviations.html#//apple_ref/doc/uid/20001285-BCIHCGAE §2 Test Notes Changes verified by: • Running clang-tidy unit tests. • Used check_clang_tidy.py to verify expected output of processing objc-property-declaration.m Reviewers: benhamilton, Wizard Reviewed By: benhamilton Subscribers: jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D51832 llvm-svn: 348331
* [Documentation] Make options section in Clang-tidy ↵Eugene Zelenko2018-12-041-6/+14
| | | | | | readability-uppercase-literal-suffix consistent with other checks. llvm-svn: 348302
* [Documentation] Fix formatting and wrap up to 80 characters in Clang-tidy ↵Eugene Zelenko2018-12-031-9/+10
| | | | | | readability-uppercase-literal-suffix documentation. llvm-svn: 348202
* [clang-tidy] Recommit: Add the abseil-duration-comparison checkJonas Toth2018-12-032-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This check finds instances where Duration values are being converted to a numeric value in a comparison expression, and suggests that the conversion happen on the other side of the expression to a Duration. See documentation for examples. This also shuffles some code around so that the new check may perform in sone step simplifications also caught by other checks. Compilation is unbroken, because the hash-function is now directly specified for std::unordered_map, as 'enum class' does not compile as key (seamingly only on some compilers). Patch by hwright. Reviewers: aaron.ballman, JonasToth, alexfh, hokein Reviewed By: JonasToth Subscribers: sammccall, Eugene.Zelenko, xazax.hun, cfe-commits, mgorny Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D54737 llvm-svn: 348169
* Revert "[clang-tidy] Add the abseil-duration-comparison check"Jonas Toth2018-12-032-34/+0
| | | | | | This commit broke buildbots and needs adjustments. llvm-svn: 348165
* [clang-tidy] Add the abseil-duration-comparison checkJonas Toth2018-12-032-0/+34
| | | | | | | | | | | | | | | | | | | | | Summary: This check finds instances where Duration values are being converted to a numeric value in a comparison expression, and suggests that the conversion happen on the other side of the expression to a Duration. See documentation for examples. This also shuffles some code around so that the new check may perform in sone step simplifications also caught by other checks. Patch by hwright. Reviewers: aaron.ballman, JonasToth, alexfh, hokein Reviewed By: JonasToth Subscribers: sammccall, Eugene.Zelenko, xazax.hun, cfe-commits, mgorny Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D54737 llvm-svn: 348161
* [Documentation] Try to fix build failure in ↵Eugene Zelenko2018-11-291-4/+4
| | | | | | cppcoreguidelines-narrowing-conversions documentation llvm-svn: 347825
OpenPOWER on IntegriCloud