summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Port getLocEnd -> getEndLocStephen Kelly2018-08-091-1/+1
| | | | | | | | Subscribers: nemanjai, ioeric, kbarton, cfe-commits Differential Revision: https://reviews.llvm.org/D50355 llvm-svn: 339401
* [clang-tidy] Add modernize-use-emplace.IgnoreImplicitConstructors optionAlexander Kornienko2017-08-101-4/+9
| | | | llvm-svn: 310584
* [clang-tidy] modernize-use-emplace: Remove unnecessary make_tuple callsJakub Kuderski2017-05-161-18/+31
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch makes modernize-use-emplace remove unnecessary make_ calls from push_back calls and turn them into emplace_back -- the same way make_pair calls are handled. Custom make_ calls can be removed for custom tuple-like types -- two new options that control that are `TupleTypes` and `TupleMakeFunctions`. By default, the check removes calls to `std::make_pair` and `std::make_tuple`. Eq. ``` std::vector<std::tuple<int, char, bool>> v; v.push_back(std::make_tuple(1, 'A', true)); // --> v.emplace_back(1, 'A', true); ``` Reviewers: alexfh, aaron.ballman, Prazek, hokein Reviewed By: Prazek Subscribers: JDevlieghere, xazax.hun, JonasToth, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D32690 llvm-svn: 303145
* Revert "[clang-tidy] modernize-use-emplace: Remove unnecessary make_tuple calls"Jakub Kuderski2017-05-161-31/+18
| | | | | | This reverts commit r303139. The commit made docs build emit a warning. llvm-svn: 303140
* [clang-tidy] modernize-use-emplace: Remove unnecessary make_tuple callsJakub Kuderski2017-05-161-18/+31
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch makes modernize-use-emplace remove unnecessary make_ calls from push_back calls and turn them into emplace_back -- the same way make_pair calls are handled. Custom make_ calls can be removed for custom tuple-like types -- two new options that control that are `TupleTypes` and `TupleMakeFunctions`. By default, the check removes calls to `std::make_pair` and `std::make_tuple`. Eq. ``` std::vector<std::tuple<int, char, bool>> v; v.push_back(std::make_tuple(1, 'A', true)); // --> v.emplace_back(1, 'A', true); ``` Reviewers: alexfh, aaron.ballman, Prazek, hokein Reviewed By: Prazek Subscribers: JDevlieghere, xazax.hun, JonasToth, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D32690 llvm-svn: 303139
* [clang-tidy] Use cxxStdInitializerListExpr in modernize-use-emplaceJakub Kuderski2017-05-051-9/+1
| | | | | | | | | | | | | | | | Summary: Use the cxxStdInitializerListExp matcher from ASTMatchers.h instead of a local one. Reviewers: aaron.ballman, alexfh, Prazek Reviewed By: aaron.ballman Subscribers: xazax.hun, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D32923 llvm-svn: 302317
* [clang-tidy] Fix PR32896: detect initializer lists in modernize-use-empalceJakub Kuderski2017-05-051-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch fixes [[ https://bugs.llvm.org/show_bug.cgi?id=32896 | PR32896 ]]. The problem was that modernize-use-emplace incorrectly removed changed push_back into emplace_back, removing explicit constructor call with initializer list parameter, resulting in compiler error after applying fixits. modernize-use-emplace used to check if matched constructor had InitListExpr, but didn't check against CXXStdInitializerListExpr. Eg. ``` std::vector<std::vector<int>> v; v.push_back(std::vector<int>({1})); // --> v.emplace_back({1}); ``` Reviewers: Prazek, alexfh, aaron.ballman Reviewed By: Prazek, alexfh, aaron.ballman Subscribers: xazax.hun, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D32767 llvm-svn: 302281
* [clang-tidy] Fix naming convention in modernize-use-emplaceJakub Kuderski2017-04-301-20/+20
| | | | | | | | | | | | | | | | Summary: Conform to the llvm naming convention for local variables in modernize-use-emplace check. Reviewers: Prazek, JonasToth, alexfh Reviewed By: Prazek, JonasToth, alexfh Subscribers: cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D32678 llvm-svn: 301780
* [clang-tidy] modernize-use-emplace: remove unnecessary make_pair callsJakub Kuderski2017-04-281-14/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When there is a push_back with a call to make_pair, turn it into emplace_back and remove the unnecessary make_pair call. Eg. ``` std::vector<std::pair<int, int>> v; v.push_back(std::make_pair(1, 2)); // --> v.emplace_back(1, 2); ``` make_pair doesn't get removed when explicit template parameters are provided, because of potential problems with type conversions. Reviewers: Prazek, aaron.ballman, hokein, alexfh Reviewed By: Prazek, alexfh Subscribers: JDevlieghere, JonasToth, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D32395 llvm-svn: 301651
* [clang-tidy] Fixes to modernize-use-emplacePiotr Padlewski2016-07-291-22/+49
| | | | | | | | Not everything is valid, but it should works for 99.8% cases https://reviews.llvm.org/D22208 llvm-svn: 277097
* [clang-tidy] Add modernize-use-emplacePiotr Padlewski2016-06-211-0/+104
Summary: Add check that replaces call of push_back to emplace_back Reviewers: hokein Differential Revision: http://reviews.llvm.org/D20964 llvm-svn: 273275
OpenPOWER on IntegriCloud