summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang-tidy] Replace deprecated std::ios_base aliasesJonas Toth2018-10-054-0/+120
| | | | | | | | | | | | | This check warns the uses of the deprecated member types of std::ios_base and replaces those that have a non-deprecated equivalent. Patch by andobence! Reviewd by: alexfh Revision ID: https://reviews.llvm.org/D51332 llvm-svn: 343848
* [clang-tidy] fix PR39167, bugprone-exception-escape hangs-upJonas Toth2018-10-041-0/+3
| | | | | | | | | | | | | | | | | Summary: The check bugprone-exception-escape should not register if -fno-exceptions is set for the compile options. Bailing out on non-cplusplus and non-exceptions language options resolves the issue. Reviewers: alexfh, aaron.ballman, baloghadamsoftware Reviewed By: alexfh Subscribers: lebedev.ri, xazax.hun, rnkovacs, cfe-commits Differential Revision: https://reviews.llvm.org/D52880 llvm-svn: 343789
* [clang-tidy] Added pointer types to clang-tidy readability-identifier-naming ↵Jonas Toth2018-10-041-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | check. Summary: Option to check for different naming conventions on the following types: - GlobalConstantPointer - GlobalPointer - LocalConstantPointer - LocalPointer - PointerParameter - ConstantPointerParameter When not specified, the conventions for the non pointer types will be applied (GlobalConstant, GlobalVariable, LocalConstant, ...). Patch by ffigueras! Reviewers: alexfh, kbobyrev Reviewed By: alexfh Subscribers: xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D52882 llvm-svn: 343788
* [clang-tidy] Sequence statements with multiple parents correctly (PR39149)Martin Bohme2018-10-043-6/+14
| | | | | | | | | | | | | | | | | | | | | Summary: Before this fix, the bugprone-use-after-move check could incorrectly conclude that a use and move in a function template were not sequenced. For details, see https://bugs.llvm.org/show_bug.cgi?id=39149 Reviewers: alexfh, hokein, aaron.ballman, JonasToth Reviewed By: aaron.ballman Subscribers: xazax.hun, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D52782 llvm-svn: 343768
* [clang-tidy] NFC reorder registering in CppCoreGuidelines moduleJonas Toth2018-10-031-2/+2
| | | | llvm-svn: 343673
* [clang-tidy] Ignore singe bit bitfield -> bool conversion in ↵Alexander Kornienko2018-10-021-0/+1
| | | | | | readability-implicit-bool-conversion llvm-svn: 343578
* [clang-tidy] Build it even without static analyzerStephen Kelly2018-10-016-5/+39
| | | | | | | | | | | | | | | | | | | | | | Conditionally compile the parts of clang-tidy which depend on the static analyzer. Funnily enough, I made the patch to exclude this from the build in 2013, and it was committed with the comment that the tool should not be fully excluded, but only the parts of it which depend on the analyzer should be excluded. http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20130617/081797.html This commit implements that idea. Reviewed By: aaron.ballman Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D52334 llvm-svn: 343528
* Reverting r343415 as it breaks at least one of the bots.Aaron Ballman2018-09-306-36/+5
| | | | | | http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/37336 llvm-svn: 343418
* Allow clang-tidy to be built without a dependency on the clang static analyzer.Aaron Ballman2018-09-306-5/+36
| | | | | | Patch by Stephen Kelly. llvm-svn: 343415
* [clang-tidy] Add dependency to clangAnalysis after rC343160Fangrui Song2018-09-271-0/+1
| | | | llvm-svn: 343168
* llvm::sort(C.begin(), C.end()) -> llvm::sort(C)Fangrui Song2018-09-271-1/+1
| | | | | | The convenience wrapper in STLExtras is available since rL342102. llvm-svn: 343166
* [clang-tidy] Add modernize-concat-nested-namespaces checkJonas Toth2018-09-254-0/+158
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Finds instances of namespaces concatenated using explicit syntax, such as `namespace a { namespace b { [...] }}` and offers fix to glue it to `namespace a::b { [...] }`. Properly handles `inline` and unnamed namespaces. ~~Also, detects empty blocks in nested namespaces and offers to remove them.~~ Test with common use cases included. I ran the check against entire llvm repository. Except for expected `nested namespace definitions only available with -std=c++17 or -std=gnu++17` warnings I noticed no issues when the check was performed. Example: ``` namespace a { namespace b { void test(); }} ``` can become ``` namespace a::b { void test(); } ``` Patch by wgml! Reviewers: alexfh, aaron.ballman, hokein Reviewed By: aaron.ballman Subscribers: JonasToth, Eugene.Zelenko, lebedev.ri, mgorny, xazax.hun, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D52136 llvm-svn: 343000
* [Clang-tidy] Alphabetical sort of files/checks. Add space after clang-tidy ↵Eugene Zelenko2018-09-2011-20/+20
| | | | | | in source code headers. llvm-svn: 342601
* [clang-tidy] run-clang-tidy.py - fails using python 3.7Andi-Bogdan Postelnicu2018-09-191-3/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D51220 llvm-svn: 342540
* [clang-tidy] Replace redundant checks with an assert().Artem Belevich2018-09-181-2/+3
| | | | | | | | | | findStyleKind is only called if D is an explicit identifier with a name, so the checks for operators will never return true. The explicit assert() enforces this invariant. Differential Revision: https://reviews.llvm.org/D52179 llvm-svn: 342514
* [clang-tidy] Remove duplicated logic in UnnecessaryValueParamCheck and use ↵Shuai Wang2018-09-172-15/+12
| | | | | | | | | | | | FunctionParmMutationAnalyzer instead. Reviewers: alexfh, JonasToth, george.karpenkov Subscribers: xazax.hun, kristof.beyls, chrib, a.sidorin, Szelethus, cfe-commits Differential Revision: https://reviews.llvm.org/D52158 llvm-svn: 342403
* [clang-tidy] fix PR37913, templated exception factory diagnosed correctlyJonas Toth2018-09-171-8/+26
| | | | | | | | | | | | | | | | | | | Summary: PR37913 documents wrong behaviour for a templated exception factory function. The check does misidentify dependent types as not derived from std::exception. The fix to this problem is to ignore dependent types, the analysis works correctly on the instantiated function. Reviewers: aaron.ballman, alexfh, hokein, ilya-biryukov Reviewed By: alexfh Subscribers: lebedev.ri, nemanjai, mgorny, kbarton, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D48714 llvm-svn: 342393
* [Clang-Tidy: modernize] Fix for modernize-redundant-void-arg: complains ↵Idriss Riouak2018-09-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | about variable cast to void Summary: Hello, i would like to suggest a fix for one of the checks in clang-tidy.The bug was reported in https://bugs.llvm.org/show_bug.cgi?id=32575 where you can find more information. For example: ``` template <typename T0> struct S { template <typename T> void g() const { int a; (void)a; } }; void f() { S<int>().g<int>(); } ``` this piece of code should not trigger any warning by the check modernize-redundant-void-arg but when we execute the following command ``` clang_tidy -checks=-*,modernize-redundant-void-arg test.cpp -- -std=c++11 ``` we obtain the following warning: /Users/eco419/Desktop/clang-tidy.project/void-redundand_2/test.cpp:6:6: warning: redundant void argument list in function declaration [modernize-redundant-void-arg] (void)a; ^~~~ Reviewers: aaron.ballman, hokein, alexfh, JonasToth Reviewed By: aaron.ballman, JonasToth Subscribers: JonasToth, lebedev.ri, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D52135 llvm-svn: 342388
* [modernize-use-transparent-functors] TypeLocs can be implicitly created, ↵Benjamin Kramer2018-09-141-0/+2
| | | | | | don't crash when encountering those. llvm-svn: 342252
* [clang-tidy] Abseil: Add more directories that are slated for future absl ↵Benjamin Kramer2018-09-121-3/+4
| | | | | | expansion. llvm-svn: 342041
* [NFC] Fix build breakage due to missing dep caused by D51950Shuai Wang2018-09-121-0/+1
| | | | llvm-svn: 342012
* [clangtidy] Remove old copy of ExprMutationAnalyzerShuai Wang2018-09-115-376/+5
| | | | | | | | | | | | | | | | | | Summary: This is 2/2 of moving ExprMutationAnalyzer from clangtidy to clang/Analysis. ExprMutationAnalyzer is moved to clang/Analysis in D51948. This diff migrates existing usages within clangtidy to point to the new location and remove the old copy of ExprMutationAnalyzer. Reviewers: george.karpenkov, JonasToth Reviewed By: george.karpenkov Subscribers: mgorny, a.sidorin, Szelethus, cfe-commits Differential Revision: https://reviews.llvm.org/D51950 llvm-svn: 342006
* [clang-tidy] Handle sugared reference types in ExprMutationAnalyzerShuai Wang2018-09-111-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This handles cases like this: ``` typedef int& IntRef; void mutate(IntRef); void f() { int x; mutate(x); } ``` where the param type is a sugared type (`TypedefType`) instead of a reference type directly. Note that another category of similar but different cases are already handled properly before: ``` typedef int Int; void mutate(Int&); void f() { int x; mutate(x); } ``` Reviewers: aaron.ballman, alexfh, george.karpenkov Subscribers: xazax.hun, a.sidorin, Szelethus, cfe-commits Differential Revision: https://reviews.llvm.org/D50953 llvm-svn: 341986
* [clang-tidy] Handle unique owning smart pointers in ExprMutationAnalyzerShuai Wang2018-09-111-2/+40
| | | | | | | | | | | | | | | | | | | | | | | | Summary: For smart pointers like std::unique_ptr which uniquely owns the underlying object, treat the mutation of the pointee as mutation of the smart pointer itself. This gives better behavior for cases like this: ``` void f(std::vector<std::unique_ptr<Foo>> v) { // undesirable analyze result of `v` as not mutated. for (auto& p : v) { p->mutate(); // only const member function `operator->` is invoked on `p` } } ``` Reviewers: hokein, george.karpenkov Subscribers: xazax.hun, a.sidorin, Szelethus, cfe-commits Differential Revision: https://reviews.llvm.org/D50883 llvm-svn: 341967
* [clang-tidy] Insert absl::StrAppend when replacing StrCat.Benjamin Kramer2018-09-111-1/+1
| | | | | | | There might be no using decl for StrAppend around, inserting the qualified name is less likely to break things. llvm-svn: 341929
* [clang-tidy] Add a missing comma after "flags"Benjamin Kramer2018-09-111-14/+5
| | | | llvm-svn: 341925
* Revert "Revert "[clang-tidy] Handle unresolved expressions in ↵Shuai Wang2018-09-111-6/+20
| | | | | | | | | | | ExprMutationAnalyzer"" This is the same as D50619 plus fixes for buildbot failures on windows. The test failures on windows are caused by -fdelayed-template-parsing and is fixed by forcing -fno-delayed-template-parsing on test cases that requires AST for uninstantiated templates. llvm-svn: 341891
* Revert "[clang-tidy] Handle unresolved expressions in ExprMutationAnalyzer"Shuai Wang2018-09-101-20/+6
| | | | | | | | | | | | | | | | | Summary: Tests somehow break on windows (and only on windows) http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/13003 http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/13747 I have yet figure out why so reverting to unbreak first. Reviewers: george.karpenkov Subscribers: xazax.hun, a.sidorin, Szelethus, cfe-commits Differential Revision: https://reviews.llvm.org/D51898 llvm-svn: 341886
* [clang-tidy] ExprMutationAnalyzer: construct from references. Fixes PR38888Roman Lebedev2018-09-104-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: I have hit this the rough way, while trying to use this in D51870. There is no particular point in storing the pointers, and moreover the pointers are assumed to be non-null, and that assumption is not enforced. If they are null, it won't be able to do anything good with them anyway. Initially i thought about simply adding asserts() that they are not null, but taking/storing references looks like even cleaner solution? Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=38888 | PR38888 ]] Reviewers: JonasToth, shuaiwang, alexfh, george.karpenkov Reviewed By: shuaiwang Subscribers: xazax.hun, a.sidorin, Szelethus, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D51884 llvm-svn: 341854
* [clang-tidy] Handle unresolved expressions in ExprMutationAnalyzerShuai Wang2018-09-101-6/+20
| | | | | | | | | | | | | | Summary: - If a function is unresolved, assume it mutates its arguments - Follow unresolved member expressions for nested mutations Reviewers: aaron.ballman, JonasToth, george.karpenkov Subscribers: xazax.hun, a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D50619 llvm-svn: 341848
* [clang-tidy/ObjC] Update list of acronyms in PropertyDeclarationCheckBen Hamilton2018-09-071-0/+8
| | | | | | | | | | | | Summary: This adds a few common acronyms we found were missing from PropertyDeclarationCheck. Reviewers: Wizard, hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D51819 llvm-svn: 341720
* [clang-tidy] Abseil: Allow macros inside of absl to use internal absl thingsBenjamin Kramer2018-09-071-1/+1
| | | | llvm-svn: 341643
* Fix reported range of partial token replacementStephen Kelly2018-09-061-5/+5
| | | | | | | | | | | | Summary: Fixes bug: 38678 Reviewers: klimek, rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D51192 llvm-svn: 341583
* [clang-tidy] minor bug fix to AbseilMatcher.hEric Liu2018-09-051-4/+13
| | | | | | | | | | | | | This missing directory is not yet released, but is causing some problems internally. It's gonna be released eventually and received permission to include it here. This matcher will also be periodically updated by my team as we have more releases and or problems internally. Patch by Hugo Gonzalez! Differential Revision: https://reviews.llvm.org/D51699 llvm-svn: 341488
* [clang-tidy] Use simple string matching instead of RegexKirill Bobyrev2018-08-301-10/+20
| | | | | | | | | | | Instead of parsing and compiling the `llvm::Regex` each time, it's faster to use basic string matching for filename prefix check. Reviewed by: hokein Differential Revision: https://reviews.llvm.org/D51360 llvm-svn: 341061
* [clang-tidy] Add abseil-no-internal-dependencies checkJonas Toth2018-08-294-0/+88
| | | | | | | | | | | Finds instances where the user depends on internal details and warns them against doing so. Should not be run on internal Abseil files or Abseil source code. Patch by hugoeg! Differential Revision: https://reviews.llvm.org/D50542 llvm-svn: 340928
* Introduce the abseil-redundant-strcat-calls check.Aaron Ballman2018-08-294-0/+183
| | | | | | This flags redundant calls to absl::StrCat where the result is being passed to another call to absl::StrCat or absl::StrAppend. Patch by Hugo Gonzalez and Samuel Benzaquen. llvm-svn: 340918
* Introduce the abseil-str-cat-append check.Aaron Ballman2018-08-294-0/+142
| | | | | | This flags uses of absl::StrCat when absl::StrAppend should be used instead. Patch by Hugo Gonzalez and Benjamin Kramer. llvm-svn: 340915
* [clang-tidy] Abseil: no namepsace checkHaojian Wu2018-08-285-0/+132
| | | | | | | | | | This check ensures that users of Abseil do not open namespace absl in their code, as that violates our compatibility guidelines. AbseilMatcher.h written by Hugo Gonzalez. Patch by Deanna Garcia! llvm-svn: 340800
* [clang-tidy] Abseil: faster strsplit delimiter checkHaojian Wu2018-08-224-0/+171
| | | | | | | | | | | This check is an abseil specific check that checks for code using single character string literals as delimiters and transforms the code into characters. The check was developed internally and has been running at google, this is just a move to open source the check. It was originally written by @sbenza. Patch by Deanna Garcia! llvm-svn: 340411
* [clang-tidy] Abseil: integral division of Duration checkHaojian Wu2018-08-174-0/+98
| | | | | | | | This check is an abseil specific test that tests to ensure users utilize abseil specific floating point division when trying to divide with abseil duration types. Patch by Deanna Garcia! llvm-svn: 340038
* [clang-tidy] Recognize [[clang::reinitializes]] attribute in ↵Martin Bohme2018-08-131-0/+4
| | | | | | | | | | | | | | | | | | | | | | | bugprone-use-after-move Summary: This allows member functions to be marked as reinitializing the object. After a moved-from object has been reinitialized, the check will no longer consider it to be in an indeterminate state. The patch that adds the attribute itself is at https://reviews.llvm.org/D49911 Reviewers: ilya-biryukov, aaron.ballman, alexfh, hokein, rsmith Reviewed By: aaron.ballman Subscribers: dblaikie, xazax.hun, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D49910 llvm-svn: 339571
* Adding the readability module to the list of dependencies for the C++ Core ↵Aaron Ballman2018-08-121-0/+1
| | | | | | Guidelines module. Amends r339516 for a failing bot. llvm-svn: 339517
* Add a new check to the readability module that flags uses of "magic numbers" ↵Aaron Ballman2018-08-125-0/+275
| | | | | | | | (both floating-point and integral). Patch by Florin Iucha <florin@signbit.net> llvm-svn: 339516
* [clang-tidy: modernize] modernize-redundant-void-arg crashes when a function ↵Alexander Kornienko2018-08-101-4/+7
| | | | | | | | | | | | body is in a macro Fixes https://bugs.llvm.org/show_bug.cgi?id=28406 Patch by IdrissRio. Differential revision: https://reviews.llvm.org/D49800 llvm-svn: 339433
* [clang-tidy] run-clang-tidy.py - add synchronisation to the outputAndi-Bogdan Postelnicu2018-08-101-5/+11
| | | | | | Differential Revision: https://reviews.llvm.org/D49851 llvm-svn: 339427
* [clang-tidy] Omit cases where loop variable is not used in loop body inHaojian Wu2018-08-101-9/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | performance-for-range-copy check. Summary: The upstream change r336737 make the check too smart to fix the case where loop variable could be used as `const auto&`. But for the case below, changing to `const auto _` will introduce an unused complier warning. ``` for (auto _ : state) { // no references for _. } ``` This patch omit this case, and it is safe to do it as the case is very rare. Reviewers: ilya-biryukov, alexfh Subscribers: xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D50447 llvm-svn: 339415
* Port getLocEnd -> getEndLocStephen Kelly2018-08-0940-53/+53
| | | | | | | | Subscribers: nemanjai, ioeric, kbarton, cfe-commits Differential Revision: https://reviews.llvm.org/D50355 llvm-svn: 339401
* Port getLocStart -> getBeginLocStephen Kelly2018-08-09115-280/+280
| | | | | | | | | | Reviewers: javed.absar Subscribers: nemanjai, kbarton, ilya-biryukov, ioeric, jkorous, arphaman, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D50354 llvm-svn: 339400
* [clang-tidy] Sequence init statements, declarations, and conditions ↵Martin Bohme2018-08-031-3/+18
| | | | | | | | | | | | | | | | | | correctly in if, switch, and while Summary: Fixes https://bugs.llvm.org/show_bug.cgi?id=36516. Reviewers: ilya-biryukov, alexfh, aaron.ballman, hokein Reviewed By: alexfh Subscribers: xazax.hun, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D49918 llvm-svn: 338932
OpenPOWER on IntegriCloud