summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/tool
Commit message (Collapse)AuthorAgeFilesLines
* Update for PrintHelpMessage not calling exit.Rafael Espindola2017-09-081-2/+2
| | | | llvm-svn: 312769
* Make run-clang-tidy compatible with Python 3.xKevin Funk2017-09-051-5/+11
| | | | | | | | | | | | | | | Reviewers: alexfh Reviewed By: alexfh Subscribers: cfe-commits, JDevlieghere Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D37138 Change-Id: I89a95d1e082e566e7e64c2a5ca4123c543e6b1be llvm-svn: 312532
* [clang-tidy] Add option to export fixes to run-clang-tidy.pyAlexander Kornienko2017-07-211-8/+46
| | | | | | | | | | | | | | | This patch adds the option to keep the list of proposed fixes even though they should not be applied. This allows to detect possible fixes using the parallelised run-clang-tidy.py and apply them using clang-apply-replacements at a later time. Essentially the patch causes the individual temporary yaml files by the parallel clang-tidy instances to be merged into one user-defined file. Patch by Michael F. Herbst! Differential revision: https://reviews.llvm.org/D31326 llvm-svn: 308726
* [clang-tidy] Add bugprone-suspicious-memset-usage checkGabor Horvath2017-07-142-0/+6
| | | | | | | | | | | | | | | | | | Created new module bugprone and placed the check in that. Finds memset() calls with potential mistakes in their arguments. Replaces and extends the existing google-runtime-memset-zero-length check. Cases covered: * Fill value is a character '0'. Integer 0 might have been intended. * Fill value is out of char range and gets truncated. * Byte count is zero. Potentially swapped with the fill value argument. Patch by: Reka Nikolett Kovacs Differential Revision: https://reviews.llvm.org/D32700 llvm-svn: 308020
* [clang-tidy][Part1] Add a new module Android and three new checks.Yan Wang2017-06-232-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: A common source of security bugs is code that opens a file descriptors without using the O_CLOEXEC flag. (Without that flag, an opened sensitive file would remain open across a fork+exec to a lower-privileged SELinux domain, leaking that sensitive data.). Add a new Android module and one checks in clang-tidy. -- open(), openat(), and open64() should include O_CLOEXEC in their flags argument. [android-file-open-flag] Links to part2 and part3: https://reviews.llvm.org/D33745 https://reviews.llvm.org/D33747 Reviewers: chh, alexfh, aaron.ballman, hokein Reviewed By: alexfh, hokein Subscribers: jbcoe, joerg, malcolm.parsons, Eugene.Zelenko, srhines, mgorny, xazax.hun, cfe-commits, krytarowski Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D33304 llvm-svn: 306165
* [clang-tidy] D33930: Do not pick up by default the LLVM style if passing ↵Vassil Vassilev2017-06-091-0/+4
| | | | | | | | | -format. This adds a new flag -style which is passed to clang-apply-replacements and defaults to file meaning it would pick up the closest .clang-format file in tree. llvm-svn: 305125
* [clang-tidy][CMake] Make clang-tidy usable as distribution componentPetr Hosek2017-05-101-1/+1
| | | | | | | | | Use add_clang_tool rather than add_clang_executable to support clang-tidy as a distribution component. Differential Revision: https://reviews.llvm.org/D32815 llvm-svn: 302688
* [clang-tidy] run-clang-tidy.py: check if clang-apply-replacements succeedsJakub Kuderski2017-04-251-7/+31
| | | | | | | | | | | | | | | | | | | | | | Summary: When running run-clang-tidy.py with -fix it tries to apply found replacements at the end. If there are errors running clang-apply-replacements, the script currently crashes or displays no error at all. This patch checks for errors running clang-apply-replacements the same way clang-tidy binary is handled. Another option would be probably checking for clang-apply-replacements (when -fix is passed) even before running clang-tidy. Reviewers: Prazek, alexfh, bkramer, mfherbst Reviewed By: Prazek, alexfh Subscribers: kimgr, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D32294 llvm-svn: 301365
* Fix clang-tidy shared link with libc++Eric Fiselier2017-04-121-0/+1
| | | | | | | | | | | | | Currently the ClangTidyMain.cpp fails to link against shared LLVM/Clang libraries due to the missing symbol: clang::tooling::operator<(clang::tooling::Replacement const&, clang::tooling::Replacement const&); This patch fixes the issue by correctly linking clangToolingCore which contains the definition. llvm-svn: 300115
* [clang-tidy] Update docs and help messageAlexander Kornienko2017-04-061-1/+4
| | | | llvm-svn: 299651
* [clang-tidy] Add FormatStyle configuration option.Alexander Kornienko2017-04-061-8/+11
| | | | llvm-svn: 299649
* [clang-tidy] Don't use groups in the big regexy filterAlexander Kornienko2017-03-231-1/+1
| | | | | | Fixes https://bugs.llvm.org/show_bug.cgi?id=27641. llvm-svn: 298619
* Rename the clang-tidy safety module to be hicpp, for the High-Integrity C++ ↵Aaron Ballman2017-03-192-5/+5
| | | | | | | | coding standard from PRQA. This commit renames all of the safety functionality to be hicpp, adds an appropriate LICENSE.TXT, and updates the documentation accordingly. llvm-svn: 298229
* [clang-tidy] Format code around applied fixesAlexander Kornienko2017-03-031-7/+15
| | | | | | | | | | | | | | | | Summary: Add -format option (disabled by default for now) to trigger formatting of replacements. Reviewers: ioeric Reviewed By: ioeric Subscribers: kimgr, malcolm.parsons, JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D30564 llvm-svn: 296864
* [clang-tidy] Add -path option to clang-tidy-diff.pyEhsan Akhgari2017-02-171-0/+4
| | | | | | | | | | | | | | | Summary: This flag allows specifying a custom path for the compilation database. Unfortunately we can't use the -p flag like other clang-tidy tools because it's already taken. Reviewers: alexfh Subscribers: JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D29806 llvm-svn: 295482
* [clang-tidy] Add -quiet option to suppress extra outputEhsan Akhgari2017-02-093-10/+32
| | | | | | | | | | | | | | | Summary: This new flag instructs clang-tidy to not output anything except for errors and warnings. This makes it easier to script clang-tidy to run as part of external build systems. Reviewers: bkramer, alexfh, klimek Subscribers: JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D29661 llvm-svn: 294607
* [clang-tidy] Add -extra-arg and -extra-arg-before to clang-tidy-diff.pyEhsan Akhgari2017-02-081-0/+12
| | | | | | | | | | | | | | Summary: These flags allow specifying extra arguments to the tool's command line which don't appear in the compilation database. Reviewers: alexfh, klimek, bkramer Subscribers: JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D29699 llvm-svn: 294491
* [clang-tidy] safety-no-assemblerJonathan Coe2017-02-062-0/+6
| | | | | | | | | | | | | | | | | | | Summary: Add a new clang-tidy module for safety-critical checks. Include a check for inline assembler. Reviewers: Prazek, dtarditi, malcolm.parsons, alexfh, aaron.ballman, idlecode Reviewed By: idlecode Subscribers: idlecode, JonasToth, Eugene.Zelenko, mgorny, JDevlieghere, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D29267 llvm-svn: 294255
* [clang-tidy] Add -extra-arg and -extra-arg-before to run-clang-tidy.pyEhsan Akhgari2017-01-181-2/+15
| | | | | | | | | | | | Summary: These flags allow specifying extra arguments to the tool's command line which don't appear in the compilation database. Reviewers: alexfh Differential Revision: https://reviews.llvm.org/D28334 llvm-svn: 292415
* [clang-tidy] Add check name to YAML export (clang-tools-extra part)Alexander Kornienko2017-01-031-1/+1
| | | | | | | | | | | | Add a field indicating the associated check for every replacement to the YAML report generated with the '-export-fixes' option. Update clang-apply-replacements to handle the new format. Patch by Alpha Abdoulaye! Differential revision: https://reviews.llvm.org/D26137 llvm-svn: 290893
* [clang-tidy] Make format style customizableJonas Devlieghere2016-11-301-4/+12
| | | | | | | | | | | | | | Summary: I came across an outstanding FIXME to make the format style customizable. Inspired by the include fixer, I added an new option `-style` to configure the fallback style in case no clang-format configuration file is found. The default remains "llvm". Reviewers: Prazek, aaron.ballman, hokein, alexfh Subscribers: cfe-commits, malcolm.parsons Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D27142 llvm-svn: 288258
* [clang-tidy] clang-analyzer-alpha* checks are not registered, so there's no ↵Alexander Kornienko2016-11-081-3/+2
| | | | | | need to disable them llvm-svn: 286222
* [clang-tools-extra] Format sources with clang-format. NFC.Mandeep Singh Grang2016-11-081-9/+7
| | | | | | | | | | | | | | | | Summary: Ran clang-format on all .c/.cpp/.h files in clang-tools-extra. Excluded the test, unittests, clang-reorder-fields, include-fixer, modularize and pptrace directories. Reviewers: klimek, alexfh Subscribers: nemanjai Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D26329 llvm-svn: 286221
* [clang-tidy] Add doc for `explain-config` option.Haojian Wu2016-09-221-2/+3
| | | | llvm-svn: 282158
* minor header guards and help messages cleanupKirill Bobyrev2016-08-191-1/+1
| | | | llvm-svn: 279226
* [clang-tidy] MPITypeMismatchCheckAlexander Kornienko2016-08-022-0/+6
| | | | | | | | | | | | | | | | This check verifies if buffer type and MPI (Message Passing Interface) datatype pairs match. All MPI datatypes defined by the MPI standard (3.1) are verified by this check. User defined typedefs, custom MPI datatypes and null pointer constants are skipped, in the course of verification. Instructions on how to apply the check can be found at: https://github.com/0ax1/MPI-Checker/tree/master/examples Patch by Alexander Droste! Differential revision: https://reviews.llvm.org/D21962 llvm-svn: 277516
* Revert "MPITypeMismatchCheck for Clang-Tidy"Alexander Kornienko2016-07-252-6/+0
| | | | | | This reverts commit r276640. Breaks multiple buildbots. llvm-svn: 276651
* MPITypeMismatchCheck for Clang-TidyAlexander Kornienko2016-07-252-0/+6
| | | | | | | | | | | | | | | | | | | | | | Summary: This check verifies if buffer type and MPI (Message Passing Interface) datatype pairs match. All MPI datatypes defined by the MPI standard (3.1) are verified by this check. User defined typedefs, custom MPI datatypes and null pointer constants are skipped, in the course of verification. Instructions on how to apply the check can be found at: https://github.com/0ax1/MPI-Checker/tree/master/examples Reviewers: alexfh Subscribers: cfe-commits Projects: #clang-tools-extra Patch by Alexander Droste! Differential Revision: https://reviews.llvm.org/D21962 llvm-svn: 276640
* [clang-tidy] Pass absolute path to OptionsProvider::getOptions/getRawOptions.Haojian Wu2016-07-111-2/+8
| | | | | | | | | | | | | | | Summary: Although there is no guarantee of getOptions/getRawOptions receiving an absolute path, we try to make it if possible. So FileOptionProvider subclasses don't have to convert the path to an absolute path. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D22154 llvm-svn: 275051
* [clang-tidy] Add dependency on clang-headersNico Weber2016-07-071-0/+3
| | | | | | | | | | | Currently, to be able to process a source file including e.g. stddef.h with clang-tidy, one has to build both clang-tidy and the clang-headers target. Since stddef.h is needed for virtually any source file, let clang-tidy depend on clang-headers, so that it Just Works after it has been built. http://reviews.llvm.org/D22046 llvm-svn: 274751
* Apply performance-unnecessary-value-param to clang-tidy.Benjamin Kramer2016-06-151-1/+1
| | | | | | With minor manual tweaks. No functionality change intended. llvm-svn: 272795
* [clang-tidy] correct clang-tidy-diff.py help messageAlexander Kornienko2016-06-081-5/+5
| | | | | | | | | | | | | | | | Summary: Looks like the original code was copied from clang-format-diff.py. Update help message to make it clang-tidy specific. Reviewers: klimek, alexfh Subscribers: Eugene.Zelenko, cfe-commits Patch by Igor Sugak! Differential Revision: http://reviews.llvm.org/D21050 llvm-svn: 272144
* Add boost-use-to-stringPiotr Padlewski2016-04-292-0/+6
| | | | | | http://reviews.llvm.org/D18136 llvm-svn: 268079
* clang-tidy -list-checks should exit with non-zero code when no checks are ↵Alexander Kornienko2016-04-271-0/+4
| | | | | | enabled. llvm-svn: 267697
* [ClangTidy] Add an 'explain-checks' option to diagnose where each checks ↵Haojian Wu2016-04-271-5/+26
| | | | | | | | | | | | comes from. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18694 llvm-svn: 267683
* [clang-tidy] Reformatted docs + minor updatesAlexander Kornienko2016-02-081-115/+138
| | | | llvm-svn: 260065
* Remove autoconf supportChris Bieneman2016-01-261-49/+0
| | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "Now I am become Death, the destroyer of worlds." -J. Robert Oppenheimer Reviewers: chandlerc, grosbach, bob.wilson, echristo Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D16475 llvm-svn: 258864
* [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
* Teach clang-tidy how to upgrade warnings into errors.Jonathan Roelofs2016-01-131-10/+28
| | | | | | | | | Similar in format to the `-checks=` argument, this new `-warnings-as-errors=` argument upgrades any warnings emitted by the former to errors. http://reviews.llvm.org/D15528 llvm-svn: 257642
* [clang-tidy] Fix configure buildAlexander Kornienko2015-12-301-1/+2
| | | | llvm-svn: 256633
* [clang-tidy] Add UnnecessaryCopyInitialization check to new "performance" ↵Alexander Kornienko2015-12-302-0/+6
| | | | | | | | | | | | | | | | | | | module in ClangTidy Summary: The patch adds a new ClangTidy check that detects when expensive-to-copy types are unnecessarily copy initialized from a const reference that has the same or are larger scope than the copy. It currently only detects this when the copied variable is const qualified. But this will be extended to non const variables if they are only used in a const fashion. Reviewers: alexfh Subscribers: cfe-commits Patch by Felix Berger! Differential Revision: http://reviews.llvm.org/D15623 llvm-svn: 256632
* Fix problem with Clang-tidy parallel configure build.Eugene Zelenko2015-11-251-2/+2
| | | | | | Differential revision: http://reviews.llvm.org/D14964 llvm-svn: 254081
* Add a new module for the C++ Core Guidelines, and the first checker for ↵Aaron Ballman2015-10-063-0/+7
| | | | | | | | those guidelines: cppcoreguidelines-pro-type-reinterpret-cast. Patch by Matthias Gehre! llvm-svn: 249399
* Taking a stab at fixing failing build bots that use make. Unfortunately, the ↵Aaron Ballman2015-10-021-4/+3
| | | | | | | | 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
* Adding a new clang-tidy module to house CERT-specific checkers, and map ↵Aaron Ballman2015-10-023-2/+9
| | | | | | 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
* [clang-tidy] add option to specify build pathGuillaume Papin2015-09-281-4/+11
| | | | | | | | | | | | | | | | | | 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
* [clang-tidy] install helper scriptsAlexander Kornienko2015-09-172-0/+21
| | | | | | | | | | | | | | | | | | 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
* [clang-tidy] Improve the help text for -dump-config.Alexander Kornienko2015-09-161-2/+4
| | | | llvm-svn: 247792
* [clang-tidy] Update check name in the comment. NFC.Alexander Kornienko2015-09-151-1/+1
| | | | llvm-svn: 247682
* [clang-tidy] Fix run-clang-tidy.py.Alexander Kornienko2015-09-081-2/+2
| | | | | | | | | | | | 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
OpenPOWER on IntegriCloud