summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/docs/clang-tidy
Commit message (Collapse)AuthorAgeFilesLines
...
* Adding some documentation changes that were missed in r336301.Aaron Ballman2018-07-052-0/+42
| | | | llvm-svn: 336302
* Add the cert-msc51-cpp and cert-msc32-c checks.Aaron Ballman2018-07-051-0/+9
| | | | | | | | These checks flag use of random number generators with poor seeds that would possibly lead to degraded random number generation. Patch by Borsik Gábor llvm-svn: 336301
* [clang-tidy] misc-unused-parameters - retain old behavior under StrictModeAlexander Kornienko2018-06-281-7/+23
| | | | | | | | | | | | | | Summary: This addresses https://bugs.llvm.org/show_bug.cgi?id=37467. Reviewers: klimek, ilya-biryukov, lebedev.ri, aaron.ballman Reviewed By: lebedev.ri, aaron.ballman Subscribers: aaron.ballman, lebedev.ri, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D46951 llvm-svn: 335863
* [clang-tidy] Remove the google-readability-redundant-smartptr-get aliasAlexander Kornienko2018-06-213-15/+2
| | | | | | | | I don't remember why I added it, but it's definitely not needed, since the check doesn't have any options and the check doesn't have any special relation to the Google C++ style. llvm-svn: 335252
* [clang-tidy] This patch is a fix for D45405 where spaces were mistakenly ↵Zinovy Nis2018-06-151-6/+23
| | | | | | | | considered as a part of a type name. So length("int *") was 5 instead of 3 with RemoveStars=0 or 4 with RemoveStars=1 Differential Revision: https://reviews.llvm.org/D45927 llvm-svn: 334829
* [clang-tidy] Store checks profiling info as JSON filesRoman Lebedev2018-06-061-99/+168
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Continuation of D46504. Example output: ``` $ clang-tidy -enable-check-profile -store-check-profile=. -checks=-*,readability-function-size source.cpp $ # Note that there won't be timings table printed to the console. $ cat *.json { "file": "/path/to/source.cpp", "timestamp": "2018-05-16 16:13:18.717446360", "profile": { "time.clang-tidy.readability-function-size.wall": 1.0421266555786133e+00, "time.clang-tidy.readability-function-size.user": 9.2088400000005421e-01, "time.clang-tidy.readability-function-size.sys": 1.2418899999999974e-01 } } ``` There are two arguments that control profile storage: * `-store-check-profile=<prefix>` By default reports are printed in tabulated format to stderr. When this option is passed, these per-TU profiles are instead stored as JSON. If the prefix is not an absolute path, it is considered to be relative to the directory from where you have run :program:`clang-tidy`. All `.` and `..` patterns in the path are collapsed, and symlinks are resolved. Example: Let's suppose you have a source file named `example.cpp`, located in `/source` directory. * If you specify `-store-check-profile=/tmp`, then the profile will be saved to `/tmp/<timestamp>-example.cpp.json` * If you run :program:`clang-tidy` from within `/foo` directory, and specify `-store-check-profile=.`, then the profile will still be saved to `/foo/<timestamp>-example.cpp.json` Reviewers: alexfh, sbenza, george.karpenkov, NoQ, aaron.ballman Reviewed By: alexfh, george.karpenkov, aaron.ballman Subscribers: Quuxplusone, JonasToth, aaron.ballman, llvm-commits, rja, Eugene.Zelenko, xazax.hun, mgrang, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D46602 llvm-svn: 334101
* [clang-tidy] new cppcoreguidelines-narrowing-conversions check.Clement Courbet2018-05-232-0/+23
| | | | | | | | | | | | | | | | | | | Summary: Checks for narrowing conversions, e.g. int i = 0; i += 0.1; This has what some might consider false positives for: i += ceil(d); Reviewers: alexfh, hokein Subscribers: srhines, nemanjai, mgorny, JDevlieghere, xazax.hun, kbarton Differential Revision: https://reviews.llvm.org/D38455 llvm-svn: 333066
* Add a new check, readability-simplify-subscript-expr, that diagnoses array ↵Aaron Ballman2018-05-162-0/+24
| | | | | | | | | | subscript expressions that can be simplified. Currently, diagnoses code that calls container.data()[some_index] when the container exposes a suitable operator[]() method that can be used directly. Patch by Shuai Wang. llvm-svn: 332519
* [clang-tidy] Add terminating continue checkGabor Horvath2018-05-142-0/+18
| | | | | | | | Patch by: Daniel Kolozsvari! Differential Revision: https://reviews.llvm.org/D33844 llvm-svn: 332223
* Reland "[clang-tidy] Adding RestrictSystemIncludes check to Fuchsia module"Julie Hockett2018-05-112-0/+33
| | | | | | This relands r332125 with a fixed test. llvm-svn: 332141
* Revert "[clang-tidy] Adding RestrictSystemIncludes check to Fuchsia module"Julie Hockett2018-05-112-33/+0
| | | | | | This reverts commit r332125 for a failing test. llvm-svn: 332131
* [clang-tidy] Adding RestrictSystemIncludes check to Fuchsia moduleJulie Hockett2018-05-112-0/+33
| | | | | | | | | | Adding a check to restrict system includes to a whitelist. Given a list of includes that are explicitly allowed, the check issues a fixit to remove any system include not on that list from the source file. Differential Revision: https://reviews.llvm.org/D43778 llvm-svn: 332125
* Revert "[clang-tidy] Adding RestrictSystemIncludes check to Fuchsia module"Julie Hockett2018-05-092-33/+0
| | | | | | This reverts commit r331930, which was landed by accident. llvm-svn: 331934
* [clang-tidy] Adding RestrictSystemIncludes check to Fuchsia moduleJulie Hockett2018-05-092-0/+33
| | | | | | | | | | Adding a check to restrict system includes to a whitelist. Given a list of includes that are explicitly allowed, the check issues a fixit to remove any system include not on that list from the source file. Differential Revision: https://reviews.llvm.org/D43778 llvm-svn: 331930
* [clang-tidy] Remove AnalyzeTemporaryDtors option.Alexander Kornienko2018-05-031-6/+0
| | | | | | | | Remove the `AnalyzeTemporaryDtors` option, since the corresponding `cfg-temporary-dtors` option of the Static Analyzer defaults to `true` since r326461. llvm-svn: 331456
* [clang-tidy] Improve bugprone-unused-return-value checkJonathan Coe2018-04-241-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add support for checking class template member functions. Also add the following functions to be checked by default: - std::unique_ptr::release - std::basic_string::empty - std::vector::empty Reviewers: alexfh, hokein, aaron.ballman, ilya-biryukov Reviewed By: aaron.ballman Subscribers: jbcoe, xazax.hun, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D45891 Patch by khuttun (Kalle Huttunen) llvm-svn: 330772
* [clang-tidy] Customize FileCheck prefix in check_clang-tidy.pyZinovy Nis2018-04-211-0/+21
| | | | | | | | | | | | | | | | | | | The patch introduces a new command line option '-check-suffix' for check_clang_tidy.py to allow multiple %check_clang_tidy% in a single test file. Sample: // RUN: %check_clang_tidy -check-suffix=FLAG-1 %s misc-unused-using-decls %t -- -- <options-set-1> // RUN: %check_clang_tidy -check-suffix=FLAG-2 %s misc-unused-using-decls %t -- -- <options-set-2> ... +// CHECK-MESSAGES-FLAG-1: :[[@LINE-4]]:10: warning: using decl 'B' is unused [misc-unused-using-decls] +// CHECK-MESSAGES-FLAG-2: :[[@LINE-7]]:10: warning: using decl 'A' is unused [misc-unused-using-decls] +// CHECK-FIXES-FLAG-1-NOT: using a::A;$ +// CHECK-FIXES-FLAG-2-NOT: using a::B;$ Differential Revision: https://reviews.llvm.org/D45776 llvm-svn: 330511
* [clang-tidy] readability-function-size: add VariableThreshold param.Roman Lebedev2018-04-121-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Pretty straight-forward, just count all the variable declarations in the function's body, and if more than the configured threshold - do complain. Note that this continues perverse practice of disabling the new option by default. I'm not certain where is the balance point between not being too noisy, and actually enforcing the good practice. If we really want to not disable this by default, but also to not cause too many new warnings, we could default to 50 or so. But that is a lot of variables too... I was able to find one coding style referencing variable count: - https://www.kernel.org/doc/html/v4.15/process/coding-style.html#functions > Another measure of the function is the number of local variables. They shouldn’t exceed 5-10, or you’re doing something wrong. Reviewers: hokein, xazax.hun, JonasToth, aaron.ballman, alexfh Reviewed By: aaron.ballman Subscribers: kimgr, Eugene.Zelenko, rnkovacs, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D44602 llvm-svn: 329902
* [Documentation] Fix options order for Release Notes in modernize-use-auto.Zinovy Nis2018-04-121-18/+18
| | | | llvm-svn: 329875
* [Documentation] Fix formatting and order in Release Notes for recent changes ↵Eugene Zelenko2018-04-111-3/+3
| | | | | | in modernize-use-auto. llvm-svn: 329833
* [clang-tidy] Add a `android-comparison-in-temp-failure-retry` checkGeorge Burgess IV2018-04-102-0/+37
| | | | | | | | | This check attempts to catch buggy uses of the `TEMP_FAILURE_RETRY` macro, which is provided by both Bionic and glibc. Differential Revision: https://reviews.llvm.org/D45059 llvm-svn: 329759
* [clang-tidy] [modernize-use-auto] Add a threshold for minimal type name ↵Zinovy Nis2018-04-101-0/+20
| | | | | | | | | | | | length to be replaced with 'auto' The threshold option is 'MinTypeNameLength' with default value '5'. With MinTypeNameLength == 5 'int'/'bool' and 'const int'/'const bool' will not be converted to 'auto', while 'unsigned' will be. Differential Revision: https://reviews.llvm.org/D45405 llvm-svn: 329730
* [clang-tidy] Adding alias for anon namespaces in header (fuchsia module)Julie Hockett2018-04-103-0/+12
| | | | | | | | | Adding alias to google-build-namespaces to the Fuchsia module (checks for anonymous namespaces in headers). Differential Revision: https://reviews.llvm.org/D45447 llvm-svn: 329720
* [clang-tidy] Check if grand-..parent's virtual method was called instead of ↵Zinovy Nis2018-04-062-0/+24
| | | | | | | | | | | | | overridden parent's. class A {...int virtual foo() {...}...}; class B: public A {...int foo() override {...}...}; class C: public B {...int foo() override {... A::foo()...}}; ^^^^^^^^ warning: qualified name A::foo refers to a member overridden in subclass; did you mean 'B'? [bugprone-parent-virtual-call] Differential Revision: https://reviews.llvm.org/D44295 llvm-svn: 329448
* [clang-tidy] Remove google-runtime-member-string-referencesBenjamin Kramer2018-04-052-26/+0
| | | | | | | | | | This is triggering on a pattern that's both too broad (const std::string& members can be used safely) and too narrow (std::string is not the only class with this problem). It has a very low true positive rate, just remove it until we find a better solution for dangling string references. llvm-svn: 329292
* [clang-tidy] Check for sizeof that call functionsHaojian Wu2018-04-031-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: A common mistake that I have found in our codebase is calling a function to get an integer or enum that represents the type such as: ``` int numBytes = numElements * sizeof(x.GetType()); ``` So this extends the `sizeof` check to check for these cases. There is also a `WarnOnSizeOfCall` option so it can be disabled. Patch by Paul Fultz II! Reviewers: hokein, alexfh, aaron.ballman, ilya-biryukov Reviewed By: alexfh Subscribers: lebedev.ri, xazax.hun, jkorous-apple, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D44231 llvm-svn: 329073
* [clang-tidy] Resubmit hicpp-multiway-paths-covered without breaking testJonas Toth2018-03-212-0/+97
| | | | | | | | | | | | | | | | | | | | | | | | The original check did break the green buildbot in the sanitizer build. It took a while to redroduce and understand the issue. There occured a stackoverflow while parsing the AST. The testcase with 256 case labels was the problem because each case label added another stackframe. It seemed that the issue occured only in 'RelWithDebInfo' builds and not in normal sanitizer builds. To simplify the matchers the recognition for the different kinds of switch statements has been moved into a seperate function and will not be done with ASTMatchers. This is an attempt to reduce recursion and stacksize as well. The new check removed this big testcase. Covering all possible values is still implemented for bitfields and works there. The same logic on integer types will lead to the issue. Running it over LLVM gives the following results: Differential: https://reviews.llvm.org/D40737 llvm-svn: 328107
* [clang-tidy] New check bugprone-unused-return-valueAlexander Kornienko2018-03-192-0/+25
| | | | | | | | | | | | | | | | | | | | | Summary: Detects function calls where the return value is unused. Checked functions can be configured. Reviewers: alexfh, aaron.ballman, ilya-biryukov, hokein Reviewed By: alexfh, aaron.ballman Subscribers: hintonda, JonasToth, Eugene.Zelenko, mgorny, xazax.hun, cfe-commits Tags: #clang-tools-extra Patch by Kalle Huttunen! Differential Revision: https://reviews.llvm.org/D41655 llvm-svn: 327833
* [clang-tidy] rename_check.py misc-unused-raii bugprone-unused-raii ↵Alexander Kornienko2018-03-152-4/+4
| | | | | | --check_class_name=UnusedRAIICheck llvm-svn: 327610
* [clang-tidy] rename_check.py misc-sizeof-container bugprone-sizeof-containerAlexander Kornienko2018-03-152-4/+4
| | | | llvm-svn: 327608
* [clang-tidy] rename_check.py misc-sizeof-expression bugprone-sizeof-expressionAlexander Kornienko2018-03-152-4/+4
| | | | llvm-svn: 327607
* [clang-tidy] rename_check.py {misc,bugprone}-macro-parenthesesAlexander Kornienko2018-03-152-4/+4
| | | | llvm-svn: 327606
* [clang-tidy] Add Zircon module to clang-tidyJulie Hockett2018-03-143-0/+55
| | | | | | | | | | Adding a Zircon module to clang-tidy for checks specific to the Zircon kernel, and adding a checker to fuchsia-zx (for zircon) to flag instances where specific objects are temporarily created. Differential Revision: https://reviews.llvm.org/D44346 llvm-svn: 327590
* [clang-tidy] Add check: replace string::find(...) == 0 with absl::StartsWithHaojian Wu2018-03-092-0/+42
| | | | | | | | | | | | Patch by Niko Weh! Reviewers: hokein Subscribers: klimek, cfe-commits, ioeric, ilya-biryukov, ahedberg Differential Revision: https://reviews.llvm.org/D43847 llvm-svn: 327111
* [Documentation] Fix Clang-tidy checks list broken in r326909.Eugene Zelenko2018-03-071-1/+1
| | | | llvm-svn: 326954
* [clang-tidy] Add "portability" module and rename readability-simd-intrinsics ↵Fangrui Song2018-03-072-2/+9
| | | | | | | | | | | | to portability-simd-intrinsics Reviewers: alexfh Subscribers: klimek, nemanjai, mgorny, xazax.hun, kbarton, cfe-commits Differential Revision: https://reviews.llvm.org/D44173 llvm-svn: 326909
* [clang-tidy] Another batch of checks to rename from misc- to bugprone-.Alexander Kornienko2018-02-287-24/+22
| | | | | | | | | | | | | | | | Summary: clang-tidy/rename_check.py {misc,bugprone}-suspicious-semicolon clang-tidy/rename_check.py {misc,bugprone}-suspicious-string-compare clang-tidy/rename_check.py {misc,bugprone}-swapped-arguments clang-tidy/rename_check.py {misc,bugprone}-undelegated-constructor --check_class_name UndelegatedConstructor Reviewers: hokein, sammccall, aaron.ballman Subscribers: klimek, mgorny, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D43870 llvm-svn: 326386
* Rename more checks from misc- to bugprone-.Alexander Kornienko2018-02-285-16/+16
| | | | | | | | | | | | | | | | Summary: clang-tidy/rename_check.py {misc,bugprone}-string-integer-assignment clang-tidy/rename_check.py {misc,bugprone}-string-literal-with-embedded-nul clang-tidy/rename_check.py {misc,bugprone}-suspicious-enum-usage clang-tidy/rename_check.py {misc,bugprone}-suspicious-missing-comma Reviewers: hokein, sammccall, aaron.ballman Subscribers: klimek, cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D43868 llvm-svn: 326384
* [Documentation] Split Clang-tidy changes in Release Notes into sections: new ↵Eugene Zelenko2018-02-282-5/+5
| | | | | | checks, new aliases, renamed checks; sort all of them alphabetically. Enforce 80 characters line length limit. Highlight C++ keywords. llvm-svn: 326354
* Rename a few checks from misc- to bugprone-.Alexander Kornienko2018-02-286-20/+20
| | | | | | | | | | | | | | | | | | Summary: rename_check.py {misc,bugprone}-forwarding-reference-overload rename_check.py {misc,bugprone}-macro-repeated-side-effects rename_check.py {misc,bugprone}-lambda-function-name rename_check.py {misc,bugprone}-misplaced-widening-cast Reviewers: hokein, sammccall, aaron.ballman Reviewed By: aaron.ballman Subscribers: klimek, cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D43867 llvm-svn: 326327
* [clang-tidy] Replace the usage of std::uncaught_exception with ↵Gabor Horvath2018-02-202-0/+65
| | | | | | | | | | std::uncaught_exceptions Patch by: Daniel Kolozsvari! Differential Revision: https://reviews.llvm.org/D40787 llvm-svn: 325572
* [Documentation] Fix Sphinx error. Limit text width to 80 characters.Eugene Zelenko2018-02-161-10/+12
| | | | llvm-svn: 325374
* [clang-tidy] Add `readability-simd-intrinsics` check.Fangrui Song2018-02-152-0/+43
| | | | | | | | | | | | | | | | | | | | | Summary: Many architectures provide SIMD operations (e.g. x86 SSE/AVX, Power AltiVec/VSX, ARM NEON). It is common that SIMD code implementing the same algorithm, is written in multiple target-dispatching pieces to optimize for different architectures or micro-architectures. The C++ standard proposal P0214 and its extensions cover many common SIMD operations. By migrating from target-dependent intrinsics to P0214 operations, the SIMD code can be simplified and pieces for different targets can be unified. Refer to http://wg21.link/p0214 for introduction and motivation for the data-parallel standard library. Subscribers: klimek, aemerson, mgorny, xazax.hun, kristof.beyls, hintonda, cfe-commits Differential Revision: https://reviews.llvm.org/D42983 llvm-svn: 325272
* [clang-tidy] Minor documentation fixGabor Horvath2018-02-151-0/+1
| | | | llvm-svn: 325223
* [clang-tidy] New checker for exceptions that are created but not thrownGabor Horvath2018-02-152-0/+21
| | | | | | | | Patch by: Kristof Umann Differential Revision: https://reviews.llvm.org/D43120 llvm-svn: 325222
* [clang-tidy] Fix incorrect code indention in the doc.Haojian Wu2018-02-051-6/+5
| | | | llvm-svn: 324235
* [clang-tidy] tweak "misc-definitions-in-headers" doc, NFC.Haojian Wu2018-02-051-3/+2
| | | | llvm-svn: 324233
* clang-tidy/rename_check.py misc-incorrect-roundings bugprone-incorrect-roundingsAlexander Kornienko2018-01-302-4/+4
| | | | | | | | More specifically, clang-tidy/rename_check.py misc-incorrect-roundings \ bugprone-incorrect-roundings --check_class_name IncorrectRoundings llvm-svn: 323768
* clang-tidy/rename_check.py misc-string-compare readability-string-compareAlexander Kornienko2018-01-302-5/+5
| | | | llvm-svn: 323766
* add prefix with '_' support for property name. Corresponding apple dev doc: ↵Yan Zhang2018-01-301-0/+9
| | | | | | | | | | | | | | https://developer.apple.com/library/content/qa/qa1908/_index.html Reviewers: benhamilton, hokein Reviewed By: benhamilton Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D42464 llvm-svn: 323722
OpenPOWER on IntegriCloud