summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy
Commit message (Collapse)AuthorAgeFilesLines
...
* clang/Modules: Rename CompilerInstance::ModuleManager, NFCDuncan P. N. Exon Smith2019-11-221-2/+2
| | | | | | | | | | | | | | | | | | | Fix the confusing naming of `CompilerInstance::ModuleManager`. This is actually an instance of `ASTReader`, which contains an instance of `ModuleManager`. I have to assume there was a point in the past where they were just one class, but it's been pretty confusing for a while. I think it's time to fix it. The new name is `TheASTReader`; the annoying `The` prefix is so that we don't shadow the `ASTReader` class. I tried out `ASTRdr` but that seemed less clear, and this choice matches `ThePCHContainerOperations` just a couple of declarations below. Also rename `CompilerInstance::getModuleManager` and `CompilerInstance::createModuleManager` to `*ASTReader`, making some cases of `getModuleManager().getModuleManager()` a little more clear. https://reviews.llvm.org/D70583
* [clang-tidy] new performance-no-automatic-move check.Clement Courbet2019-11-224-0/+114
| | | | | | | | | | | | Summary: The check flags constructs that prevent automatic move of local variables. Reviewers: aaron.ballman Subscribers: mgorny, xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70390
* [clang-tidy] modernize-use-equals-default avoid adding redundant semicolonsMitchell Balan2019-11-203-2/+25
| | | | | | | | | | | | | | | | | | | Summary: `modernize-use-equals-default` replaces default constructors/destructors with `= default;`. When the optional semicolon after a member function is present, this results in two consecutive semicolons. This patch checks to see if the next non-comment token after the code to be replaced is a semicolon, and if so offers a replacement of `= default` rather than `= default;`. This patch adds trailing comments and semicolons to about 5 existing tests. Reviewers: malcolm.parsons, angelgarcia, aaron.ballman, alexfh Patch by: poelmanc Subscribers: MyDeveloperDay, JonasToth, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70144
* [NFC] Refactor representation of materialized temporariesTyker2019-11-195-5/+5
| | | | | | | | | | | | | | | Summary: this patch refactor representation of materialized temporaries to prevent an issue raised by rsmith in https://reviews.llvm.org/D63640#inline-612718 Reviewers: rsmith, martong, shafik Reviewed By: rsmith Subscribers: thakis, sammccall, ilya-biryukov, rnkovacs, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69360
* [clang-tidy] Give readability-redundant-member-init an option ↵Mitchell Balan2019-11-192-6/+24
| | | | | | | | | | | | | | | | | | | IgnoreBaseInCopyConstructors to avoid breaking code with gcc -Werror=extra Summary: readability-redundant-member-init removes redundant / unnecessary member and base class initialization. Unfortunately for the specific case of a copy constructor's initialization of a base class, gcc at strict warning levels warns if "base class is not initialized in the copy constructor of a derived class". This patch adds an option `IgnoreBaseInCopyConstructors` defaulting to 0 (thus maintaining current behavior by default) to skip the specific case of removal of redundant base class initialization in the copy constructor. Enabling this option enables the resulting code to continue to compile successfully under `gcc -Werror=extra`. New test cases `WithCopyConstructor1` and `WithCopyConstructor2` in clang-tools-extra/test/clang-tidy/readability-redundant-member-init.cpp show that it removes redundant members even from copy constructors. Reviewers: malcolm.parsons, alexfh, hokein, aaron.ballman, lebedev.ri Patch by: poelmanc Subscribers: mgehre, lebedev.ri, cfe-commits Tags: #clang, #clang-tools-extra Differential revision: https://reviews.llvm.org/D69145
* [clang-tidy] modernize-use-override new option AllowOverrideAndFinalMitchell Balan2019-11-192-4/+9
| | | | | | | | | | | | | | | | | | | Summary: In addition to adding `override` wherever possible, clang-tidy's `modernize-use-override` nicely removes `virtual` when `override` or `final` is specified, and further removes override when final is specified. While this is great default behavior, when code needs to be compiled with gcc at high warning levels that include `gcc -Wsuggest-override` or `gcc -Werror=suggest-override`, clang-tidy's removal of the redundant `override` keyword causes gcc to emit a warning or error. This discrepancy / conflict has been noted by others including a comment on Stack Overflow and by Mozilla's Firefox developers. This patch adds an AllowOverrideAndFinal option defaulting to 0 - thus preserving current behavior - that when enabled allows both `override` and `final` to co-exist, while still fixing all other issues. The patch includes a test file verifying all combinations of virtual/override/final, and mentions the new option in the release notes. Reviewers: alexfh, djasper, JonasToth Patch by: poelmanc Subscribers: JonasToth, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70165
* [clang-tidy] Fix readability-redundant-string-init for c++17/c++2aMitchell Balan2019-11-191-6/+7
| | | | | | | | | | | | | | | | | | | Summary: `readability-redundant-string-init` was one of several clang-tidy checks documented as failing for C++17. (The failure mode in C++17 is that it changes `std::string Name = ""`; to `std::string Name = Name;`, which actually compiles but crashes at run-time.) Analyzing the AST with `clang -Xclang -ast-dump` showed that the outer `CXXConstructExprs` that previously held the correct SourceRange were being elided in C++17/2a, but the containing `VarDecl` expressions still had all the relevant information. So this patch changes the fix to get its source ranges from `VarDecl`. It adds one test `std::string g = "u", h = "", i = "uuu", j = "", k;` to confirm proper warnings and fixit replacements in a single `DeclStmt` where some strings require replacement and others don't. The readability-redundant-string-init.cpp and readability-redundant-string-init-msvc.cpp tests now pass for C++11/14/17/2a. Reviewers: gribozavr, etienneb, alexfh, hokein, aaron.ballman, gribozavr2 Patch by: poelmanc Subscribers: NoQ, MyDeveloperDay, Eugene.Zelenko, dylanmckay, cfe-commits Tags: #clang, #clang-tools-extra Differential Revision: https://reviews.llvm.org/D69238
* Revert "[clang-tidy] modernize-use-override new option AllowOverrideAndFinal"Mitchell Balan2019-11-191-7/+6
| | | | This reverts commit 50e99563fb0459f5160572eef3c4e6062b8ad3f2.
* Revert "[clang-tidy] Fix readability-redundant-string-init for c++17/c++2a"Mitchell Balan2019-11-192-9/+4
| | | | This reverts commit 06f3dabe4a2e85a32ade27c0769b6084c828a206.
* [clang-tidy] Added DefaultOperatorNewCheck.Balázs Kéri2019-11-194-5/+119
| | | | | | | | | | | | | | | | Summary: Added new checker 'cert-default-operator-new' that checks for CERT rule MEM57-CPP. Simple version. Reviewers: aaron.ballman, alexfh, JonasToth, lebedev.ri Reviewed By: aaron.ballman Subscribers: hiraditya, martong, mehdi_amini, mgorny, inglorion, xazax.hun, dkrupp, steven_wu, dexonsmith, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67545
* Revert "[NFC] Refactor representation of materialized temporaries"Nico Weber2019-11-175-5/+5
| | | | | | This reverts commit 08ea1ee2db5f9d6460fef1d79d0d1d1a5eb78982. It broke ./ClangdTests/FindExplicitReferencesTest.All on the bots, see comments on https://reviews.llvm.org/D69360
* [NFC] Refactor representation of materialized temporariesTyker2019-11-165-5/+5
| | | | | | | | | | | | | | | Summary: this patch refactor representation of materialized temporaries to prevent an issue raised by rsmith in https://reviews.llvm.org/D63640#inline-612718 Reviewers: rsmith, martong, shafik Reviewed By: rsmith Subscribers: rnkovacs, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69360
* Remove +x permission on some filesSylvestre Ledru2019-11-162-0/+0
|
* Avoid including Builtins.h in Preprocessor.hReid Kleckner2019-11-151-0/+1
| | | | | | Builtins are rarely if ever accessed via the Preprocessor. They are typically found on the ASTContext, so there should be no performance penalty to using a pointer indirection to store the builtin context.
* [clang-tidy] Give readability-redundant-string-init a customizable list of ↵Mitchell Balan2019-11-152-11/+41
| | | | | | | | | | | | | | | | | | | string types to fix Summary: This patch adds a feature requested in https://reviews.llvm.org/D69238 to enable `readability-redundant-string-init` to take a list of strings to apply the fix to rather than hard-coding `basic_string`. It adds a `StringNames` option of semicolon-delimited names of string classes to which to apply this fix. Tests ensure this works with test class out::TestString as well as std::string and std::wstring as before. It should be applicable to llvm::StringRef, QString, etc. Note: This commit was previously reverted due to a failing unit test. That test has been fixed in this version. Reviewers: MyDeveloperDay, aaron.ballman, hokein, alexfh, JonasToth, gribozavr2 Patch by: poelmanc Subscribers: gribozavr2, xazax.hun, Eugene.Zelenko, cfe-commits Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D69548
* [clang-tidy] Fix readability-redundant-string-init for c++17/c++2aMitchell Balan2019-11-152-4/+9
| | | | | | | | | | | | | | | | | | | Summary: `readability-redundant-string-init` was one of several clang-tidy checks documented as failing for C++17. (The failure mode in C++17 is that it changes `std::string Name = ""`; to `std::string Name = Name;`, which actually compiles but crashes at run-time.) Analyzing the AST with `clang -Xclang -ast-dump` showed that the outer `CXXConstructExprs` that previously held the correct SourceRange were being elided in C++17/2a, but the containing `VarDecl` expressions still had all the relevant information. So this patch changes the fix to get its source ranges from `VarDecl`. It adds one test `std::string g = "u", h = "", i = "uuu", j = "", k;` to confirm proper warnings and fixit replacements in a single `DeclStmt` where some strings require replacement and others don't. The readability-redundant-string-init.cpp and readability-redundant-string-init-msvc.cpp tests now pass for C++11/14/17/2a. Reviewers: gribozavr, etienneb, alexfh, hokein, aaron.ballman, gribozavr2 Patch by: poelmanc Subscribers: NoQ, MyDeveloperDay, Eugene.Zelenko, dylanmckay, cfe-commits Tags: #clang, #clang-tools-extra Differential Revision: https://reviews.llvm.org/D69238
* Revert "[clang-tidy] Give readability-redundant-string-init a customizable ↵Mitchell Balan2019-11-152-41/+11
| | | | | | list of string types to fix" This reverts commit 96fbc32cb9ea23b1e7e3ff6906ec3ccda9500982.
* [clang-tidy] Give readability-redundant-string-init a customizable list of ↵Mitchell Balan2019-11-152-11/+41
| | | | | | | | | | | | | | | | | string types to fix Summary: This patch adds a feature requested in https://reviews.llvm.org/D69238 to enable `readability-redundant-string-init` to take a list of strings to apply the fix to rather than hard-coding `basic_string`. It adds a `StringNames` option of semicolon-delimited names of string classes to which to apply this fix. Tests ensure this works with test class out::TestString as well as std::string and std::wstring as before. It should be applicable to llvm::StringRef, QString, etc. Reviewers: MyDeveloperDay, aaron.ballman, hokein, alexfh, JonasToth, gribozavr2 Patch by: poelmanc Subscribers: gribozavr2, xazax.hun, Eugene.Zelenko, cfe-commits Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D69548
* [clang-tidy] modernize-use-override new option AllowOverrideAndFinalMitchell Balan2019-11-151-13/+13
| | | | | | | | | | | | | | | | | | | Summary: In addition to adding `override` wherever possible, clang-tidy's `modernize-use-override` nicely removes `virtual` when `override` or `final` is specified, and further removes override when final is specified. While this is great default behavior, when code needs to be compiled with gcc at high warning levels that include `gcc -Wsuggest-override` or `gcc -Werror=suggest-override`, clang-tidy's removal of the redundant `override` keyword causes gcc to emit a warning or error. This discrepancy / conflict has been noted by others including a comment on Stack Overflow and by Mozilla's Firefox developers. This patch adds an AllowOverrideAndFinal option defaulting to 0 - thus preserving current behavior - that when enabled allows both `override` and `final` to co-exist, while still fixing all other issues. The patch includes a test file verifying all combinations of virtual/override/final, and mentions the new option in the release notes. Reviewers: alexfh, djasper, JonasToth Patch by: poelmanc Subscribers: JonasToth, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70165
* [clang-tidy] modernize-use-using work with multi-argument templatesMitchell Balan2019-11-151-11/+31
| | | | | | | | | | | | | | | | | | | | | | | Summary: If clang-tidy's modernize-use-using feature finds any commas that are not within parentheses, it won't create a fix. That means it won't change lines like: typedef std::pair<int, int> Point; to using Point = std::pair<int, int>; or even: typedef std::map<std::string, Foo> MyMap; typedef std::vector<int,MyCustomAllocator<int>> MyVector; This patch allows the fix to apply to lines with commas if they are within parentheses or angle brackets that were not themselves within parentheses. Reviewers: alexfh, hokein, aaron.ballman Patch by: poelmanc Subscribers: jonathanmeier, cfe-commits Tags: #clang, #clang-tools-extra Differential Revision: https://reviews.llvm.org/D67460
* [libTooling] Further simplify `Stencil` type and introduce `MatchComputation`.Yitzhak Mandelbaum2019-11-111-1/+1
| | | | | | | | | | | | | | | | | | | | Summary: This revision introduces a new interface `MatchComputation` which generalizes the `Stencil` interface and replaces the `std::function` interface of `MatchConsumer`. With this revision, `Stencil` (as an abstraction) becomes just one collection of implementations of `MatchComputation<std::string>`. Correspondingly, we remove the `Stencil` class entirely in favor of a simple type alias, deprecate `MatchConsumer` and change all functions that accepted `MatchConsumer<std::string>` to use `MatchComputation<std::string>` instead. Reviewers: gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69802
* [clang-tidy] Add bugprone-bad-signal-to-kill-thread check and its alias ↵Abel Kocsis2019-11-115-0/+115
| | | | cert-pos44-c
* Revert "[clang-tidy] Add bugprone-bad-signal-to-kill-thread checker and ↵Abel Kocsis2019-11-115-115/+0
| | | | | | alias cert-pos44-c" This reverts commit 4edf0cb0e03e31d468979d0d7dec08bd9f4f8204.
* [clang-tidy] Add bugprone-bad-signal-to-kill-thread checker and alias ↵Abel Kocsis2019-11-115-0/+115
| | | | cert-pos44-c
* [clang-tidy] Update TransformerClangTidyCheck to use new Transformer bindings.Yitzhak Mandelbaum2019-11-062-9/+9
| | | | | | | | | | | | | | Summary: Updates the relevant source files to use bindings in `clang::transformer` rather than `clang::tooling`. Reviewers: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69804
* [clang-tidy] Add readability-make-member-function-constMatthias Gehre2019-11-064-0/+302
| | | | | | | | | | | | | | | | | | Summary: Finds non-static member functions that can be made ``const`` because the functions don't use ``this`` in a non-const way. The check conservatively tries to preserve logical costness in favor of physical costness. See readability-make-member-function-const.rst for more details. Reviewers: aaron.ballman, gribozavr, hokein, alexfh Subscribers: mgorny, xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68074
* [clang-tidy] New checker performance-trivially-destructible-checkAnton Bikineev2019-11-017-1/+148
| | | | | | | | | | | | | Checks for types which can be made trivially-destructible by removing out-of-line defaulted destructor declarations. The check is motivated by the work on C++ garbage collector in Blink (rendering engine for Chrome), which strives to minimize destructors and improve runtime of sweeping phase. In the entire chromium codebase the check hits over 2000 times. Differential Revision: https://reviews.llvm.org/D69435
* Fix readability-identifier-naming to prevent variables becoming keywords.Daniel2019-10-302-22/+68
| | | | | Do not provide a fix-it when clang-tidy encounters a name that would become a keyword.
* Add an option to hicpp-signed-bitwise for positive integer literals.Vladimir Plyashkun2019-10-302-3/+21
| | | | | This gives developers a way to deviate from the coding standard to reduce the chattiness of the check.
* Fix modernize-use-nodiscard for classes marked [[nodiscard]]Aaron Ballman2019-10-301-1/+3
| | | | | | | Current implementation suggests to add [[nodiscard]] to methods even if the return type is marked already as [[nodiscard]]. Patch by Eugene Sedykh.
* Fix a false positive in misc-redundant-expression checkAaron Ballman2019-10-301-7/+60
| | | | | | | | Do not warn for redundant conditional expressions when the true and false branches are expanded from different macros even when they are defined by one another. Patch by Daniel Krupp.
* Add the readability-redundant-access-specifiers check.Aaron Ballman2019-10-304-0/+128
| | | | | | This finds redundant access specifier declarations inside classes, structs, and unions. Patch by Mateusz Mackowski.
* clang-tidy - silence static analyzer getAs<> null dereference warnings. NFCI.Simon Pilgrim2019-10-172-5/+5
| | | | | | The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us. llvm-svn: 375102
* [clang-tools-extra] Fix overzealous linking of dylib to clangTidyMichal Gorny2019-10-151-1/+1
| | | | | | | | | | | | | | Fix accidentally making clangTidy library link to dylib. This causes libclang.so to also link to dylib which results in duplicate symbols from shared and static libraries, and effectively to registering command-line options twice. Thanks to Sylvestre Ledru for noticing this and tracking it down to r373786. Fixes PR#43589. Differential Revision: https://reviews.llvm.org/D68927 llvm-svn: 374885
* [clang-scan-deps] Support for clang --analyze in clang-scan-depsJan Korous2019-10-141-4/+3
| | | | | | | | | | | | | | | The goal is to have 100% fidelity in clang-scan-deps behavior when --analyze is present in compilation command. At the same time I don't want to break clang-tidy which expects __static_analyzer__ macro defined as built-in. I introduce new cc1 options (-setup-static-analyzer) that controls the macro definition and is conditionally set in driver. Differential Revision: https://reviews.llvm.org/D68093 llvm-svn: 374815
* [clang-tidy] bugprone-not-null-terminated-result: checker adjustments 2Csaba Dabis2019-10-131-7/+8
| | | | llvm-svn: 374712
* [clang-tidy] bugprone-not-null-terminated-result: checker adjustmentsCsaba Dabis2019-10-131-6/+6
| | | | llvm-svn: 374711
* [clang-tidy] New checker for not null-terminated result caused by strlen(), ↵Csaba Dabis2019-10-134-0/+1077
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | size() or equal length Summary: New checker called bugprone-not-null-terminated-result. This checker finds function calls where it is possible to cause a not null-terminated result. Usually the proper length of a string is `strlen(src) + 1` or equal length of this expression, because the null terminator needs an extra space. Without the null terminator it can result in undefined behaviour when the string is read. The following and their respective `wchar_t` based functions are checked: `memcpy`, `memcpy_s`, `memchr`, `memmove`, `memmove_s`, `strerror_s`, `strncmp`, `strxfrm` The following is a real-world example where the programmer forgot to increase the passed third argument, which is `size_t length`. That is why the length of the allocated memory is not enough to hold the null terminator. ``` static char *stringCpy(const std::string &str) { char *result = reinterpret_cast<char *>(malloc(str.size())); memcpy(result, str.data(), str.size()); return result; } ``` In addition to issuing warnings, fix-it rewrites all the necessary code. It also tries to adjust the capacity of the destination array: ``` static char *stringCpy(const std::string &str) { char *result = reinterpret_cast<char *>(malloc(str.size() + 1)); strcpy(result, str.data()); return result; } ``` Note: It cannot guarantee to rewrite every of the path-sensitive memory allocations. Reviewed By: JonasToth, aaron.ballman, whisperity, alexfh Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D45050 llvm-svn: 374707
* Updated add_new_check.py to create checker tests in the new directoryDmitri Gribenko2019-10-111-1/+1
| | | | llvm-svn: 374551
* [libTooling] Move Transformer files to their own directory/library.Yitzhak Mandelbaum2019-10-102-2/+2
| | | | | | | | | | | | | | | | | | | Summary: The Transformer library has been growing inside of lib/Tooling/Refactoring. However, it's not really related to anything else in that directory. This revision moves all Transformer-related files into their own include & lib directories. A followup revision will (temporarily) add forwarding headers to help any users migrate their code to the new location. Reviewers: gribozavr Subscribers: mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68637 llvm-svn: 374271
* [clang-tools-extra] [cmake] Link against libclang-cpp whenever possibleMichal Gorny2019-10-042-3/+6
| | | | | | | | | Use clang_target_link_libraries() in order to support linking against libclang-cpp instead of static libraries. Differential Revision: https://reviews.llvm.org/D68448 llvm-svn: 373786
* Add the misc-init-local-variables check.Aaron Ballman2019-10-024-0/+151
| | | | | | | | This checks finds all primitive type local variables (integers, doubles, pointers) that are declared without an initial value. Includes fixit functionality to initialize said variables with a default value. This is zero for most types and NaN for floating point types. The use of NaNs is copied from the D programming language. Patch by Jussi Pakkanen. llvm-svn: 373489
* [clang-tidy] Fix for commits rL372706 and rL372711Adam Balogh2019-10-021-9/+8
| | | | | | | | | The patch committed was not the accepted version but the previous one. This commit fixes this issue. Differential Revision: https://reviews.llvm.org/D64736 llvm-svn: 373428
* [clang-tidy] Rename objc-avoid-spinlock check to darwin-avoid-spinlockStephane Moore2019-10-016-12/+12
| | | | | | | | | | | | | | | | | | | | | | | Summary: OSSpinLock* are Apple/Darwin functions, but were previously located with ObjC checks as those were most closely tied to Apple platforms before. Now that there's a specific Darwin module, relocating the check there. This change was prepared by running rename_check.py. Contributed By: mwyman Reviewers: stephanemoore, dmaclach Reviewed By: stephanemoore Subscribers: Eugene.Zelenko, mgorny, xazax.hun, cfe-commits Tags: #clang-tools-extra, #clang, #llvm Differential Revision: https://reviews.llvm.org/D68148 llvm-svn: 373392
* [clang-tidy] Fix module registry name and description for Darwin clang-tidy ↵Dmitri Gribenko2019-10-011-1/+1
| | | | | | | | | | | | | | | | | | module. Summary: When creating the module, must have copy-pasted from the misc module, and forgotten to update the name/description of the module in the registry. Reviewers: stephanemoore, benhamilton, gribozavr Reviewed By: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang, #clang-tools-extra, #llvm Differential Revision: https://reviews.llvm.org/D68251 llvm-svn: 373304
* clang-tidy: Don't repeat list of all checks in three places.Nico Weber2019-09-274-54/+37
| | | | | | | | | | | | Instead, put all checks in a cmake variable and reference this. Also, make clangd use the the ClangTidyForceLinker.h header instead of duplicating the list of modules -- the duplicate copy was missing the new "darwin" checker added in r373065. Differential Revision: https://reviews.llvm.org/D68132 llvm-svn: 373082
* [clang-tidy] New check to warn when storing dispatch_once_t in non-static, ↵Dmitri Gribenko2019-09-278-0/+157
| | | | | | | | | | | | | | | | | | | | | non-global storage. Summary: Creates a new darwin ClangTidy module and adds the darwin-dispatch-once-nonstatic check that warns about dispatch_once_t variables not in static or global storage. This catches a missing static for local variables in e.g. singleton initialization behavior, and also warns on storing dispatch_once_t values in Objective-C instance variables. C/C++ struct/class instances may potentially live in static/global storage, and are ignored for this check. The osx.API static analysis checker can find the non-static storage use of dispatch_once_t; I thought it useful to also catch this issue in clang-tidy when possible. This is a re-land of https://reviews.llvm.org/D67567 Reviewers: thakis, gribozavr, stephanemoore Subscribers: Eugene.Zelenko, mgorny, xazax.hun, jkorous, arphaman, kadircet, usaxena95 Tags: #clang-tools-extra, #clang, #llvm Differential Revision: https://reviews.llvm.org/D68109 llvm-svn: 373065
* Revert "[clang-tidy] New check to warn when storing dispatch_once_t in ↵Dmitri Gribenko2019-09-268-157/+0
| | | | | | | | non-static, non-global storage" This reverts commit r373028, because the new test fails on Linux. llvm-svn: 373032
* [clang-tidy] New check to warn when storing dispatch_once_t in non-static, ↵Stephane Moore2019-09-268-0/+157
| | | | | | | | | | | | | | | | | | | | | | | non-global storage Summary: Creates a new darwin ClangTidy module and adds the darwin-dispatch-once-nonstatic check that warns about dispatch_once_t variables not in static or global storage. This catches a missing static for local variables in e.g. singleton initialization behavior, and also warns on storing dispatch_once_t values in Objective-C instance variables. C/C++ struct/class instances may potentially live in static/global storage, and are ignored for this check. The osx.API static analysis checker can find the non-static storage use of dispatch_once_t; I thought it useful to also catch this issue in clang-tidy when possible. Contributed By: mwyman Reviewers: benhamilton, hokein, stephanemoore, aaron.ballman, gribozavr Reviewed By: stephanemoore, gribozavr Subscribers: jkorous, arphaman, kadircet, usaxena95, NoQ, xazax.hun, lebedev.ri, mgorny, cfe-commits Tags: #clang, #clang-tools-extra Differential Revision: https://reviews.llvm.org/D67567 llvm-svn: 373028
* Return results by value from ClangTidyCheckFactories::createChecksDmitri Gribenko2019-09-263-13/+11
| | | | llvm-svn: 372979
OpenPOWER on IntegriCloud