summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/check_clang_tidy.py
Commit message (Collapse)AuthorAgeFilesLines
* Moved -fblocks from an individual test to check_clang_tidy.pyDmitri Gribenko2019-09-271-1/+2
| | | | | | | This way, all tests will benefit from it and will not have to worry about setting up language options properly. llvm-svn: 373066
* Run ClangTidy tests in all C++ language modesDmitri Gribenko2019-05-201-22/+51
| | | | | | | | | | | | | | | | | | | | | | | Summary: I inspected every test and did one of the following: - changed the test to run in all language modes, - added a comment explaining why the test is only applicable in a certain mode, - limited the test to language modes where it passes and added a FIXME to fix the checker or the test. Reviewers: alexfh, lebedev.ri Subscribers: nemanjai, kbarton, arphaman, jdoerfert, lebedev.ri, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62125 llvm-svn: 361131
* check_clang_tidy.py now passes `-format-style=none` to clang_tidyDmitri Gribenko2019-05-091-7/+19
| | | | | | | | | | | | | | | | | Summary: If the test does not specify a formatting style, force "none"; otherwise autodetection logic can discover a ".clang-tidy" file that is not related to the test. Reviewers: alexfh Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61739 llvm-svn: 360358
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-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
* [clang-tidy] Fix check_clang_tidy.py trivially passing default CHECKZinovy Nis2018-10-121-35/+31
| | | | | | Differential Revision: https://reviews.llvm.org/D53194 llvm-svn: 344343
* [clang-tidy] The patch extends the existing command line option -check-suffix Zinovy Nis2018-10-091-23/+54
| | | | | | | | | | | | | | (with alias -check-suffixes) to accept multiple comma-separated FileCheck prefixes. Usage: // RUN: %check_clang_tidy -check-suffix=USING-C,USING-D %s misc-unused-using-decls %t -- -- ... or for the same: // RUN: %check_clang_tidy -check-suffixes=USING-C,USING-D %s misc-unused-using-decls %t -- -- ... Differential Revision: https://reviews.llvm.org/D52971 llvm-svn: 344015
* [clang-tidy] fix failing unit testsJonas Toth2018-10-041-1/+1
| | | | | | | | The removal from the FIX-IT notes through the check-clang-tidy script was done incorrect. I did not detect beforehand but adjusted the script and tests accordingly llvm-svn: 343797
* [clang-tidy] NFC use CHECK-NOTES in tests for performance-move-constructor-initJonas Toth2018-10-041-1/+3
| | | | | | | | | | | | Reviewers: alexfh, aaron.ballman, hokein Reviewed By: alexfh Subscribers: lebedev.ri, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D52691 llvm-svn: 343791
* [clang-tidy] fix check_clang_tidy to forbid mixing of CHECK-NOTES and ↵Jonas Toth2018-08-301-0/+3
| | | | | | | | | | | | | | | | | | | CHECK-MESSAGES Summary: The check_clang_tidy.py script would allow mixing of `CHECK-NOTES` and `CHECK-MESSAGES` but running `FileCheck` for that would implicitly fail, because `CHECK-NOTES` bails out if there is a warning. That means a clang-tidy test can not mix these constructs to check warnings with `CHECK-MESSAGES` and notes with `CHECK-NOTES`. The script gives now a clear error if that happens. Reviewers: alexfh, aaron.ballman, lebedev.ri, hokein Reviewed By: lebedev.ri Subscribers: xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D51381 llvm-svn: 341039
* [clang-tidy] check_clang_tidy.py: support CHECK-NOTES prefixRoman Lebedev2018-08-101-2/+18
| | | | | | | | | | | | | | | | | | | | Summary: Currently, there is two configured prefixes: `CHECK-FIXES` and `CHECK-MESSAGES` `CHECK-MESSAGES` checks that there are no test output lines with `warning:|error:`, which are not explicitly handled in lit tests. However there does not seem to be a nice way to enforce for all the `note:` to be checked. This was useful for me when developing D36836. Reviewers: alexfh, klimek, aaron.ballman, hokein Reviewed By: alexfh, aaron.ballman Subscribers: JonasToth, JDevlieghere, xazax.hun, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D36892 llvm-svn: 339437
* [clang-tidy] Customize FileCheck prefix in check_clang-tidy.pyZinovy Nis2018-04-211-8/+17
| | | | | | | | | | | | | | | | | | | 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] Return non-zero exit code for clang errors.Alexander Kornienko2018-04-091-0/+4
| | | | | | | | | | | | | | | | Summary: Updated tests broken by this change. Fixes https://bugs.llvm.org/show_bug.cgi?id=27628 Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: klimek, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D45258 llvm-svn: 329579
* Support Objective-C/C++ source files in check_clang_tidy.pyHaojian Wu2017-10-181-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | check_clang_tidy.py currently only handles C and C++ source files. This extends the logic to also handle Objective-C (.m) and Objective-C++ (.mm) files. However, by default, clang compiles .m/.mm files using Objective-C 1.0 syntax. Objective-C 2.0 has been the default in Xcode for about 10 years, and Objective-C Automatic Reference Counting (ARC) for about 6 years, so this enables both by default. (Clients which actually want to test clang-tidy checks for Objective-C 1.0 or non-ARC files can pass custom flags to check_clang_tidy.py after --, which will disable the Objective-C 2.0 and ARC flags). I did not add logic to handle running clang-tidy on Objective-C header files alone; they also use the .h file extension, so we'd need to look inside their contents. I included a new test to confirm the new behavior. Depends On D38963 Patch by Ben Hamilton! llvm-svn: 316090
* New -assume-filename=param to check_clang_tidy.py (like clang-format)Haojian Wu2017-10-181-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Currently, check_clang_tidy.py includes logic to select default clang flags based on the extension of the source filename passed as the first argument. Since the source filename might be a temporary or test file with an arbitrary extension unrelated to the file type, this adds the ability to override the logic the same way `clang-format`'s -assume-filename= parameter does. I included a test with a nonstandard file extension. I confirmed when I modified the warning message that the new test failed, and that it passed again when I restored the warning message. Ran tests with: % cmake -G Ninja /path/to/llvm % ninja check-clang-tools Patch by Ben Hamilton! Reviewers: hokein, alexfh Reviewed By: hokein Subscribers: alexfh Differential Revision: https://reviews.llvm.org/D38963 llvm-svn: 316066
* [clang-tidy] follow-up on misc-definitions-in-header check.Haojian Wu2017-06-291-2/+2
| | | | | | | | | | | | | | | | | Summary: A follow-up on D34449: * add `-std=c++11` to `.hpp` file by default. * add constexpr function to test and doc. Reviewers: alexfh Reviewed By: alexfh Subscribers: JDevlieghere, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D34771 llvm-svn: 306650
* [clang-tidy] Tests should not rely on STL headers being available.Alexander Kornienko2017-03-221-0/+5
| | | | llvm-svn: 298501
* [clang-tidy] Update an example. NFC.Alexander Kornienko2016-04-021-1/+1
| | | | llvm-svn: 265210
* [clang-tidy] Python scripts shebang fixesAlexander Kornienko2016-01-191-1/+1
| | | | | | | | | | | | | | | | | | | Summary: This patch fixes shebang lines in Python script files. Most Python scripts in LLVM & Clang are using this shebang line. [[ https://mail.python.org/pipermail/tutor/2007-June/054816.html | Here]] is an explanaiton of why such line should be used instead of what is currently in these few files. Reviewers: klimek, alexfh Subscribers: cfe-commits Patch by Kirill Bobyrev! Differential Revision: http://reviews.llvm.org/D16270 llvm-svn: 258133
* [clang-tidy] Add non-inline function definition and variable definition ↵Alexander Kornienko2016-01-081-0/+2
| | | | | | | | | | | | | | | | check in header files. Summary: The new check will find all functionand variable definitions which may violate cpp one definition rule in header file. Reviewers: aaron.ballman, alexfh Subscribers: aaron.ballman, cfe-commits Patch by Haojian Wu! Differential Revision: http://reviews.llvm.org/D15710 llvm-svn: 257178
* Switch check_clang_tidy to argparse and add a -resource-dir argument.Manuel Klimek2015-10-221-9/+20
| | | | | | | -resource-dir can be used to inject non-standard resource dirs via the lit site config. llvm-svn: 251021
* Add %check_clang_tidy and %clang_tidy_diff.Manuel Klimek2015-10-221-1/+1
| | | | | | | | | | With this, site specific lit configs can inject parameters into the test scripts if they need site specific parameters. Next up: enable check_clang_tidy to take a resource dir to enable non-standard locations for builtin includes. llvm-svn: 251010
* [clang-tidy] Better diagnostic in tests when clang-tidy fails.Alexander Kornienko2015-09-301-2/+6
| | | | llvm-svn: 248886
* [clang-tidy] Fix minor issues in the testing script.Alexander Kornienko2015-09-111-4/+5
| | | | llvm-svn: 247485
* Help the clang-tidy helper script to understand C files better.Aaron Ballman2015-08-311-2/+6
| | | | llvm-svn: 246494
* [clang-tidy] Use a python script instead of a shell script to run clang-tidy ↵Alexander Kornienko2015-08-201-0/+113
tests. Summary: Add check_clang_tidy.py script that is functionally identical to the check_clang_tidy.py, but should also be functional on windows. I've verified that the script works on linux. Would be nice if folks using Windows could test the patch before I break windows bots ;) Reviewers: chapuni, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D12180 llvm-svn: 245583
OpenPOWER on IntegriCloud