summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy
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] fix header guardSam McCall2018-03-091-3/+3
| | | | llvm-svn: 327115
* [clang-tidy] Add check: replace string::find(...) == 0 with absl::StartsWithHaojian Wu2018-03-098-0/+241
| | | | | | | | | | | | Patch by Niko Weh! Reviewers: hokein Subscribers: klimek, cfe-commits, ioeric, ilya-biryukov, ahedberg Differential Revision: https://reviews.llvm.org/D43847 llvm-svn: 327111
* do not register matcher for objc-only checks when analyzing non-objc sources ↵Yan Zhang2018-03-074-0/+17
| | | | | | | | | | | | | | | | to save resources Summary: I did not put lang opt check in AvoidSpinlockCheck since OSSpinLock is not objc specific. We won't want to skip it when analyzing some C++ target used by other ObjC sources. Reviewers: hokein, benhamilton Reviewed By: benhamilton Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D44174 llvm-svn: 326928
* [clang-tidy] Add "portability" module and rename readability-simd-intrinsics ↵Fangrui Song2018-03-0711-24/+96
| | | | | | | | | | | | 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] Fix one corner case in make-unique check.Haojian Wu2018-03-061-9/+1
| | | | | | | | | | | | | | | | | Summary: Previously, we tried to cover all "std::initializer_list" implicit conversion cases in the code, but there are some corner cases that not covered (see newly-added test in the patch). Sipping all implicit AST nodes is a better way to filter out all these cases. Reviewers: ilya-biryukov Subscribers: klimek, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D44137 llvm-svn: 326799
* [clang-tidy] Another batch of checks to rename from misc- to bugprone-.Alexander Kornienko2018-02-2813-48/+48
| | | | | | | | | | | | | | | | Summary: clang-tidy/rename_check.py {misc,bugprone}-suspicious-semicolon clang-tidy/rename_check.py {misc,bugprone}-suspicious-string-compare clang-tidy/rename_check.py {misc,bugprone}-swapped-arguments clang-tidy/rename_check.py {misc,bugprone}-undelegated-constructor --check_class_name UndelegatedConstructor Reviewers: hokein, sammccall, aaron.ballman Subscribers: klimek, mgorny, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D43870 llvm-svn: 326386
* Rename more checks from misc- to bugprone-.Alexander Kornienko2018-02-2812-47/+47
| | | | | | | | | | | | | | | | Summary: clang-tidy/rename_check.py {misc,bugprone}-string-integer-assignment clang-tidy/rename_check.py {misc,bugprone}-string-literal-with-embedded-nul clang-tidy/rename_check.py {misc,bugprone}-suspicious-enum-usage clang-tidy/rename_check.py {misc,bugprone}-suspicious-missing-comma Reviewers: hokein, sammccall, aaron.ballman Subscribers: klimek, cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D43868 llvm-svn: 326384
* Rename a few checks from misc- to bugprone-.Alexander Kornienko2018-02-2812-46/+46
| | | | | | | | | | | | | | | | | | Summary: rename_check.py {misc,bugprone}-forwarding-reference-overload rename_check.py {misc,bugprone}-macro-repeated-side-effects rename_check.py {misc,bugprone}-lambda-function-name rename_check.py {misc,bugprone}-misplaced-widening-cast Reviewers: hokein, sammccall, aaron.ballman Reviewed By: aaron.ballman Subscribers: klimek, cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D43867 llvm-svn: 326327
* [clang-tidy] Fix 'add_new_check.py --udpate-docs'Alexander Kornienko2018-02-281-0/+7
| | | | llvm-svn: 326321
* add UUID to the acronyms list of objc property name checksYan Zhang2018-02-271-0/+2
| | | | | | | | | | | | Reviewers: benhamilton, hokein Reviewed By: benhamilton Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D43775 llvm-svn: 326222
* Revert "[Tooling] [1/1] Refactor FrontendActionFactory::create() to return ↵Roman Lebedev2018-02-271-3/+1
| | | | | | | | | | | | std::unique_ptr<>" This reverts commit rL326202 This broke gcc4.8 builds, compiler just segfaults: http://lab.llvm.org:8011/builders/clang-atom-d525-fedora-rel/builds/14909 http://lab.llvm.org:8011/builders/clang-x86_64-linux-abi-test/builds/22673 llvm-svn: 326203
* [Tooling] [1/1] Refactor FrontendActionFactory::create() to return ↵Roman Lebedev2018-02-271-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | std::unique_ptr<> Summary: I'm not sure whether there are any principal reasons why it returns raw owning pointer, or it is just a old code that was not updated post-C++11. I'm not too sure what testing i should do, because `check-all` is not error clean here for some reason, but it does not //appear// asif those failures are related to these changes. This is Clang-tools-extra part. Clang part is D43779. Reviewers: klimek, bkramer, alexfh, pcc Reviewed By: alexfh Subscribers: ioeric, jkorous-apple, cfe-commits Tags: #clang, #clang-tools-extra Differential Revision: https://reviews.llvm.org/D43780 llvm-svn: 326202
* [clang-tidy/google] Improve the Objective-C global variable declaration ↵Yan Zhang2018-02-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | check 🔧 Summary: The current Objective-C global variable declaration check restricts naming that is permitted by the Google Objective-C style guide. The Objective-C style guide states the following: "Global and file scope constants should have an appropriate prefix. [...] Constants may use a lowercase k prefix when appropriate" http://google.github.io/styleguide/objcguide#constants This change fixes the check to allow two or more capital letters as an appropriate prefix. This change intentionally avoids making a decision regarding whether to flag constants that use a two letter prefix (two letter prefixes are reserved by Apple¹ but many projects seem to violate this guideline). This change eliminates an important category of false positives (constants prefixed with '[A-Z]{2,}') at the cost of introducing a less important category of false negatives (constants prefixed with only '[A-Z]'). The false positives are observed in standard recommended code while the false negatives occur in non-standard unrecommended code. The number of eliminated false positives is expected to be significantly larger than the number of exposed false negatives. ❧ (1) "Two-letter prefixes like these are reserved by Apple for use in framework classes." https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Conventions/Conventions.html Reviewers: aaron.ballman, Wizard, hokein, benhamilton Reviewed By: aaron.ballman, Wizard Subscribers: aaron.ballman, cfe-commits Differential Revision: https://reviews.llvm.org/D43581 llvm-svn: 326046
* [clang-tidy] Replace the usage of std::uncaught_exception with ↵Gabor Horvath2018-02-204-0/+145
| | | | | | | | | | std::uncaught_exceptions Patch by: Daniel Kolozsvari! Differential Revision: https://reviews.llvm.org/D40787 llvm-svn: 325572
* [tidy] Move private ast matchers into anonymous namespaces to avoid ODR ↵Benjamin Kramer2018-02-1814-17/+39
| | | | | | | | conflicts. No functionality change intended. llvm-svn: 325467
* [clang-tidy] Add `readability-simd-intrinsics` check.Fangrui Song2018-02-154-0/+196
| | | | | | | | | | | | | | | | | | | | | Summary: Many architectures provide SIMD operations (e.g. x86 SSE/AVX, Power AltiVec/VSX, ARM NEON). It is common that SIMD code implementing the same algorithm, is written in multiple target-dispatching pieces to optimize for different architectures or micro-architectures. The C++ standard proposal P0214 and its extensions cover many common SIMD operations. By migrating from target-dependent intrinsics to P0214 operations, the SIMD code can be simplified and pieces for different targets can be unified. Refer to http://wg21.link/p0214 for introduction and motivation for the data-parallel standard library. Subscribers: klimek, aemerson, mgorny, xazax.hun, kristof.beyls, hintonda, cfe-commits Differential Revision: https://reviews.llvm.org/D42983 llvm-svn: 325272
* [clang-tidy] New checker for exceptions that are created but not thrownGabor Horvath2018-02-154-0/+92
| | | | | | | | Patch by: Kristof Umann Differential Revision: https://reviews.llvm.org/D43120 llvm-svn: 325222
* [clang-tidy] Update fuchsia-multiple-inheritance to not failJulie Hockett2018-02-131-4/+4
| | | | | | | | | | | | Updating the fuchsia-multiple-inheritance to gracefully handle unknown record types (e.g. templatized classes) by simply continuing, rather than asserting and failing. Fixes PR36052. Differential Revision: https://reviews.llvm.org/D43223 llvm-svn: 325015
* [clang-tidy] Update fuchsia-multiple-inheritance to check for templatesJulie Hockett2018-02-071-2/+2
| | | | | | | | | | | Updating fuchsia-multiple-inheritance to not crash when a record inherits a template. Fixes PR36052. Differential Revision: https://reviews.llvm.org/D42918 llvm-svn: 324432
* Support special acronyms inside property names and allow plural formsYan Zhang2018-02-061-7/+10
| | | | | | | | | | | | Reviewers: benhamilton, hokein Reviewed By: benhamilton, hokein Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D42947 llvm-svn: 324407
* [clang-tidy] ObjC ARC objects should not trigger ↵Ben Hamilton2018-02-022-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | performance-unnecessary-value-param Summary: The following Objective-C code currently incorrectly triggers clang-tidy's performance-unnecessary-value-param check: ``` % cat /tmp/performance-unnecessary-value-param-arc.m void foo(id object) { } clang-tidy /tmp/performance-unnecessary-value-param-arc.m -checks=-\*,performance-unnecessary-value-param -- -xobjective-c -fobjc-abi-version=2 -fobjc-arc 1 warning generated. /src/llvm/tools/clang/tools/extra/test/clang-tidy/performance-unnecessary-value-param-arc.m:10:13: warning: the parameter 'object' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param] void foo(id object) { } ~~ ^ const & ``` This is wrong for a few reasons: 1) Objective-C doesn't have references, so `const &` is not going to help 2) ARC heavily optimizes the "expensive" copy which triggers the warning This fixes the issue by disabling the warning for non-C++, as well as disabling it for objects under ARC memory management for Objective-C++. Fixes https://bugs.llvm.org/show_bug.cgi?id=32075 Test Plan: New tests added. Ran tests with `make -j12 check-clang-tools`. Reviewers: alexfh, hokein Reviewed By: hokein Subscribers: stephanemoore, klimek, xazax.hun, cfe-commits, Wizard Differential Revision: https://reviews.llvm.org/D42812 llvm-svn: 324097
* [clang-tidy] Kill marco. No functionality change.Benjamin Kramer2018-02-027-9/+9
| | | | llvm-svn: 324084
* [clang-tidy] Widen anonymous namespace.Benjamin Kramer2018-02-021-2/+1
| | | | | | | The matchers in this check are prone to create ODR violations otherwise. No functionality change. llvm-svn: 324083
* [clang-tidy] Remove global constructor. No functionality change intended.Benjamin Kramer2018-02-021-4/+8
| | | | llvm-svn: 324080
* [clang-tidy] Don't reinvent the wheel, use existing log2 functions.Benjamin Kramer2018-02-021-8/+1
| | | | | | | This also makes the code ready for int128, even though I think it's currently impossible to get an int128 into this code path. llvm-svn: 324079
* [clang-tidy] misc-redundant-expression: fix a crash under ubsanAlexander Kornienko2018-02-011-3/+9
| | | | llvm-svn: 323980
* [clang-tidy] New argument --language to add_new_check.pyBen Hamilton2018-01-311-16/+33
| | | | | | | | | | | | | | | | | | | | | | Summary: Currently, add_new_check.py assumes all checks are for C++ code. This adds a new argument --language=[LANG] to add_new_check.py so authors of new checks can specify that the test file should be in a different language. For example, authors can pass --language=objc for Objective-C clang-tidy checks. Reviewers: hokein, alexfh Reviewed By: alexfh Subscribers: Wizard, xazax.hun Differential Revision: https://reviews.llvm.org/D39141 llvm-svn: 323919
* Update header guard.Alexander Kornienko2018-01-311-3/+3
| | | | llvm-svn: 323871
* clang-tidy/rename_check.py misc-incorrect-roundings bugprone-incorrect-roundingsAlexander Kornienko2018-01-306-15/+15
| | | | | | | | More specifically, clang-tidy/rename_check.py misc-incorrect-roundings \ bugprone-incorrect-roundings --check_class_name IncorrectRoundings llvm-svn: 323768
* clang-tidy/rename_check.py misc-string-compare readability-string-compareAlexander Kornienko2018-01-306-11/+12
| | | | llvm-svn: 323766
* [clang-tidy] Use a more specific regexAlexander Kornienko2018-01-301-2/+2
| | | | llvm-svn: 323765
* add prefix with '_' support for property name. Corresponding apple dev doc: ↵Yan Zhang2018-01-302-21/+79
| | | | | | | | | | | | | | https://developer.apple.com/library/content/qa/qa1908/_index.html Reviewers: benhamilton, hokein Reviewed By: benhamilton Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D42464 llvm-svn: 323722
* Removed Unicode BOM.Alexander Kornienko2018-01-251-1/+1
| | | | llvm-svn: 323431
* [clang-tidy] Handle bitfields in cppcoreguidelines-pro-type-member-init if ↵Malcolm Parsons2018-01-231-2/+3
| | | | | | | | | | | | | | | | | | using C++2a Summary: C++2a allows bitfields to have default member initializers. Add support for this to clang-tidy's cppcoreguidelines-pro-type-member-init check. Reviewers: aaron.ballman, alexfh Reviewed By: aaron.ballman Subscribers: klimek, nemanjai, xazax.hun, kbarton, cfe-commits Differential Revision: https://reviews.llvm.org/D42426 llvm-svn: 323227
* [clang-tidy] Handle bitfields in modernize-use-default-member-init if using ↵Malcolm Parsons2018-01-231-1/+3
| | | | | | | | | | | | | | | | | | C++2a Summary: C++2a allows bitfields to have default member initializers. Add support for this to clang-tidy's modernize-use-default-member-init check. Reviewers: aaron.ballman, alexfh Reviewed By: aaron.ballman Subscribers: klimek, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D42413 llvm-svn: 323208
* [clang-tidy] Add -vfsoverlay flagIlya Biryukov2018-01-233-9/+53
| | | | | | | | | | | | | | | | | | | | | 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
* [clang-tidy] Don't generate fixes for invalid new expr location in ↵Haojian Wu2018-01-231-0/+4
| | | | | | | | | | | | | | modernize-make-unique. Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: klimek, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D42363 llvm-svn: 323191
* [clang-tidy objc-property-declaration] New option IncludeDefaultAcronymsBen Hamilton2018-01-222-67/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The existing option objc-property-declaration.Acronyms replaces the built-in set of acronyms. While this behavior is OK for clients that don't want the default behavior, many clients may just want to add their own custom acronyms to the default list. This revision introduces a new option, objc-property-declaration.IncludeDefaultAcronyms, which controls whether the acronyms in objc-property-declaration.Acronyms are appended to the default list (the default behavior) or whether they replace. I also updated the documentation. Test Plan: make -j12 check-clang-tools Reviewers: Wizard, hokein, klimek Reviewed By: hokein Subscribers: Eugene.Zelenko, cfe-commits Differential Revision: https://reviews.llvm.org/D42261 llvm-svn: 323130
* [clang-tidy] Adding Fuchsia checker for multiple inheritanceJulie Hockett2018-01-194-0/+177
| | | | | | | | | | | | Adds a check to the Fuchsia module to warn when a class inherits from multiple classes that are not pure virtual. See https://fuchsia.googlesource.com/zircon/+/master/docs/cxx.md for reference. Differential Revision: https://reviews.llvm.org/D40580 llvm-svn: 323011
* [clang-tidy objc-property-declaration] Expand list of ObjC acronymsBen Hamilton2018-01-181-12/+50
| | | | | | | | | | | | | | | | | | | | | Summary: We were missing some pretty common acronyms in the camelCase property name check objc-property-declaration. This expands the list and sorts it lexicographically, so we can avoid duplicates. Test Plan: make -j12 check-clang-tools Reviewers: Wizard, hokein, klimek Reviewed By: Wizard Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D42253 llvm-svn: 322886
* [clang-tidy] Don't generate fix for argument constructed from ↵Haojian Wu2018-01-181-3/+16
| | | | | | | | | | | | | | | | | | | | | | std::initializer_list. Summary: A follow-up fix of rL311652. The previous `vector` in our test is different with `std::vector`, so The check still generates fixes for std::vector (`auto p = std::unique_ptr<Foo>(new Foo({1,2,3}))`) in real world, the patch makes the vector behavior in test align with std::vector (both AST nodes are the same now). Reviewers: ilya-biryukov, alexfh Reviewed By: ilya-biryukov Subscribers: klimek, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D41852 llvm-svn: 322822
* [clang-tidy] Adding Fuchsia checker for trailing returnsJulie Hockett2018-01-174-0/+97
| | | | | | | | | | | | Adds a check to the Fuchsia module to warn if a function has a trailing return. See https://fuchsia.googlesource.com/zircon/+/master/docs/cxx.md for reference. Differential Revision: https://reviews.llvm.org/D42116 llvm-svn: 322759
* [clang-tidy] Fixing Fuchsia overloaded operator warning messageJulie Hockett2018-01-171-1/+1
| | | | | | | | Updating Fuchsia overloaded operator warning message for clarity. Differential Revision: https://reviews.llvm.org/D42120 llvm-svn: 322692
* [clang-tidy] implement check for gotoJonas Toth2018-01-175-0/+98
| | | | | | | | | | | | | | | | | | | | The usage of `goto` is discourage in C++ since forever. This check implements a warning for every `goto`. Even though there are (rare) valid use cases for `goto`, better high level constructs should be used. `goto` is used sometimes in C programs to free resources at the end of functions in the case of errors. This pattern is better implemented with RAII in C++. Reviewers: aaron.ballman, alexfh, hokein Reviewed By: aaron.ballman Subscribers: lebedev.ri, jbcoe, Eugene.Zelenko, klimek, nemanjai, mgorny, xazax.hun, kbarton, cfe-commits Differential Revision: https://reviews.llvm.org/D41815 llvm-svn: 322626
* [clang-tidy] fix minor formatting issueJonas Toth2018-01-171-2/+1
| | | | llvm-svn: 322624
* add ID as a special acronym to objc property declaration check for property ↵Yan Zhang2018-01-171-8/+11
| | | | | | | | | | | | | | names like bundleID.allow using acronyms as suffix. Reviewers: benhamilton, hokein Reviewed By: benhamilton Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D42143 llvm-svn: 322602
* [clang-tidy] Expand readability-redundant-smartptr-get to understand ↵Samuel Benzaquen2018-01-151-5/+14
| | | | | | | | | | | | | | implicit converions to bool in more contexts. Summary: Expand readability-redundant-smartptr-get to understand implicit converions to bool in more contexts. Reviewers: hokein Subscribers: klimek, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D41998 llvm-svn: 322497
* [clang-tidy] Adding Fuchsia checker for statically constructed objectsJulie Hockett2018-01-114-0/+99
| | | | | | | | | | | | Adds a check to the Fuchsia module to warn if statically-stored objects are created, unless constructed with `constexpr`. See https://fuchsia.googlesource.com/zircon/+/master/docs/cxx.md for reference. Differential Revision: https://reviews.llvm.org/D41546 llvm-svn: 322310
* [clang-tidy] Fix google-readability-namespace-comments handling of C++17 ↵Alexander Kornienko2018-01-112-10/+60
| | | | | | | | | | | | | | | | | | | | | | | | | nested namespaces Summary: Fixes bug 34701 When we encounter a namespace find the location of the left bracket. Then if the text between the name and the left bracket contains a ':' then it's a C++17 nested namespace. Reviewers: #clang-tools-extra, alexfh, aaron.ballman Reviewed By: aaron.ballman Subscribers: curdeius, cfe-commits, krasimir, JonasToth, JDevlieghere, xazax.hun Tags: #clang-tools-extra Patch by Alexandru Octavian Buțiu! Differential Revision: https://reviews.llvm.org/D38284 llvm-svn: 322274
OpenPOWER on IntegriCloud