| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
| |
variadic function in C++ code. Corresponds to the CERT C++ secure coding rule: https://www.securecoding.cert.org/confluence/display/cplusplus/DCL50-CPP.+Do+not+define+a+C-style+variadic+function
llvm-svn: 249343
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: Add the second template argument to the unique_ptr mock, and update the matcher so that it only matches against cases where the second argument is the default.
Reviewers: klimek
Subscribers: alexfh, cfe-commits
Differential Revision: http://reviews.llvm.org/D13433
llvm-svn: 249305
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: Now that we prioritize copying trivial types over using const-references where possible, I found some cases where, after the transformation, the loop was using the address of the local copy instead of the original object.
Reviewers: klimek
Subscribers: alexfh, cfe-commits
Differential Revision: http://reviews.llvm.org/D13431
llvm-svn: 249300
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
https://llvm.org/bugs/show_bug.cgi?id=24960
modernize-use-nullptr would hit an assertion in some cases involving macros and initializer lists, due to finding a node with more than one parent (the two forms of the initializer list).
However, this doesn't mean that the replacement is incorrect, so instead of just rejecting this case I tried to find a way to make it work. Looking at the semantic form of the InitListExpr made sense to me (looking at both forms results in false negatives) but I am not sure of the things that we can miss by skipping the syntactic form.
Reviewers: klimek
Subscribers: cfe-commits, alexfh
Differential Revision: http://reviews.llvm.org/D13246
llvm-svn: 249291
|
|
|
|
| |
llvm-svn: 249258
|
|
|
|
|
|
| |
+couple more of double-negated !SourceLocation.isInvalid() unfixed in r249228.
llvm-svn: 249235
|
|
|
|
|
|
|
|
| |
build logs do not point to much useful information for tracking this down, such as:
http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/31782/steps/compile/logs/stdio
llvm-svn: 249136
|
|
|
|
|
|
|
|
| |
http://bb.pgr.jp/builders/i686-mingw32-RA-on-linux/builds/2833/steps/build_llvmclang/logs/stdio
Also, drive-by comment fix in a makefile.
llvm-svn: 249133
|
|
|
|
|
|
| |
existing checkers to CERT secure coding rules and recommendations for both C (https://www.securecoding.cert.org/confluence/display/c/SEI+CERT+C+Coding+Standard) and C++ (https://www.securecoding.cert.org/confluence/pages/viewpage.action?pageId=637).
llvm-svn: 249130
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: https://llvm.org/bugs/show_bug.cgi?id=24961.
Reviewers: klimek
Subscribers: cfe-commits, alexfh
Differential Revision: http://reviews.llvm.org/D13381
llvm-svn: 249127
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
declaration.
Summary: This fixes https://llvm.org/bugs/show_bug.cgi?id=17716.
Reviewers: klimek
Subscribers: cfe-commits, alexfh
Differential Revision: http://reviews.llvm.org/D13342
llvm-svn: 249006
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before this check, I would get the following error:
Updating ./misc/CMakeLists.txt...
Creating ./misc/NoReinterpret_castCheck.h...
Creating ./misc/NoReinterpret_castCheck.cpp...
Updating ./misc/MiscTidyModule.cpp...
Creating ../test/clang-tidy/misc-no-reinterpret_cast.cpp...
Creating ../docs/clang-tidy/checks/misc-no-reinterpret_cast.rst...
Traceback (most recent call last):
File "./add_new_check.py", line 271, in <module>
main()
File "./add_new_check.py", line 267, in main
update_checks_list(module_path)
File "./add_new_check.py", line 220, in update_checks_list
os.listdir('docs/clang-tidy/checks')))
OSError: [Errno 2] No such file or directory: 'docs/clang-tidy/checks'
Patch by Matthias Gehre!
Differential revision: http://reviews.llvm.org/D13272
llvm-svn: 248997
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
IdentifierNamingCheck
This diff requires http://reviews.llvm.org/D13079 to be applied first. I wasn't sure about how to make patch series in Phabricator, and I wanted to keep the two separate for clarity.
It looks like that most cases can be supported with this patch. I'm not totally sure about the actual coverage though. I think that the matchers are very generic, but I'm still not totally fluent with the AST.
Patch by Beren Minor!
Differential revision: http://reviews.llvm.org/D13081
llvm-svn: 248996
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This fixes https://llvm.org/bugs/show_bug.cgi?id=22196 .
Also add a non-trivially copyable type to fix some tests that were meant to be about using const-refs, but were changed in r248438.
Reviewers: klimek
Subscribers: alexfh, cfe-commits
Differential Revision: http://reviews.llvm.org/D13292
llvm-svn: 248994
|
|
|
|
|
|
| |
non-copyable C type is being dereferenced, such as FILE or pthread_mutex_t. Corresponds to the CERT C++ secure coding rule: https://www.securecoding.cert.org/confluence/display/c/FIO38-C.+Do+not+copy+a+FILE+object
llvm-svn: 248907
|
|
|
|
| |
llvm-svn: 248895
|
|
|
|
|
|
| |
overloads of operator new and operator delete. Corresponds to the CERT C++ secure coding rule: https://www.securecoding.cert.org/confluence/display/cplusplus/DCL54-CPP.+Overload+allocation+and+deallocation+functions+as+a+pair+in+the+same+scope
llvm-svn: 248791
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: create a check that replaces 'std::unique_ptr<type>(new type(args...))' with 'std::make_unique<type>(args...)'. It was on the list of "Ideas for new Tools". It needs to be tested more carefully, but first I wanted to know if you think it is worth the effort.
Reviewers: klimek
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D13166
llvm-svn: 248785
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
compile_commands.json is usually generated in the build directory.
Projects like LLVM/Clang enforce out-of-source builds.
This option allow allow such projects to work out of the box, without
moving the compilation database manually.
The naming of the option is similar to the one use by other tools:
clang-{check,modernize,query,rename,tidy} -p=<build_path> <...>
Reviewers: alexfh
Differential Revision: http://reviews.llvm.org/D13199
llvm-svn: 248723
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is to level the ground a little bit, in preparation for the changes in http://reviews.llvm.org/D13081.
Code factorization replaces all insertions to NamingCheckFailures map with a unique addUsage function that does the job.
There is also no more difference between the declaration and the references to a given identifier, both cases are treated as ranges in the Usage vector. There is also a check to avoid duplicated ranges to be inserted, which sometimes triggered erroneous replacements.
References can now also be added before the declaration of the identifier is actually found; this looks to be the case for example when a templated class uses its parameters to specialize its templated base class.
Patch by Beren Minor!
Differential revision: http://reviews.llvm.org/D13079
llvm-svn: 248700
|
|
|
|
| |
llvm-svn: 248594
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: Add an option to specify wich style must be followed when choosing the new index name.
Reviewers: alexfh
Subscribers: cfe-commits, klimek
Differential Revision: http://reviews.llvm.org/D13052
llvm-svn: 248517
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: Remove parenthesis surrounding the new loop index.
Reviewers: klimek
Subscribers: cfe-commits, klimek
Differential Revision: http://reviews.llvm.org/D13133
llvm-svn: 248507
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: Solve comment on rL248418.
Reviewers: alexfh
Subscribers: cfe-commits, klimek
Differential Revision: http://reviews.llvm.org/D13129
llvm-svn: 248489
|
|
|
|
| |
llvm-svn: 248449
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, we would rewrite:
void f(const vector<int> &v) {
for (size_t i = 0; i < v.size(); ++i) {
to
for (const auto &elem : v) {
Now we rewrite it to:
for (auto elem : v) {
(and similarly for iterator based loops).
llvm-svn: 248438
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously we would use a non-const loop variable in the range-based
loop for:
void f(const std::vector<int> &v) {
for (size_t i = 0; i < v.size(); ++i) {
Now we use const auto&.
Note that we'll also want to use a copy at least for simple types.
llvm-svn: 248418
|
|
|
|
| |
llvm-svn: 248252
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: Reorder the code in a more logical and understandable way.
Reviewers: klimek
Subscribers: cfe-commits, alexfh
Differential Revision: http://reviews.llvm.org/D12797
llvm-svn: 248144
|
|
|
|
|
|
| |
32-bit integer. NFC
llvm-svn: 248139
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Scripts are installed in same location as clang-fromat ones, so I think will be good idea to not create dedicated directory.
I checked this patch on my own build on RHEL 6.
Please check it in if it's OK, because I don't have SVN write access.
I think will be good idea to backport this patch to 3.7 release branch.
Probably same should be done for configure build.
Patch by Eugene Zelenko!
Differential revision: http://reviews.llvm.org/D12700
llvm-svn: 247890
|
|
|
|
|
|
| |
correlates to r247885 which performs the AST matcher rename in Clang.
llvm-svn: 247886
|
|
|
|
| |
llvm-svn: 247812
|
|
|
|
|
|
|
|
| |
test for a false positive
This should be NFC.
llvm-svn: 247806
|
|
|
|
| |
llvm-svn: 247803
|
|
|
|
| |
llvm-svn: 247792
|
|
|
|
| |
llvm-svn: 247682
|
|
|
|
|
|
|
| |
This turned out to be a rather noisy check, so automated fixes will only do
harm. Remove them completely.
llvm-svn: 247578
|
|
|
|
| |
llvm-svn: 247559
|
|
|
|
| |
llvm-svn: 247536
|
|
|
|
|
|
|
| |
It's fine to use sizeof on std::bitset<>, since it doesn't have any external
storage, everything's inside.
llvm-svn: 247489
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
1. Avoid converting loops that iterate over the size of a container and don't use its elements, as this would result in an unused-result warning.
2. Never capture the elements by value on lambdas, thus avoiding doing unnecessary copies and errors with non-copyable types.
3. The 'const auto &' instead of 'auto &' substitution on const containers now works on arrays and pseudoarrays as well.
4. The error about multiple replacements in the same macro call is now documented in the tests (not solved though).
5. Due to [1], I had to add a dummy usage of the range element (like "(void) *It;" or similars) on the tests that had empty loops.
6. I removed the braces from the CHECK comments. I think that there is no need for them, and they confuse vim.
Reviewers: klimek
Subscribers: alexfh, cfe-commits
Differential Revision: http://reviews.llvm.org/D12734
llvm-svn: 247399
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
containers.
Summary:
sizeof(some_std_string) is likely to be an error. This check finds this
pattern and suggests using .size() instead.
Reviewers: djasper, klimek, aaron.ballman
Subscribers: aaron.ballman, cfe-commits
Differential Revision: http://reviews.llvm.org/D12759
llvm-svn: 247297
|
|
|
|
|
|
| |
+ some console logging and minor cleanups.
llvm-svn: 247282
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is first of series of patches, porting code from my project colobot-lint,
as I mentioned recently in cfe-dev mailing list.
This patch adds a new check in readability module:
readability-inconsistent-declaration-parameter-name. I also added appropriate
testcases and documentation.
I chose readability module, as it seems it is the best place for it.
I think I followed the rules of LLVM coding guideline, but I may have missed
something, as I usually use other code formatting style.
http://reviews.llvm.org/D12462
Patch by Piotr Dziwinski!
llvm-svn: 247261
|
|
|
|
|
|
|
|
|
|
|
| |
Fix http://llvm.org/PR22785. Bug 22785 - readability-braces-around-statements
doesn't work well with macros.
http://reviews.llvm.org/D12729
Patch by Marek Kurdej!
llvm-svn: 247163
|
|
|
|
|
|
|
|
|
|
|
|
| |
Do not add "-*" to the list of checks. Make consistent the list of enabled
checks and the checks in use. Moreover, removing "-*" makes the behaviour
consistent with clang-tidy and allows user to use .clang-tidy configuration...
http://reviews.llvm.org/D12687
Patch by Marek Kurdej!
llvm-svn: 247002
|
|
|
|
| |
llvm-svn: 246996
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
When the dereference operator returns a value that is trivially
copyable (like a pointer), copy it. After this change, modernize-loop-convert
check can be applied to the whole llvm source code without breaking any build
or test.
Reviewers: alexfh, klimek
Subscribers: alexfh, cfe-commits
Differential Revision: http://reviews.llvm.org/D12675
llvm-svn: 246989
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: The InitListExpr subtree is visited twice, this caused the check to do multiple replacements. Added a set to avoid it.
Reviewers: klimek, alexfh
Subscribers: cfe-commits, alexfh
Differential Revision: http://reviews.llvm.org/D12631
llvm-svn: 246879
|