summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/tool
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang-tidy] Update run-clang-tidy.py with config argJulie Hockett2018-03-091-2/+13
| | | | | | | | | Updating the run-clang-tidy.py script to allow specification of the config argument to the clang-tidy invocation. Differential Revision: https://reviews.llvm.org/D43538 llvm-svn: 327186
* [clang-tidy] Add check: replace string::find(...) == 0 with absl::StartsWithHaojian Wu2018-03-092-0/+6
| | | | | | | | | | | | Patch by Niko Weh! Reviewers: hokein Subscribers: klimek, cfe-commits, ioeric, ilya-biryukov, ahedberg Differential Revision: https://reviews.llvm.org/D43847 llvm-svn: 327111
* [clang-tidy] Add "portability" module and rename readability-simd-intrinsics ↵Fangrui Song2018-03-072-0/+6
| | | | | | | | | | | | to portability-simd-intrinsics Reviewers: alexfh Subscribers: klimek, nemanjai, mgorny, xazax.hun, kbarton, cfe-commits Differential Revision: https://reviews.llvm.org/D44173 llvm-svn: 326909
* [clang-tidy] Add -vfsoverlay flagIlya Biryukov2018-01-231-2/+39
| | | | | | | | | | | | | | | | | | | | | Summary: It allows to remap and override files and directories on disk when running clang-tidy. The intended use case for the flag is running standalone clang-tidy binary for IDE and editor integration. Patch by Vladimir Plyashkun. Reviewers: alexfh, benlangmuir, ilya-biryukov Reviewed By: ilya-biryukov Subscribers: ilya-biryukov, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D41535 llvm-svn: 323196
* [CMake] Use PRIVATE in target_link_libraries for executablesShoaib Meenai2017-12-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently use target_link_libraries without an explicit scope specifier (INTERFACE, PRIVATE or PUBLIC) when linking executables. Dependencies added in this way apply to both the target and its dependencies, i.e. they become part of the executable's link interface and are transitive. Transitive dependencies generally don't make sense for executables, since you wouldn't normally be linking against an executable. This also causes issues for generating install export files when using LLVM_DISTRIBUTION_COMPONENTS. For example, clang has a lot of LLVM library dependencies, which are currently added as interface dependencies. If clang is in the distribution components but the LLVM libraries it depends on aren't (which is a perfectly legitimate use case if the LLVM libraries are being built static and there are therefore no run-time dependencies on them), CMake will complain about the LLVM libraries not being in export set when attempting to generate the install export file for clang. This is reasonable behavior on CMake's part, and the right thing is for LLVM's build system to explicitly use PRIVATE dependencies for executables. Unfortunately, CMake doesn't allow you to mix and match the keyword and non-keyword target_link_libraries signatures for a single target; i.e., if a single call to target_link_libraries for a particular target uses one of the INTERFACE, PRIVATE, or PUBLIC keywords, all other calls must also be updated to use those keywords. This means we must do this change in a single shot. I also fully expect to have missed some instances; I tested by enabling all the projects in the monorepo (except dragonegg), and configuring both with and without shared libraries, on both Darwin and Linux, but I'm planning to rely on the buildbots for other configurations (since it should be pretty easy to fix those). Even after this change, we still have a lot of target_link_libraries calls that don't specify a scope keyword, mostly for shared libraries. I'm thinking about addressing those in a follow-up, but that's a separate change IMO. Differential Revision: https://reviews.llvm.org/D40823 llvm-svn: 319840
* Add a new clang-tidy module for Fuchsia as an umbrella to diagnose issues ↵Aaron Ballman2017-11-282-0/+6
| | | | | | | | with the Fuschia and Zircon coding guidelines (https://fuchsia.googlesource.com/zircon/+/master/docs/cxx.md). Adds the first of such checkers, which detects when default arguments are declared in a function declaration or when default arguments are used at call sites. Patch by Julie Hockett llvm-svn: 319225
* run-clang-tidy: Use check_call instead of check_outputKevin Funk2017-11-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Streamlines the output under Python 3.x. Before: ``` b'Enabled checks:\n clang-analyzer-apiModeling.google.GTest\n ... ``` After: ``` Enabled checks: clang-analyzer-apiModeling.google.GTest ... ``` Reviewers: cfe-commits, alexfh Reviewed By: alexfh Subscribers: JDevlieghere Differential Revision: https://reviews.llvm.org/D37482 Change-Id: I6287104bc73926ae6d0f66c15c250c3cb44bee33 llvm-svn: 319148
* [clang-tidy] Support relative paths in run-clang-tidy.pyGabor Horvath2017-11-061-1/+8
| | | | | | | | | | Unfortunately, these python scripts are not tested currently. I did the testing manually on LLVM by editing the CMake generated compilation database to contain relative paths for some of the files. Differential Revision: https://reviews.llvm.org/D39603 llvm-svn: 317468
* [clang-tidy] Clean up installation rulesShoaib Meenai2017-11-021-5/+6
| | | | | | | | | An installation rule for the executable with the correct component is already created by `add_clang_tool`, so the rule in this file is redundant. Correct the installation component for the Python scripts so that they also get installed by `install-clang-tidy`. llvm-svn: 317155
* [clang-tidy ObjC] [1/3] New module `objc` for Objective-C checksHaojian Wu2017-10-262-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is part 1 of 3 of a series of changes to improve Objective-C linting in clang-tidy. This introduces a new clang-tidy module, `objc`, specifically for Objective-C / Objective-C++ checks. The module is currently empty; D39142 adds the first check. Test Plan: `ninja check-clang-tools` Patch by Ben Hamilton! Reviewers: hokein, alexfh Reviewed By: hokein Subscribers: Wizard, mgorny Differential Revision: https://reviews.llvm.org/D39188 llvm-svn: 316643
* clang-tidy: Fix deps.NAKAMURA Takumi2017-10-211-0/+3
| | | | llvm-svn: 316260
* [clang-tidy] Don't error on MS-style inline assembly.Zachary Turner2017-10-201-0/+5
| | | | | | | | | | | To get MS-style inline assembly, we need to link in the various backends. Some other clang tools already do this, and this issue has been raised with clang-tidy several times, indicating there is sufficient desire to make this work. Differential Revision: https://reviews.llvm.org/D38549 llvm-svn: 316246
* 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
OpenPOWER on IntegriCloud