aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/clang-tidy/modernize/AvoidCArraysCheck.cpp
AgeCommit message (Collapse)AuthorFilesLines
2024-09-19[clang-tidy][NFC] add qutation mark for C++ classes in warning message (#109068)Congcong Cai1-5/+5
As discussion in https://github.com/llvm/llvm-project/pull/108555#discussion_r1761841192, split quotation mark change in a new NFC PR. It is more readable to use `'std::array'` than `std::array<>`
2024-09-18[clang-tidy]suggest use `std::span` as replacement of c array in C++20 for ↵Congcong Cai1-4/+23
modernize-avoid-c-arrays (#108555) The incompleted C-Array in parameter does not own memory. Instead, It is equivalent to pointer. So we should not use `std::array` as recommended modern C++ replacement, but use `std::vector` and `std::span` in C++20
2024-03-31Revert "[clang-tidy][NFC] Remove duplicated code"Piotr Zegar1-1/+9
This reverts commit b6f6be4b500ff64c23a5103ac3311cb74519542f.
2024-03-31[clang-tidy][NFC] Remove duplicated codePiotr Zegar1-9/+1
Remove duplicated matchers by moving some of them to utils/Matchers.h. Add some anonymous namespaces and renamed some code to avoid ODR issues.
2024-02-01[clang-tidy] Add AllowStringArrays option to modernize-avoid-c-arrays (#71701)Piotr Zegar1-2/+20
Add AllowStringArrays option, enabling the exclusion of array types with deduced sizes constructed from string literals. This includes only var declarations of array of characters constructed directly from c-strings. Closes #59475
2023-01-14[clang-tidy][NFC] Use C++17 nested namespaces in the clang-tidy folderCarlos Galvez1-6/+2
Fix applied by running: run-clang-tidy.py -checks=-*,modernize-concat-nested-namespaces Differential Revision: https://reviews.llvm.org/D141770
2021-02-26[clang-tidy][NFC] Tweak some generation of diag messagesNathan James1-6/+3
Fix up cases where diag is called by piecing together a string in favour of placeholders. Fix up cases where select could be used instead of duplicating the message for sake of 1 word difference. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D97488
2020-03-03[clang-tidy] Change checks to use new isLanguageVersionSupported restrictionNathan James1-4/+0
Summary: Modifies all checks that are language version dependent to use `isLanguageVersionSupported` Reviewers: jdoerfert, lebedev.ri, aaron.ballman, gribozavr2, Eugene.Zelenko Reviewed By: gribozavr2 Subscribers: wuzish, nemanjai, xazax.hun, hiraditya, kbarton, steven_wu, dexonsmith, arphaman, lebedev.ri, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D75340
2020-01-04NFC: Fix trivial typos in commentsKazuaki Ishizaki1-1/+1
2019-02-06[clang-tidy] modernize-avoid-c-arrays: avoid main function (PR40604)Roman Lebedev1-1/+8
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
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth1-4/+3
to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
2018-11-14[clang-tidy] Avoid C arrays checkRoman Lebedev1-0/+69
Summary: [[ https://bugs.llvm.org/show_bug.cgi?id=39224 | PR39224 ]] As discussed, we can't always do the transform automatically due to that array-to-pointer decay of C array. In order to detect whether we can do said transform, we'd need to be able to see all usages of said array, which is, i would say, rather impossible if e.g. it is in the header. Thus right now no fixit exists. Exceptions: `extern "C"` code. References: * [[ https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#es27-use-stdarray-or-stack_array-for-arrays-on-the-stack | CPPCG ES.27: Use std::array or stack_array for arrays on the stack ]] * [[ https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#slcon1-prefer-using-stl-array-or-vector-instead-of-a-c-array | CPPCG SL.con.1: Prefer using STL array or vector instead of a C array ]] * HICPP `4.1.1 Ensure that a function argument does not undergo an array-to-pointer conversion` * MISRA `5-2-12 An identifier with array type passed as a function argument shall not decay to a pointer` Reviewers: aaron.ballman, JonasToth, alexfh, hokein, xazax.hun Reviewed By: JonasToth Subscribers: Eugene.Zelenko, mgorny, rnkovacs, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D53771 llvm-svn: 346835