summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang-tidy] Adjust location of namespace comment diagnosticIlya Biryukov2019-07-171-1/+8
| | | | | | | | | | | | | | | | | | | | | | Summary: If there is no comment, place it at the closing brace of a namespace definition. Previously it was placed at the next character after the closing brace. The new position produces a better location for highlighting in clangd and does not seem to make matters worse for clang-tidy. Reviewers: alexfh, hokein Reviewed By: alexfh, hokein Subscribers: xazax.hun, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64861 llvm-svn: 366337
* [clang-tidy] initial version of readability-convert-member-functions-to-staticMatthias Gehre2019-07-164-0/+213
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Finds non-static member functions that can be made ``static``. I have run this check (repeatedly) over llvm-project. It made 1708 member functions ``static``. Out of those, I had to exclude 22 via ``NOLINT`` because their address was taken and stored in a variable of pointer-to-member type (e.g. passed to llvm::StringSwitch). It also made 243 member functions ``const``. (This is currently very conservative to have no false-positives and can hopefully be extended in the future.) You can find the results here: https://github.com/mgehre/llvm-project/commits/static_const_eval Reviewers: alexfh, aaron.ballman Subscribers: mgorny, xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61749 llvm-svn: 366265
* Simplify with llvm::is_contained. NFCFangrui Song2019-07-133-8/+4
| | | | llvm-svn: 365993
* Enhance abseil-faster-strsplit-delimiter to handle other non-printable ↵Dmitri Gribenko2019-07-091-8/+16
| | | | | | | | | | | | | | | | | | | | | | | | | characters. Summary: Currently it fails on cases like '\001'. Note: Since `StringLiteral::outputString` dumps most nonprintable characters in octal value, the exact string literal format isn't preserved, e.g. `"\x01"` becomes `'\001'`. Reviewers: gribozavr Reviewed By: gribozavr Subscribers: lebedev.ri, Eugene.Zelenko, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64151 Patch by Xiaoyi Zhang. llvm-svn: 365463
* [clang-tidy] new check: bugprone-posix-returnDmitri Gribenko2019-07-034-0/+116
| | | | | | | | | | | | | | | | | | | | Summary: Checks if any calls to posix functions (except posix_openpt) expect negative return values. These functions return either 0 on success or an errno on failure, which is positive only. Reviewers: JonasToth, gribozavr, alexfh, hokein Reviewed By: gribozavr Subscribers: Eugene.Zelenko, lebedev.ri, llozano, george.burgess.iv, xazax.hun, srhines, mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63623 Patch by Jian Cai. llvm-svn: 365007
* [clang-tidy] Extend TransformerClangTidyCheck to support adding includes.Yitzhak Mandelbaum2019-07-022-0/+27
| | | | | | | | | | | | | | | | | Summary: This revision implements support for the `AddedIncludes` field in RewriteRule cases; that is, it supports specifying the addition of include directives in files modified by the clang tidy check. Reviewers: ilya-biryukov, gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63893 llvm-svn: 364922
* Fixed two issues in clang-tidy -help.Alexander Kornienko2019-07-011-2/+2
| | | | | | HeaderFilter -> HeaderFilterRegex llvm-svn: 364837
* [clang-tidy] Fix NDEBUG build [NFC]Mikael Holmen2019-06-271-0/+2
| | | | llvm-svn: 364535
* [clang-tidy] Generalize TransformerClangTidyCheck to take a rule generator.Yitzhak Mandelbaum2019-06-262-12/+46
| | | | | | | | | | | | | | Summary: Tidy check behavior often depends on language and/or clang-tidy options. This revision allows a user of TranformerClangTidyCheck to pass rule _generator_ in place of a rule, where the generator takes both the language and clang-tidy options. Additionally, the generator returns an `Optional` to allow for the case where the check is deemed irrelevant/disable based on those options. Reviewers: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63288 llvm-svn: 364442
* [clang-tidy] misc-unused-parameters: don't comment out parameter name for C codeMatthias Gehre2019-06-211-4/+9
| | | | | | | | | | | | | | Summary: The fixit `int square(int /*num*/)` yields `error: parameter name omitted` for C code. Enable it only for C++ code. Reviewers: klimek, ilya-biryukov, lebedev.ri, aaron.ballman Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63088 llvm-svn: 364106
* [clang-tidy] Split fuchsia-default-argumentsJulie Hockett2019-06-187-74/+140
| | | | | | | | | | | | Splits fuchsia-default-arguments check into two checks. fuchsia-default-arguments-calls warns if a function or method is called with default arguments. fuchsia-default-arguments-declarations warns if a function or method is declared with default parameters. Committed on behalf of @diegoast (Diego Astiazarán). Resolves b38051. Differential Revision: https://reviews.llvm.org/D62437 llvm-svn: 363712
* [clang-tidy] Make ClangTidyCheck::OptionsView public.Yitzhak Mandelbaum2019-06-131-7/+7
| | | | | | | | | | | | | | Summary: The `OptionsView` class is currently protected. This constraint prevents tidies from passing the OptionsView to, for example, a helper function. Similarly, TransformerClangTidyCheck cannot pass the `OptionsView` object to functions that generate `tooling::RewriteRule`s. The latter is needed to allow the definition of such rules to depend on the clang-tidy options, as demonstrated in the child revision. Reviewers: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63287 llvm-svn: 363296
* [clang-tidy] Made abseil-faster-strsplit-delimiter tests pass on C++17Dmitri Gribenko2019-06-131-18/+9
| | | | | | | | | | | | | | | | Reviewers: hokein, gribozavr Reviewed By: hokein, gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63253 Patch by Johan Vikström. llvm-svn: 363273
* [clang-tidy] Fixed abseil-time-subtraction to work on C++17Dmitri Gribenko2019-06-131-16/+35
| | | | | | | | | | | | | | | | Summary: Fixed abseil-time-subtraction to work on C++17 Reviewers: hokein, gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63261 Patch by Johan Vikström. llvm-svn: 363272
* [clang-tidy] Made abseil-upgrade-duration-conversions tests pass on c++17Dmitri Gribenko2019-06-131-8/+16
| | | | | | | | | | | | | | | | | | Summary: Made abseil-upgrade-duration-conversions tests pass on c++17 Reviewers: hokein, gribozavr Reviewed By: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63262 Patch by Johan Vikström. llvm-svn: 363270
* [clang-tidy] Fixed abseil-duration-unnecessary-conversion tests for c++17Dmitri Gribenko2019-06-131-3/+2
| | | | | | | | | | | | | | | | | | Summary: Fixed abseil-duration-unnecessary-conversion tests for c++17 Reviewers: hokein, gribozavr Reviewed By: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63263 Patch by Johan Vikström. llvm-svn: 363263
* Fixed a crash in misc-redundant-expression ClangTidy checkerDmitri Gribenko2019-06-121-10/+16
| | | | | | | | | | | | | | Summary: It was trying to pass a dependent expression into constant evaluator. Reviewers: ilya-biryukov Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63188 llvm-svn: 363133
* [clang-tidy] Fix invalid read on destructionNikolai Kosjar2019-06-111-19/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...in case the clang tidy plugin is linked into the clang binary. Valgrind's memcheck reports: 8949== Invalid read ==8866== Invalid read of size 4 8866== at 0x164D248B: fetch_sub (atomic_base.h:524) 8866== by 0x164D248B: llvm::ThreadSafeRefCountedBase<clang::ast_matchers::internal::DynMatcherInterface>::Release() const (IntrusiveRefCntPtr.h:98) 8866== by 0x164CE16C: llvm::IntrusiveRefCntPtrInfo<clang::ast_matchers::internal::DynMatcherInterface>::release(clang::ast_matchers::internal::DynMatcherInterface*) (IntrusiveRefCntPtr.h:127) 8866== by 0x164C8D5C: llvm::IntrusiveRefCntPtr<clang::ast_matchers::internal::DynMatcherInterface>::release() (IntrusiveRefCntPtr.h:190) 8866== by 0x164C3B87: llvm::IntrusiveRefCntPtr<clang::ast_matchers::internal::DynMatcherInterface>::~IntrusiveRefCntPtr() (IntrusiveRefCntPtr.h:157) 8866== by 0x164BB4F1: clang::ast_matchers::internal::DynTypedMatcher::~DynTypedMatcher() (ASTMatchersInternal.h:341) 8866== by 0x164BB529: clang::ast_matchers::internal::Matcher<clang::QualType>::~Matcher() (ASTMatchersInternal.h:496) 8866== by 0xD7AE614: __cxa_finalize (cxa_finalize.c:83) 8866== by 0x164B3082: ??? (in /d2/llvm/8/qtc/builds/DebugShared/lib/libclangTidyModernizeModule.so.8) 8866== by 0x4010B72: _dl_fini (dl-fini.c:138) 8866== by 0xD7AE040: __run_exit_handlers (exit.c:108) 8866== by 0xD7AE139: exit (exit.c:139) 8866== by 0xD78CB9D: (below main) (libc-start.c:344) 8866== Address 0x19dd9bc8 is 8 bytes inside a block of size 16 free'd 8866== at 0x4C3123B: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) 8866== by 0x1469BB99: clang::ast_matchers::internal::(anonymous namespace)::TrueMatcherImpl::~TrueMatcherImpl() (ASTMatchersInternal.cpp:126) 8866== by 0x1469BBC5: llvm::object_deleter<clang::ast_matchers::internal::(anonymous namespace)::TrueMatcherImpl>::call(void*) (ManagedStatic.h:30) 8866== by 0x9ABFF26: llvm::ManagedStaticBase::destroy() const (ManagedStatic.cpp:72) 8866== by 0x9ABFF94: llvm::llvm_shutdown() (ManagedStatic.cpp:84) 8866== by 0x9A65232: llvm::InitLLVM::~InitLLVM() (InitLLVM.cpp:52) 8866== by 0x14B0C8: main (driver.cpp:323) 8866== Block was alloc'd at 8866== at 0x4C3017F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) 8866== by 0x1469BB36: llvm::object_creator<clang::ast_matchers::internal::(anonymous namespace)::TrueMatcherImpl>::call() (ManagedStatic.h:24) 8866== by 0x9ABFD99: llvm::ManagedStaticBase::RegisterManagedStatic(void* (*)(), void (*)(void*)) const (ManagedStatic.cpp:42) 8866== by 0x1469B5DF: llvm::ManagedStatic<clang::ast_matchers::internal::(anonymous namespace)::TrueMatcherImpl, llvm::object_creator<clang::ast_matchers::internal::(anonymous namespace)::TrueMatcherImpl>, llvm::object_deleter<clang::ast_matchers::internal::(anonymous namespace)::TrueMatcherImpl> >::operator*() (ManagedStatic.h:67) 8866== by 0x14698F9D: clang::ast_matchers::internal::DynTypedMatcher::trueMatcher(clang::ast_type_traits::ASTNodeKind) (ASTMatchersInternal.cpp:195) 8866== by 0x164C9D3B: _ZNK5clang12ast_matchers8internal11TrueMatchercvNS1_7MatcherIT_EEINS_8QualTypeEEEv (ASTMatchersInternal.h:1247) 8866== by 0x16501458: __static_initialization_and_destruction_0(int, int) (LoopConvertCheck.cpp:48) 8866== by 0x16501976: _GLOBAL__sub_I_LoopConvertCheck.cpp (LoopConvertCheck.cpp:920) 8866== by 0x4010732: call_init (dl-init.c:72) 8866== by 0x4010732: _dl_init (dl-init.c:119) 8866== by 0x40010C9: ??? (in /lib/x86_64-linux-gnu/ld-2.27.so) Differential Revision: https://reviews.llvm.org/D63129 llvm-svn: 363068
* [clang-tidy] Fix typo in bugprone-string-constructor.Clement Courbet2019-06-111-1/+1
| | | | | | s/bigger then/bigger than/ llvm-svn: 363053
* Fixed google-readability-casting test to work in c++17Dmitri Gribenko2019-06-111-7/+15
| | | | | | | | | | | | | | | | | | Summary: Fixed google-readability-casting.cpp to get tests working in c++17 Reviewers: gribozavr, hokein Reviewed By: gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63128 Patch by Shaurya Gupta. llvm-svn: 363047
* [clang-tidy] Another attempt to fix misc-redundant-expression check.Haojian Wu2019-06-061-5/+6
| | | | | | Correct the fix of rL3627011, the isValueDependent guard was added in a wrong place in rL362701. llvm-svn: 362706
* [clang-tidy] Make the plugin honor NOLINTNikolai Kosjar2019-06-063-18/+112
| | | | | | | | | | | | | | | | | Instantiate a ClangTidyDiagnosticConsumer also for the plugin case and let it forward the diagnostics to the external diagnostic engine that is already in place. One minor difference to the clang-tidy executable case is that the compiler checks/diagnostics are referred to with their original name. For example, for -Wunused-variable the plugin will refer to the check as "-Wunused-variable" while the clang-tidy executable will refer to that as "clang-diagnostic- unused-variable". This is because the compiler diagnostics never reach ClangTidyDiagnosticConsumer. Differential Revision: https://reviews.llvm.org/D61487 llvm-svn: 362702
* [clang-tidy] Fix an assertion failure in misc-redundant-expression.Haojian Wu2019-06-061-1/+1
| | | | | | | | | | | | | | | | | Summary: The assertion "isIntegerConstantExpr" is triggered in the isIntegerConstantExpr(), we should not call it if the expression is value dependent. Reviewers: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62947 llvm-svn: 362701
* android: add a close-on-exec check on pipe()George Burgess IV2019-06-064-0/+74
| | | | | | | | | | | On Android, pipe() is better to be replaced by pipe2() with O_CLOEXEC flag to avoid file descriptor leakage. Patch by Jian Cai! Differential Revision: https://reviews.llvm.org/D61967 llvm-svn: 362673
* android: add a close-on-exec check on pipe2()George Burgess IV2019-06-064-0/+70
| | | | | | | | | | | On Android, pipe2() is better to set O_CLOEXEC flag to avoid file descriptor leakage. Patch by Jian Cai! Differential Revision: https://reviews.llvm.org/D62049 llvm-svn: 362672
* [clang-tidy] Fix make-unique check to work in C++17 mode.Haojian Wu2019-06-031-3/+12
| | | | | | | | | | | | | | | | | | | | Summary: Previously, we intended to omit the check fix to the case when constructor has any braced-init-list argument. But the HasListInitializedArgument was not correct to handle all cases (Foo(Bar{1, 2}) will return false in C++14 mode). This patch fixes it, corrects the tests, and makes the check to run at C++17 mode. Reviewers: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62736 llvm-svn: 362361
* Revise the google-objc-global-variable-declaration check to match the style ↵Stephane Moore2019-05-311-8/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | guide. Summary: Revise the google-objc-global-variable-declaration check to match the style guide. This commit updates the check as follows: (1) Do not emit fixes for extern global constants. (2) Allow the second character of prefixes for constants to be numeric (the new guideline is that global constants should generally be named with a prefix that begins with a capital letter followed by one or more capital letters or numbers). https://google.github.io/styleguide/objcguide.html#prefixes This is an amended re-submission of https://reviews.llvm.org/rG12e3726fadb0b2a4d8aeed0a2817b5159f9d029d. Contributed By: yaqiji Reviewers: Wizard, benhamilton, stephanemoore Reviewed By: benhamilton, stephanemoore Subscribers: mgorny, cfe-commits, yaqiji Tags: #clang Differential Revision: https://reviews.llvm.org/D62045 llvm-svn: 362279
* Rollback "Revise the google-objc-global-variable-declaration check to match ↵Stephane Moore2019-05-291-14/+8
| | | | | | | | | | the style guide." 💥 The change introduced new test failures. Phabricator URL of original commit: https://reviews.llvm.org/rG12e3726fadb0b2a4d8aeed0a2817b5159f9d029d llvm-svn: 361914
* Revise the google-objc-global-variable-declaration check to match the style ↵Stephane Moore2019-05-291-8/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | guide. Summary: Revise the google-objc-global-variable-declaration check to match the style guide. This commit updates the check as follows: (1) Do not emit fixes for extern global constants. (2) Allow the second character of prefixes for constants to be numeric (the new guideline is that global constants should generally be named with a prefix that begins with a capital letter followed by one or more capital letters or numbers). https://google.github.io/styleguide/objcguide.html#prefixes Contributed by yaqiji. Reviewers: Wizard, benhamilton, stephanemoore Reviewed By: benhamilton, stephanemoore Subscribers: mgorny, cfe-commits, yaqiji Tags: #clang Differential Revision: https://reviews.llvm.org/D62045 llvm-svn: 361907
* [clang-tidy] Fix description for misc-definitions-in-headers.Haojian Wu2019-05-281-3/+6
| | | | | | | | | | | | Reviewers: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62524 llvm-svn: 361834
* [clang-tidy] Fix null pointer dereference in readability-identifier-namingHaojian Wu2019-05-281-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | Summary: readability-identifier-naming causes a null pointer dereference when checking an identifier introduced by a structured binding whose right hand side is an undeclared identifier. Running the check on a file that is just the following results in a crash: ``` auto [left] = right; ``` Patch by Mark Stegeman! Reviewers: alexfh, hokein, aaron.ballman, JonasToth Reviewed By: hokein, aaron.ballman Subscribers: madsravn, xazax.hun, cfe-commits Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D62404 llvm-svn: 361809
* [clang-tidy] Fix unused-variable warning after r361647.Haojian Wu2019-05-271-6/+7
| | | | | | | | | | | | | | | | | | | | | Summary: A range-for was added in r361647 where the range variable was only used in an assertion. As a result, it warned for Release builds. This revision restructures the assertion to avoid the problem. Patch by Yitzhak Mandelbaum. Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: xazax.hun, cfe-commits Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D62412 llvm-svn: 361749
* DeleteNullPointerCheck now deletes until the end brace of the condition.Mads Ravn2019-05-261-3/+6
| | | | | | | | Patch by Jonathan Camilleri Differential Revision https://reviews.llvm.org/D61861 llvm-svn: 361735
* Rename clangToolingRefactor to clangToolingRefactoring for consistency with ↵Nico Weber2019-05-251-1/+1
| | | | | | | | | | its directory See "[cfe-dev] The name of clang/lib/Tooling/Refactoring". Differential Revision: https://reviews.llvm.org/D62420 llvm-svn: 361684
* [clang-tidy] In TransformerClangTidyCheck, require Explanation field.Yitzhak Mandelbaum2019-05-242-11/+24
| | | | | | | | | | | | | | | | | | | Summary: In general, the `Explanation` field is optional in `RewriteRule` cases. But, because the primary purpose of clang-tidy checks is to provide users with diagnostics, we assume that a missing explanation is a bug. This change adds an assertion that checks all cases for an explanation, and updates the code to rely on that assertion correspondingly. Reviewers: ilya-biryukov Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62340 llvm-svn: 361647
* [clang-tidy] Add option "LiteralInitializers" to ↵Matthias Gehre2019-05-242-2/+59
| | | | | | | | cppcoreguidelines-pro-type-member-init Differential Revision: D24892 llvm-svn: 361601
* [clang-tidy]: Add cert-oop54-cpp alias for bugprone-unhandled-self-assignmentTamas Zolnai2019-05-234-25/+49
| | | | | | | | | | | | | | | | | | | | Summary: Added WarnOnlyIfThisHasSuspiciousField option to allow to catch any copy assignment operator independently from the container class's fields. Added the cert alias using this option. Reviewers: aaron.ballman Reviewed By: aaron.ballman Subscribers: mgorny, Eugene.Zelenko, xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62192 llvm-svn: 361550
* [clang-tidy] New check calling out uses of +new in Objective-C codeDmitri Gribenko2019-05-234-0/+172
| | | | | | | | | | | | | | | | | | | | | Summary: Google's Objective-C style guide forbids calling or overriding +new to instantiate objects. This check warns on violations. Style guide reference: https://google.github.io/styleguide/objcguide.html#do-not-use-new Patch by Michael Wyman. Reviewers: benhamilton, aaron.ballman, JonasToth, gribozavr, ilya-biryukov, stephanemoore, mwyman Reviewed By: aaron.ballman, gribozavr, stephanemoore, mwyman Subscribers: stephanemoore, xazax.hun, Eugene.Zelenko, mgorny, cfe-commits Tags: #clang, #clang-tools-extra Differential Revision: https://reviews.llvm.org/D61350 llvm-svn: 361487
* Remove unnecessary const&s; NFCGeorge Burgess IV2019-05-233-3/+3
| | | | | | | | | It's uncommon to rely on temporary lifetime extension when having a regular, non-`const&` value behaves identically. Since `Twine::str` and `buildFixMsgForStringFlag` both return regular `std::string`s, there's seemingly no point in having `const&` here. llvm-svn: 361457
* [clang-tidy] Add support for writing a check as a Transformer rewrite rule.Yitzhak Mandelbaum2019-05-223-0/+114
| | | | | | | | | | | | | | | | | | | | | | | | This revision introduces an adaptor from Transformer's rewrite rules (`clang::tooling::RewriteRule`) to `ClangTidyCheck`. For example, given a RewriteRule `MyCheckAsRewriteRule`, it lets one define a tidy check as follows: ``` class MyTidyCheck : public TransformerClangTidyCheck { public: MyTidyCheck(StringRef Name, ClangTidyContext *Context) : TransformerClangTidyCheck(MyCheckAsRewriteRule, Name, Context) {} }; ``` Reviewers: aaron.ballman Subscribers: mgorny, xazax.hun, cfe-commits, ilya-biryukov Tags: #clang Differential Revision: https://reviews.llvm.org/D61386 llvm-svn: 361418
* [clang-tidy] remove default header-filter for run-clang-tidyDon Hinton2019-05-221-3/+0
| | | | | | | | | | | | | | | | | | | | | | Summary: run-clang-tidy.py was enforcing '-header-filter' parameter with an unfortunate default value when none was given. Thus, leading to overwritten clang-tidy configuration (e.g. from .clang-tidy). This change removes the default value for '-header-filter' resulting in the default behaviour of clang-tidy itself. Fixes PR#41426 Reviewed By: hintonda Patch by Torbjörn Klatt! Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D61747 llvm-svn: 361344
* [clang-tidy] New option for misc-throw-by-value-catch-by-referenceAdam Balogh2019-05-212-2/+18
| | | | | | | | | | | | | | Catching trivial objects by value is not dangerous but may be inefficient if they are too large. This patch adds an option `WarnOnLargeObject` to the checker to also warn if such an object is caught by value. An object is considered as "large" if its size is greater than `MaxSize` which is another option. Default value is the machine word of the architecture (size of the type `size_t`). Differential Revision: https://reviews.llvm.org/D61851 llvm-svn: 361225
* [clang-tidy] Sort this list alphabeticallyTamas Zolnai2019-05-201-2/+2
| | | | llvm-svn: 361138
* [clangd] Respect clang-tidy suppression commentsFangrui Song2019-05-192-11/+44
| | | | | | | | | | | | This partially fixes https://bugs.llvm.org/show_bug.cgi?id=41218. Reviewed By: sammccall Patch by Nathan Ridge! Differential Revision: https://reviews.llvm.org/D60953 llvm-svn: 361112
* [Lex] Allow to consume tokens while preprocessingIlya Biryukov2019-05-171-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: By adding a hook to consume all tokens produced by the preprocessor. The intention of this change is to make it possible to consume the expanded tokens without re-runnig the preprocessor with minimal changes to the preprocessor and minimal performance penalty when preprocessing without recording the tokens. The added hook is very low-level and reconstructing the expanded token stream requires more work in the client code, the actual algorithm to collect the tokens using this hook can be found in the follow-up change. Reviewers: rsmith Reviewed By: rsmith Subscribers: eraman, nemanjai, kbarton, jsji, riccibruno, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59885 llvm-svn: 361007
* [clang-tidy] Removed superfluous and slightly annoying newlines in ↵Jonas Toth2019-05-161-2/+2
| | | | | | | | | | | | | | | | | | | | run-clang-tidy's output. Summary: The output of clang-tidy itself already has enough newlines, so the resulting output is more in line with the usual compiler output. Patch by svenpanne. Reviewers: alexfh, JonasToth Reviewed By: JonasToth Subscribers: JonasToth, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61850 llvm-svn: 360883
* [clang-tidy] Handle member variables in readability-simplify-boolean-exprJonas Toth2019-05-161-18/+17
| | | | | | | | | | | | | | | | | - Add readability-simplify-boolean-expr test cases for member variables Fixes PR40179 Patch by LegalizeAdulthood. Reviewers: alexfh, hokein, aaron.ballman, JonasToth Reviewed By: JonasToth Subscribers: jdoerfert, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D56323 llvm-svn: 360882
* [clang-tidy] Do not list enabled checks when -quiet is given to run-clang-tidy.Jonas Toth2019-05-161-1/+6
| | | | | | | | | | | | | | | | | | Summary: When run-clang-tidy is given the -quiet flag, do not output the potentially hundreds of enabled check names at the beginning. Patch by svenpanne. Reviewers: alexfh, JonasToth Reviewed By: JonasToth Subscribers: JonasToth, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61849 llvm-svn: 360869
* [clang-tidy] Recommit r360785 "modernize-loop-convert: impl const cast iter" ↵Don Hinton2019-05-151-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with correct attribution Summary: modernize-loop-convert was not detecting implicit casts to const_iterator as convertible to range-based loops: std::vector<int> vec{1,2,3,4} for(std::vector<int>::const_iterator i = vec.begin(); i != vec.end(); ++i) { } Thanks to Don Hinton for advice. As well, this change adds a note for this check's applicability to code targeting OpenMP prior version 5 as this check will continue breaking compilation with `-fopenmp`. Thanks to Roman Lebedev for pointing this out. Fixes PR#35082 Patch by Torbjörn Klatt! Reviewed By: hintonda Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D61827 llvm-svn: 360788
* Revert [clang-tidy] modernize-loop-convert: impl const cast iterDon Hinton2019-05-151-0/+5
| | | | | | This reverts r360785 (git commit 42d28be802fe5beab18bc1a27f89894c0a290d44) llvm-svn: 360787
OpenPOWER on IntegriCloud