summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/docs
Commit message (Collapse)AuthorAgeFilesLines
* Add new website to release notes.Sam McCall2020-03-161-0/+2
|
* ReleaseNotes: remove in-progress warnings, tidy up a bitHans Wennborg2020-02-281-52/+8
|
* [docs] clangd release notesSam McCall2020-02-251-1/+44
|
* Added readability-qualified-auto checkNathan James2020-01-144-0/+87
| | | | | | | | Adds a check that detects any auto variables that are deduced to a pointer or a const pointer then adds in the const and asterisk according. Will also check auto L value references that could be written as const. This relates to the coding standard https://llvm.org/docs/CodingStandards.html#beware-unnecessary-copies-with-auto
* clang-tidy doc: unbreak the CISylvestre Ledru2020-01-101-0/+2
|
* clang-tidy doc: Refresh the list of checkers and polish the scriptSylvestre Ledru2020-01-101-29/+26
|
* Restore order in clang-tidy section of release notesHans Wennborg2020-01-101-49/+61
| | | | | | | | Major changes are introduction of subsubsections to prevent people putting new entries in wrong places. I also polished line length and highlighting. Patch by Eugene Zelenko!
* clang-tidy doc - remove the widthsSylvestre Ledru2020-01-101-2/+0
|
* [clang-tidy] modernize-use-using uses AST and now supports struct defintions ↵Mitchell Balan2020-01-072-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | and multiple types in a typedef Summary: It now handles `typedef`s that include comma-separated multiple types, and handles embedded struct definitions, which previously could not be automatically converted. For example, with this patch `modernize-use-using` now can convert: typedef struct { int a; } R_t, *R_p; to: using R_t = struct { int a; }; using R_p = R_t*; `-ast-dump` showed that the `CXXRecordDecl` definitions and multiple `TypedefDecl`s come consecutively in the tree, so `check()` stores information between calls to determine when it is receiving a second or additional `TypedefDecl` within a single `typedef`, or when the current `TypedefDecl` refers to an embedded `CXXRecordDecl` like a `struct`. Reviewers: alexfh, aaron.ballman Patch by: poelmanc Subscribers: riccibruno, sammccall, cfe-commits, aaron.ballman Tags: clang-tools-extra, clang Differential Revision: https://reviews.llvm.org/D70270
* [clang-tidy] new check: bugprone-signed-char-misuseTamás Zolnai2020-01-063-0/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This check searches for signed char -> integer conversions which might indicate programming error, because of the misinterpretation of char values. A signed char might store the non-ASCII characters as negative values. The human programmer probably expects that after an integer conversion the converted value matches with the character code (a value from [0..255]), however, the actual value is in [-128..127] interval. See also: STR34-C. Cast characters to unsigned char before converting to larger integer sizes <https://wiki.sei.cmu.edu/confluence/display/c/STR34-C.+Cast+characters+to+unsigned+char+before+converting+to+larger+integer+sizes> By now this check is limited to assignment / variable declarations. If we would catch all signed char -> integer conversion, then it would produce a lot of findings and also false positives. So I added only this use case now, but this check can be extended with additional use cases later. The CERT documentation mentions another use case when the char is used for array subscript. Next to that a third use case can be the signed char - unsigned char comparison, which also a use case where things happen unexpectedly because of conversion to integer. Reviewers: alexfh, hokein, aaron.ballman Reviewed By: aaron.ballman Subscribers: sylvestre.ledru, whisperity, Eugene.Zelenko, mgorny, xazax.hun, cfe-commits Tags: #clang, #clang-tools-extra Differential Revision: https://reviews.llvm.org/D71174
* NFC: Fix trivial typos in commentsKazuaki Ishizaki2020-01-044-4/+4
|
* Fix trivial typos in comments; NFCKazuaki Ishizaki2020-01-021-1/+1
|
* [docs] Update path to clang-tools-extraAlexander Lanin2020-01-023-40/+40
| | | | | | | | | | | | | | | | | | Summary: > tools/clang/tools/extra has become >clang-tools-extra which was not updated in all docs. Reviewers: alexfh, aaron.ballman, ilya-biryukov, juliehockett Reviewed By: aaron.ballman Subscribers: Jim, cfe-commits Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D71982
* clang-tidy doc: Remove severities as they don't make consensusSylvestre Ledru2020-01-011-392/+388
| | | | | | | | | | | | Reviewers: jdoerfert, aaron.ballman Reviewed By: aaron.ballman Subscribers: whisperity, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D72049
* clang-tidy doc: modernize-make-unique has an autofixSylvestre Ledru2019-12-311-1/+1
|
* Fix false positive in magic number checker.Florin Iucha2019-12-241-0/+4
| | | | | cppcoreguidelines-avoid-magic-numbers should not warn about enum class. Fixes PR40640.
* doc: Document that extra-arg/extra-arg-before can be used several timesSylvestre Ledru2019-12-243-0/+6
| | | | Hopefully, it will help other people
* clang-doc remove trailing whitespacesSylvestre Ledru2019-12-241-3/+3
|
* Move from a long list of checkers to tablesSylvestre Ledru2019-12-231-384/+404
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Currently, the list isn't very useful. This change adds two tables. * The checkers * The aliases For each checkers, we provide extract info: * the severity. Taken from codechecker - https://github.com/Ericsson/codechecker/blob/master/config/checker_severity_map.json * if the checker has an autofix or not I used the cvs format for the table because: * it is easy * the data could be reused by other tools (we could move that into a separated / generated file at some point) Reviewers: alexfh, jdoerfert, jfb, lebedev.ri, Eugene.Zelenko Subscribers: dexonsmith, wuzish, nemanjai, kbarton, arphaman, lebedev.ri, whisperity, Eugene.Zelenko, JonasToth, JDevlieghere, xazax.hun, cfe-commits, #clang-tools-extra Tags: #clang Differential Revision: https://reviews.llvm.org/D36051
* Fix the links to clang analyzers checkersSylvestre Ledru2019-12-191-64/+64
|
* Fix some typos in the clang-tools-extra docSylvestre Ledru2019-12-1918-24/+24
|
* [clang-tidy] Add cert-oop58-cpp checkGabor Bencze2019-12-153-0/+18
| | | | | | | | The check warns when (a member of) the copied object is assigned to in a copy constructor or copy assignment operator. Based on https://wiki.sei.cmu.edu/confluence/display/cplusplus/OOP58-CPP.+Copy+operations+must+not+mutate+the+source+object Differential Revision: https://reviews.llvm.org/D70052
* Optionally exclude bitfield definitions from magic numbers checkFlorin Iucha2019-12-072-0/+11
| | | | Adds the IgnoreBitFieldsWidths option to readability-magic-numbers.
* [clang-tidy] Rewrite modernize-avoid-bind check.Zachary Turner2019-12-022-3/+62
| | | | | | | | | | | | | | | | | | | This represents largely a full re-write of modernize-avoid-bind, adding significant new functionality in the process. In particular: * Both boost::bind and std::bind are now supported * Function objects are supported in addition to functions * Member functions are supported * Nested calls are supported using capture-init syntax * std::ref() and boost::ref() are now recognized, and will capture by reference. * Rather than capturing with a global =, we now build up an individual capture list that is both necessary and sufficient for the call. * Fixits are supported in a much larger variety of scenarios than before. All previous tests pass under the re-write, but a large number of new tests have been added as well. Differential Revision: https://reviews.llvm.org/D70368
* [clang-tidy] new performance-no-automatic-move check.Clement Courbet2019-11-223-0/+59
| | | | | | | | | | | | Summary: The check flags constructs that prevent automatic move of local variables. Reviewers: aaron.ballman Subscribers: mgorny, xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70390
* [clang-tidy] modernize-use-equals-default avoid adding redundant semicolonsMitchell Balan2019-11-201-0/+4
| | | | | | | | | | | | | | | | | | | Summary: `modernize-use-equals-default` replaces default constructors/destructors with `= default;`. When the optional semicolon after a member function is present, this results in two consecutive semicolons. This patch checks to see if the next non-comment token after the code to be replaced is a semicolon, and if so offers a replacement of `= default` rather than `= default;`. This patch adds trailing comments and semicolons to about 5 existing tests. Reviewers: malcolm.parsons, angelgarcia, aaron.ballman, alexfh Patch by: poelmanc Subscribers: MyDeveloperDay, JonasToth, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70144
* [NFC] Attempting to fix sphinx build failure with badly encoded characters ↵Mitchell Balan2019-11-191-1/+1
| | | | from incoming patch.
* [NFC] Attempting to fix sphinx build failure with badly encoded characters ↵Mitchell Balan2019-11-191-1/+1
| | | | from incoming patch.
* [clang-tidy] Give readability-redundant-member-init an option ↵Mitchell Balan2019-11-192-1/+33
| | | | | | | | | | | | | | | | | | | IgnoreBaseInCopyConstructors to avoid breaking code with gcc -Werror=extra Summary: readability-redundant-member-init removes redundant / unnecessary member and base class initialization. Unfortunately for the specific case of a copy constructor's initialization of a base class, gcc at strict warning levels warns if "base class is not initialized in the copy constructor of a derived class". This patch adds an option `IgnoreBaseInCopyConstructors` defaulting to 0 (thus maintaining current behavior by default) to skip the specific case of removal of redundant base class initialization in the copy constructor. Enabling this option enables the resulting code to continue to compile successfully under `gcc -Werror=extra`. New test cases `WithCopyConstructor1` and `WithCopyConstructor2` in clang-tools-extra/test/clang-tidy/readability-redundant-member-init.cpp show that it removes redundant members even from copy constructors. Reviewers: malcolm.parsons, alexfh, hokein, aaron.ballman, lebedev.ri Patch by: poelmanc Subscribers: mgehre, lebedev.ri, cfe-commits Tags: #clang, #clang-tools-extra Differential revision: https://reviews.llvm.org/D69145
* [clang-tidy] modernize-use-override new option AllowOverrideAndFinalMitchell Balan2019-11-192-0/+14
| | | | | | | | | | | | | | | | | | | Summary: In addition to adding `override` wherever possible, clang-tidy's `modernize-use-override` nicely removes `virtual` when `override` or `final` is specified, and further removes override when final is specified. While this is great default behavior, when code needs to be compiled with gcc at high warning levels that include `gcc -Wsuggest-override` or `gcc -Werror=suggest-override`, clang-tidy's removal of the redundant `override` keyword causes gcc to emit a warning or error. This discrepancy / conflict has been noted by others including a comment on Stack Overflow and by Mozilla's Firefox developers. This patch adds an AllowOverrideAndFinal option defaulting to 0 - thus preserving current behavior - that when enabled allows both `override` and `final` to co-exist, while still fixing all other issues. The patch includes a test file verifying all combinations of virtual/override/final, and mentions the new option in the release notes. Reviewers: alexfh, djasper, JonasToth Patch by: poelmanc Subscribers: JonasToth, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70165
* Revert "[clang-tidy] Fix readability-redundant-string-init for c++17/c++2a"Mitchell Balan2019-11-192-14/+0
| | | | This reverts commit 06f3dabe4a2e85a32ade27c0769b6084c828a206.
* [clang-tidy] Added DefaultOperatorNewCheck.Balázs Kéri2019-11-193-0/+23
| | | | | | | | | | | | | | | | Summary: Added new checker 'cert-default-operator-new' that checks for CERT rule MEM57-CPP. Simple version. Reviewers: aaron.ballman, alexfh, JonasToth, lebedev.ri Reviewed By: aaron.ballman Subscribers: hiraditya, martong, mehdi_amini, mgorny, inglorion, xazax.hun, dkrupp, steven_wu, dexonsmith, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67545
* [clang-tidy] Give readability-redundant-string-init a customizable list of ↵Mitchell Balan2019-11-152-1/+18
| | | | | | | | | | | | | | | | | | | string types to fix Summary: This patch adds a feature requested in https://reviews.llvm.org/D69238 to enable `readability-redundant-string-init` to take a list of strings to apply the fix to rather than hard-coding `basic_string`. It adds a `StringNames` option of semicolon-delimited names of string classes to which to apply this fix. Tests ensure this works with test class out::TestString as well as std::string and std::wstring as before. It should be applicable to llvm::StringRef, QString, etc. Note: This commit was previously reverted due to a failing unit test. That test has been fixed in this version. Reviewers: MyDeveloperDay, aaron.ballman, hokein, alexfh, JonasToth, gribozavr2 Patch by: poelmanc Subscribers: gribozavr2, xazax.hun, Eugene.Zelenko, cfe-commits Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D69548
* [clang-tidy] Fix readability-redundant-string-init for c++17/c++2aMitchell Balan2019-11-152-0/+14
| | | | | | | | | | | | | | | | | | | Summary: `readability-redundant-string-init` was one of several clang-tidy checks documented as failing for C++17. (The failure mode in C++17 is that it changes `std::string Name = ""`; to `std::string Name = Name;`, which actually compiles but crashes at run-time.) Analyzing the AST with `clang -Xclang -ast-dump` showed that the outer `CXXConstructExprs` that previously held the correct SourceRange were being elided in C++17/2a, but the containing `VarDecl` expressions still had all the relevant information. So this patch changes the fix to get its source ranges from `VarDecl`. It adds one test `std::string g = "u", h = "", i = "uuu", j = "", k;` to confirm proper warnings and fixit replacements in a single `DeclStmt` where some strings require replacement and others don't. The readability-redundant-string-init.cpp and readability-redundant-string-init-msvc.cpp tests now pass for C++11/14/17/2a. Reviewers: gribozavr, etienneb, alexfh, hokein, aaron.ballman, gribozavr2 Patch by: poelmanc Subscribers: NoQ, MyDeveloperDay, Eugene.Zelenko, dylanmckay, cfe-commits Tags: #clang, #clang-tools-extra Differential Revision: https://reviews.llvm.org/D69238
* Revert "[clang-tidy] Give readability-redundant-string-init a customizable ↵Mitchell Balan2019-11-152-18/+1
| | | | | | list of string types to fix" This reverts commit 96fbc32cb9ea23b1e7e3ff6906ec3ccda9500982.
* [clang-tidy] Give readability-redundant-string-init a customizable list of ↵Mitchell Balan2019-11-152-1/+18
| | | | | | | | | | | | | | | | | string types to fix Summary: This patch adds a feature requested in https://reviews.llvm.org/D69238 to enable `readability-redundant-string-init` to take a list of strings to apply the fix to rather than hard-coding `basic_string`. It adds a `StringNames` option of semicolon-delimited names of string classes to which to apply this fix. Tests ensure this works with test class out::TestString as well as std::string and std::wstring as before. It should be applicable to llvm::StringRef, QString, etc. Reviewers: MyDeveloperDay, aaron.ballman, hokein, alexfh, JonasToth, gribozavr2 Patch by: poelmanc Subscribers: gribozavr2, xazax.hun, Eugene.Zelenko, cfe-commits Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D69548
* Fix filename typo in rG8d288a0668a5Simon Pilgrim2019-11-111-2/+2
|
* [clang-tidy] Add bugprone-bad-signal-to-kill-thread check and its alias ↵Abel Kocsis2019-11-114-0/+38
| | | | cert-pos44-c
* Revert "[clang-tidy] Add bugprone-bad-signal-to-kill-thread checker and ↵Abel Kocsis2019-11-114-38/+0
| | | | | | alias cert-pos44-c" This reverts commit 4edf0cb0e03e31d468979d0d7dec08bd9f4f8204.
* [clang-tidy] Add bugprone-bad-signal-to-kill-thread checker and alias ↵Abel Kocsis2019-11-114-0/+38
| | | | cert-pos44-c
* [clang-tidy] Add readability-make-member-function-constMatthias Gehre2019-11-063-0/+74
| | | | | | | | | | | | | | | | | | Summary: Finds non-static member functions that can be made ``const`` because the functions don't use ``this`` in a non-const way. The check conservatively tries to preserve logical costness in favor of physical costness. See readability-make-member-function-const.rst for more details. Reviewers: aaron.ballman, gribozavr, hokein, alexfh Subscribers: mgorny, xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68074
* [clang-tidy] New checker performance-trivially-destructible-checkAnton Bikineev2019-11-013-0/+22
| | | | | | | | | | | | | Checks for types which can be made trivially-destructible by removing out-of-line defaulted destructor declarations. The check is motivated by the work on C++ garbage collector in Blink (rendering engine for Chrome), which strives to minimize destructors and improve runtime of sweeping phase. In the entire chromium codebase the check hits over 2000 times. Differential Revision: https://reviews.llvm.org/D69435
* [clang-tidy] Regenerate clang-tidy check list 📋Stephane Moore2019-10-301-65/+64
| | | | | | | | | | | | | | | | | Summary: These changes were generated by invoking clang-tools-extra/clang-tidy/add_new_check.py and then reverting the check that was added. Reviewers: aaron.ballman Reviewed By: aaron.ballman Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69414
* Add an option to hicpp-signed-bitwise for positive integer literals.Vladimir Plyashkun2019-10-302-0/+13
| | | | | This gives developers a way to deviate from the coding standard to reduce the chattiness of the check.
* Move this release note to its appropriate location; NFC.Aaron Ballman2019-10-301-5/+5
|
* Add the readability-redundant-access-specifiers check.Aaron Ballman2019-10-303-0/+58
| | | | | | This finds redundant access specifier declarations inside classes, structs, and unions. Patch by Mateusz Mackowski.
* [clang-tidy] bugprone-not-null-terminated-result: Sphinx adjustments 2Csaba Dabis2019-10-131-17/+21
| | | | llvm-svn: 374710
* [clang-tidy] bugprone-not-null-terminated-result: Sphinx adjustmentsCsaba Dabis2019-10-131-15/+16
| | | | llvm-svn: 374709
* [clang-tidy] New checker for not null-terminated result caused by strlen(), ↵Csaba Dabis2019-10-133-0/+137
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | size() or equal length Summary: New checker called bugprone-not-null-terminated-result. This checker finds function calls where it is possible to cause a not null-terminated result. Usually the proper length of a string is `strlen(src) + 1` or equal length of this expression, because the null terminator needs an extra space. Without the null terminator it can result in undefined behaviour when the string is read. The following and their respective `wchar_t` based functions are checked: `memcpy`, `memcpy_s`, `memchr`, `memmove`, `memmove_s`, `strerror_s`, `strncmp`, `strxfrm` The following is a real-world example where the programmer forgot to increase the passed third argument, which is `size_t length`. That is why the length of the allocated memory is not enough to hold the null terminator. ``` static char *stringCpy(const std::string &str) { char *result = reinterpret_cast<char *>(malloc(str.size())); memcpy(result, str.data(), str.size()); return result; } ``` In addition to issuing warnings, fix-it rewrites all the necessary code. It also tries to adjust the capacity of the destination array: ``` static char *stringCpy(const std::string &str) { char *result = reinterpret_cast<char *>(malloc(str.size() + 1)); strcpy(result, str.data()); return result; } ``` Note: It cannot guarantee to rewrite every of the path-sensitive memory allocations. Reviewed By: JonasToth, aaron.ballman, whisperity, alexfh Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D45050 llvm-svn: 374707
* Add the misc-init-local-variables check.Aaron Ballman2019-10-023-6/+61
| | | | | | | | This checks finds all primitive type local variables (integers, doubles, pointers) that are declared without an initial value. Includes fixit functionality to initialize said variables with a default value. This is zero for most types and NaN for floating point types. The use of NaNs is copied from the D programming language. Patch by Jussi Pakkanen. llvm-svn: 373489
OpenPOWER on IntegriCloud