aboutsummaryrefslogtreecommitdiff
path: root/clang-tidy/utils
AgeCommit message (Collapse)Author
2018-11-02[clang-tidy] Fixed code sample in a comment. NFCAlexander Kornienko
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@345984 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-02[clang-tidy] .reset(new X) -> make_unique<X>() in a comment. NFCAlexander Kornienko
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@345979 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-31Implement the readability-const-return-type check.Aaron Ballman
This check flags function top-level const-qualified return types and suggests removing the mostly-superfluous const qualifier where possible. Patch by Yitzhak Mandelbaum. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@345764 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-31[clang-tidy] new check 'readability-isolate-declaration'Jonas Toth
Summary: This patch introduces a new clang-tidy check that matches on all `declStmt` that declare more then one variable and transform them into one statement per declaration if possible. It currently only focusses on variable declarations but should be extended to cover more kinds of declarations in the future. It is related to https://reviews.llvm.org/D27621 and does use it's extensive test-suite. Thank you to firolino for his work! Reviewers: rsmith, aaron.ballman, alexfh, hokein, kbobyrev Reviewed By: aaron.ballman Subscribers: ZaMaZaN4iK, mgehre, nemanjai, kbarton, lebedev.ri, Eugene.Zelenko, mgorny, xazax.hun, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D51949 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@345735 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-26[clang-tidy] Re-commit: Add new 'readability-uppercase-literal-suffix' check ↵Roman Lebedev
(CERT DCL16-C, MISRA C:2012, 7.3, MISRA C++:2008, 2-13-4) Summary: Detects when the integral literal or floating point (decimal or hexadecimal) literal has non-uppercase suffix, and suggests to make the suffix uppercase, with fix-it. All valid combinations of suffixes are supported. ``` auto x = 1; // OK, no suffix. auto x = 1u; // warning: integer literal suffix 'u' is not upper-case auto x = 1U; // OK, suffix is uppercase. ... ``` This is a re-commit, the original was reverted by me in rL345305 due to discovered bugs. (implicit code, template instantiation) Tests were added, and the bugs were fixed. I'm unable to find any further bugs, hopefully there aren't any.. References: * [[ https://wiki.sei.cmu.edu/confluence/pages/viewpage.action?pageId=87152241 | CERT DCL16-C ]] * MISRA C:2012, 7.3 - The lowercase character "l" shall not be used in a literal suffix * MISRA C++:2008, 2-13-4 - Literal suffixes shall be upper case Reviewers: JonasToth, aaron.ballman, alexfh, hokein, xazax.hun Reviewed By: aaron.ballman Subscribers: Eugene.Zelenko, mgorny, rnkovacs, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D52670 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@345381 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-25[clang-tidy] Revert my readability-uppercase-literal-suffix check.Roman Lebedev
There are some lurking issues with the handling of the SourceManager. Somehow sometimes we end up extracting completely wrong portions of the source buffer. Reverts r344772, r44760, r344758, r344755. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@345305 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-18[clang-tidy] Add new 'readability-uppercase-literal-suffix' check (CERT ↵Roman Lebedev
DCL16-C, MISRA C:2012, 7.3, MISRA C++:2008, 2-13-4) Summary: Detects when the integral literal or floating point (decimal or hexadecimal) literal has non-uppercase suffix, and suggests to make the suffix uppercase, with fix-it. All valid combinations of suffixes are supported. ``` auto x = 1; // OK, no suffix. auto x = 1u; // warning: integer literal suffix 'u' is not upper-case auto x = 1U; // OK, suffix is uppercase. ... ``` References: * [[ https://wiki.sei.cmu.edu/confluence/pages/viewpage.action?pageId=87152241 | CERT DCL16-C ]] * MISRA C:2012, 7.3 - The lowercase character "l" shall not be used in a literal suffix * MISRA C++:2008, 2-13-4 - Literal suffixes shall be upper case Reviewers: JonasToth, aaron.ballman, alexfh, hokein, xazax.hun Reviewed By: aaron.ballman Subscribers: Eugene.Zelenko, mgorny, rnkovacs, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D52670 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@344755 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-12[clang-tidy] White List Option for performance-unnecessary-value-param, ↵Adam Balogh
performance-unnecessary-copy-initialization and performance-for-range-copy New option added to these three checks to be able to silence false positives on types that are intentionally passed by value or copied. Such types are e.g. intrusive reference counting pointer types like llvm::IntrusiveRefCntPtr. The new option is named WhiteListTypes and can contain a semicolon-separated list of names of these types. Regular expressions are allowed. Default is empty. Differential Revision: https://reviews.llvm.org/D52727 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@344340 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-05[clang-tidy] NFC refactor lexer-utils to be usable without ASTContextJonas Toth
Summary: This patch is a small refactoring necessary for 'readability-isolate-declaration' and does not introduce functional changes. It allows to use the utility functions without a full `ASTContext` and requires only the `SourceManager` and the `LangOpts`. Reviewers: alexfh, aaron.ballman, hokein Reviewed By: alexfh Subscribers: nemanjai, xazax.hun, kbarton, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D52684 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@343850 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-04[clang-tidy] Sequence statements with multiple parents correctly (PR39149)Martin Bohme
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 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@343768 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-11[clangtidy] Remove old copy of ExprMutationAnalyzerShuai Wang
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 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@342006 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-11[clang-tidy] Handle sugared reference types in ExprMutationAnalyzerShuai Wang
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 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@341986 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-11[clang-tidy] Handle unique owning smart pointers in ExprMutationAnalyzerShuai Wang
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 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@341967 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-11Revert "Revert "[clang-tidy] Handle unresolved expressions in ↵Shuai Wang
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. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@341891 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-10Revert "[clang-tidy] Handle unresolved expressions in ExprMutationAnalyzer"Shuai Wang
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 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@341886 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-10[clang-tidy] ExprMutationAnalyzer: construct from references. Fixes PR38888Roman Lebedev
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 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@341854 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-10[clang-tidy] Handle unresolved expressions in ExprMutationAnalyzerShuai Wang
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 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@341848 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-09Port getLocStart -> getBeginLocStephen Kelly
Reviewers: javed.absar Subscribers: nemanjai, kbarton, ilya-biryukov, ioeric, jkorous, arphaman, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D50354 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@339400 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-03[clang-tidy] Sequence init statements, declarations, and conditions ↵Martin Bohme
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 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@338932 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-27[clang-tidy] Add ExprMutationAnalyzer, that analyzes whether an expression ↵Alexander Kornienko
is mutated within a statement. Summary: (Originally started as a clang-tidy check but there's already D45444 so shifted to just adding ExprMutationAnalyzer) `ExprMutationAnalyzer` is a generally useful helper that can be used in different clang-tidy checks for checking whether a given expression is (potentially) mutated within a statement (typically the enclosing compound statement.) This is a more general and more powerful/accurate version of isOnlyUsedAsConst, which is used in ForRangeCopyCheck, UnnecessaryCopyInitialization. It should also be possible to construct checks like D45444 (suggest adding const to variable declaration) or https://bugs.llvm.org/show_bug.cgi?id=21981 (suggest adding const to member function) using this helper function. This function is tested by itself and is intended to stay generally useful instead of tied to any particular check. Reviewers: hokein, alexfh, aaron.ballman, ilya-biryukov, george.karpenkov Reviewed By: aaron.ballman Subscribers: lebedev.ri, shuaiwang, rnkovacs, hokein, alexfh, aaron.ballman, a.sidorin, Eugene.Zelenko, xazax.hun, JonasToth, klimek, mgorny, cfe-commits Tags: #clang-tools-extra Patch by Shuai Wang. Differential Revision: https://reviews.llvm.org/D45679 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@335736 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-13Reverting r334604 due to failing tests.Aaron Ballman
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/31500 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@334606 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-13Add a new class to analyze whether an expression is mutated within a statement.Aaron Ballman
ExprMutationAnalyzer is a generally useful helper that can be used in different clang-tidy checks for checking whether a given expression is (potentially) mutated within a statement (typically the enclosing compound statement.) This is a more general and more powerful/accurate version of isOnlyUsedAsConst, which is used in ForRangeCopyCheck, UnnecessaryCopyInitialization. Patch by Shuai Wang git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@334604 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-10Reland "[tools] Updating PPCallbacks::InclusionDirective calls"Julie Hockett
This commit relands r331905. r331904 added SrcMgr::CharacteristicKind to the InclusionDirective callback, this revision updates instances of it in clang-tools-extra. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@332023 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-09Revert "[tools] Updating PPCallbacks::InclusionDirective calls"Julie Hockett
This reverts commit r331905, since it's dependent on reverted r331905. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@331931 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-09[tools] Updating PPCallbacks::InclusionDirective callsJulie Hockett
[revision] added SrcMgr::CharacteristicKind to the InclusionDirective callback, this revision updates instances of it in clang-tools-extra. Differential Revision: https://reviews.llvm.org/D46615 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@331905 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-02[clang-tidy] ObjC ARC objects should not trigger ↵Ben Hamilton
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 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@324097 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-02[clang-tidy] Kill marco. No functionality change.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@324084 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-12[clang-tidy] Implement type-based check for `gsl::owner`Jonas Toth
This check implements the typebased semantic of `gsl::owner`. Meaning, that - only `gsl::owner` is allowed to get `delete`d - `new` expression must be assigned to `gsl::owner` - function calls that expect `gsl::owner` as argument, must get either an owner or a newly created and recognized resource (in the moment only `new`ed memory) - assignment to `gsl::owner` must be either a resource or another owner - functions returning an `gsl::owner` are considered as factories, and their result must be assigned to an `gsl::owner` - classes that have an `gsl::owner`-member must declare a non-default destructor There are some problems that occur when typededuction is in place. For example `auto Var = function_that_returns_owner();` the type of `Var` will not be an `gsl::owner`. This case is catched, and explicitly noted. But cases like fully templated functions ``` template <typename T> void f(T t) { delete t; } // ... f(gsl::owner<int*>(new int(42))); ``` Will created false positive (the deletion is problematic), since the type deduction removes the wrapping `typeAlias`. Codereview in D36354 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@313067 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-12[clang-tidy] Revert Implement type-based check for gsl::ownerJonas Toth
This should unbreak the buildbot for visual studio 2015 for now. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@313059 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-12[clang-tidy] Implement type-based check for `gsl::owner`Jonas Toth
This check implements the typebased semantic of `gsl::owner`. Meaning, that - only `gsl::owner` is allowed to get `delete`d - `new` expression must be assigned to `gsl::owner` - function calls that expect `gsl::owner` as argument, must get either an owner or a newly created and recognized resource (in the moment only `new`ed memory) - assignment to `gsl::owner` must be either a resource or another owner - functions returning an `gsl::owner` are considered as factories, and their result must be assigned to an `gsl::owner` - classes that have an `gsl::owner`-member must declare a non-default destructor There are some problems that occur when typededuction is in place. For example `auto Var = function_that_returns_owner();` the type of `Var` will not be an `gsl::owner`. This case is catched, and explicitly noted. But cases like fully templated functions ``` template <typename T> void f(T t) { delete t; } // ... f(gsl::owner<int*>(new int(42))); ``` Will created false positive (the deletion is problematic), since the type deduction removes the wrapping `typeAlias`. Please give your comments :) git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@313043 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20[clang-tidy] Unify the way IncludeStyle and HeaderFileExtesions options are usedAlexander Kornienko
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@308605 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12[clang-tidy] Add a new Android check "android-cloexec-socket"Yan Wang
Summary: socket() is better to include SOCK_CLOEXEC in its type argument to avoid the file descriptor leakage. Reviewers: chh, Eugene.Zelenko, alexfh, hokein, aaron.ballman Reviewed By: chh, alexfh Subscribers: srhines, mgorny, JDevlieghere, xazax.hun, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D34913 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@307818 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24Extend readability-container-size-empty to add comparisons to empty-state ↵Aaron Ballman
objects. Patch by Josh Zimmerman. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@301185 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-30Spelling mistakes in comments. NFCI.Simon Pilgrim
Based on corrections mentioned in patch for clang for PR27635 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@299074 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-21[clang-tidy] Reword the "code outside header guard" warning.Benjamin Kramer
The check doesn't really know if the code it is warning about came before or after the header guard, so phrase it more neutral instead of complaining about code before the header guard. The location for the warning is still not optimal, but I don't think fixing that is worth the effort, the preprocessor doesn't give us a better location. Differential Revision: https://reviews.llvm.org/D30191 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@295715 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-06[clang-tidy] getPreviousNonCommentToken -> getPreviousTokenAlexander Kornienko
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@294192 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-19[clang-tidy] Do not trigger move fix for non-copy assignment operators in ↵Felix Berger
performance-unnecessary-value-param check Reviewers: alexfh, sbenza, malcolm.parsons Subscribers: JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D28899 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@292491 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-12Correctly classify main file includes if there is a prefix addedAlexander Kornienko
Summary: Prevents misclassifying includes based on the command-line filename (e.g. if a project is in a subdirectory). This is slightly more robust than the additional duplicate detection, however the current classification scheme is still kind of brittle for a lot of code. Reviewers: hokein, alexfh Subscribers: cfe-commits, #clang-tools-extra Patch by Julian Bangert! Differential Revision: https://reviews.llvm.org/D26015 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@291767 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-03[clang-tidy] Handle constructors in performance-unnecessary-value-paramMalcolm Parsons
Summary: modernize-pass-by-value doesn't warn about value parameters that cannot be moved, so performance-unnecessary-value-param should. Reviewers: aaron.ballman, flx, alexfh Subscribers: JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D28022 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@290883 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-24[clang-tidy] refactor ExprSequence out of use-after-move checkMarek Sokolowski
Differential Revision: https://reviews.llvm.org/D27700 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@290489 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-08[clang-tools-extra] Format sources with clang-format. NFC.Mandeep Singh Grang
Summary: Ran clang-format on all .c/.cpp/.h files in clang-tools-extra. Excluded the test, unittests, clang-reorder-fields, include-fixer, modularize and pptrace directories. Reviewers: klimek, alexfh Subscribers: nemanjai Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D26329 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@286221 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-04[clang-tidy] Ignore incomplete types when determining whether they are ↵Felix Berger
expensive to copy Summary: IsExpensiveToCopy can return false positives for incomplete types, so ignore them. All existing ClangTidy tests that depend on this function still pass as the types are complete. Reviewers: alexfh, aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26195 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@286008 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17Recommit "[ClangTidy] Add UsingInserter and NamespaceAliaser"Haojian Wu
Summary: This adds helper classes to add using declaractions and namespace aliases to function bodies. These help making function calls to deeply nested functions concise (e.g. when calling helpers in a refactoring) Patch by Julian Bangert! Reviewers: alexfh, hokein Subscribers: beanz, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D24997 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@284368 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-12Revert "[ClangTidy] Add UsingInserter and NamespaceAliaser"Haojian Wu
This reverts commit r283981. This patch breaks the buildbot. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@283985 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-12[ClangTidy] Add UsingInserter and NamespaceAliaserHaojian Wu
Summary: This adds helper classes to add using declaractions and namespace aliases to function bodies. These help making function calls to deeply nested functions concise (e.g. when calling helpers in a refactoring) Patch by Julian Bangert! Reviewers: alexfh, hokein Subscribers: cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D24997 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@283981 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-04Fix some false-positives with cppcoreguidelines-pro-type-member-init. Handle ↵Aaron Ballman
classes with default constructors that are defaulted or are not present in the AST. Classes with virtual methods or virtual bases are not trivially default constructible, so their members and bases need to be initialized. Patch by Malcolm Parsons. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@283224 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-28[clang-tidy] fix false-positive for cppcoreguidelines-pro-type-member-init ↵Matthias Gehre
with in-class initializers Summary: This fixes https://llvm.org/bugs/show_bug.cgi?id=30487 where ``` warning: uninitialized record type: 's' [cppcoreguidelines-pro-type-member-init] ``` is emitted on ``` struct MyStruct { int a = 5; int b = 7; }; int main() { MyStruct s; } ``` Reviewers: alexfh, aaron.ballman Subscribers: nemanjai, cfe-commits Differential Revision: https://reviews.llvm.org/D24848 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@282625 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-26[clang-tidy] Some tweaks on header guard checks.Haojian Wu
* Implement missing storeOption interfaces. * Remove unnecessary parameter copy in isHeaderFileExtension. * Fix doc style. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@279814 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-26[clang-tidy] Added hh, hxx and hpp to header guard checks.Mads Ravn
Changed the extension check to include the option of ",h,hh,hpp,hxx" instead of just returning whether the file ended with ".h". Differential revision: https://reviews.llvm.org/D20512 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@279803 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29[clang-tidy] Fixes to modernize-use-emplacePiotr Padlewski
Not everything is valid, but it should works for 99.8% cases https://reviews.llvm.org/D22208 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@277097 91177308-0d34-0410-b5e6-96231b3b80d8