-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clang-tidy modernize-use-emplace #48661
Merged
ZhilkinSerg
merged 2 commits into
CleverRaven:0.F-dev
from
jbytheway:clang-tidy_modernize-use-emplace
May 14, 2021
Merged
clang-tidy modernize-use-emplace #48661
ZhilkinSerg
merged 2 commits into
CleverRaven:0.F-dev
from
jbytheway:clang-tidy_modernize-use-emplace
May 14, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
How about putting the type being constructed into a comment? |
actual-nh
added
Code: Infrastructure / Style / Static Analysis
Code internal infrastructure and style
Code: Performance
Performance boosting code (CPU, memory, etc.)
Code: Tests
Measurement, self-control, statistics, balancing.
labels
Apr 26, 2021
Yeah, the same idea crossed my mind. Could maybe write another clang-tidy check to implement that, but not in this PR. |
Qrox
reviewed
Apr 27, 2021
jbytheway
force-pushed
the
clang-tidy_modernize-use-emplace
branch
from
April 28, 2021 00:24
93a9177
to
ecb4a3a
Compare
This is clang-tidy making automated changes to convert push_back into emplace_back whenever the argument to push_back is either a constructor call for the type in question of an expression of a type implicitly convertible to the type in question. This should eliminate one move-construction of the inserted object for each call.
jbytheway
force-pushed
the
clang-tidy_modernize-use-emplace
branch
from
May 6, 2021 00:45
ecb4a3a
to
800e75f
Compare
ZhilkinSerg
pushed a commit
that referenced
this pull request
May 28, 2021
* Port code to emplace_back This is clang-tidy making automated changes to convert push_back into emplace_back whenever the argument to push_back is either a constructor call for the type in question of an expression of a type implicitly convertible to the type in question. This should eliminate one move-construction of the inserted object for each call. * Enable clang-tidy modernize-use-emplace
ZhilkinSerg
pushed a commit
that referenced
this pull request
May 28, 2021
* Port code to emplace_back This is clang-tidy making automated changes to convert push_back into emplace_back whenever the argument to push_back is either a constructor call for the type in question of an expression of a type implicitly convertible to the type in question. This should eliminate one move-construction of the inserted object for each call. * Enable clang-tidy modernize-use-emplace
ZhilkinSerg
pushed a commit
that referenced
this pull request
May 31, 2021
* Port code to emplace_back This is clang-tidy making automated changes to convert push_back into emplace_back whenever the argument to push_back is either a constructor call for the type in question of an expression of a type implicitly convertible to the type in question. This should eliminate one move-construction of the inserted object for each call. * Enable clang-tidy modernize-use-emplace
ZhilkinSerg
pushed a commit
that referenced
this pull request
Jun 14, 2021
* Port code to emplace_back This is clang-tidy making automated changes to convert push_back into emplace_back whenever the argument to push_back is either a constructor call for the type in question of an expression of a type implicitly convertible to the type in question. This should eliminate one move-construction of the inserted object for each call. * Enable clang-tidy modernize-use-emplace
ZhilkinSerg
pushed a commit
that referenced
this pull request
Jun 14, 2021
* Port code to emplace_back This is clang-tidy making automated changes to convert push_back into emplace_back whenever the argument to push_back is either a constructor call for the type in question of an expression of a type implicitly convertible to the type in question. This should eliminate one move-construction of the inserted object for each call. * Enable clang-tidy modernize-use-emplace
ZhilkinSerg
pushed a commit
that referenced
this pull request
Jun 14, 2021
* Port code to emplace_back This is clang-tidy making automated changes to convert push_back into emplace_back whenever the argument to push_back is either a constructor call for the type in question of an expression of a type implicitly convertible to the type in question. This should eliminate one move-construction of the inserted object for each call. * Enable clang-tidy modernize-use-emplace
ZhilkinSerg
pushed a commit
that referenced
this pull request
Jun 21, 2021
* Port code to emplace_back This is clang-tidy making automated changes to convert push_back into emplace_back whenever the argument to push_back is either a constructor call for the type in question of an expression of a type implicitly convertible to the type in question. This should eliminate one move-construction of the inserted object for each call. * Enable clang-tidy modernize-use-emplace
ZhilkinSerg
pushed a commit
that referenced
this pull request
Jul 3, 2021
* Port code to emplace_back This is clang-tidy making automated changes to convert push_back into emplace_back whenever the argument to push_back is either a constructor call for the type in question of an expression of a type implicitly convertible to the type in question. This should eliminate one move-construction of the inserted object for each call. * Enable clang-tidy modernize-use-emplace
anothersimulacrum
pushed a commit
to anothersimulacrum/Cataclysm-DDA
that referenced
this pull request
Jul 3, 2021
* Port code to emplace_back This is clang-tidy making automated changes to convert push_back into emplace_back whenever the argument to push_back is either a constructor call for the type in question of an expression of a type implicitly convertible to the type in question. This should eliminate one move-construction of the inserted object for each call. * Enable clang-tidy modernize-use-emplace
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Code: Infrastructure / Style / Static Analysis
Code internal infrastructure and style
Code: Performance
Performance boosting code (CPU, memory, etc.)
Code: Tests
Measurement, self-control, statistics, balancing.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
None
Purpose of change
More static analysis.
This this check converts
push_back
intoemplace_back
(and similarly for similar functions) whenever the argument topush_back
is either a constructor call for the type in question of an expression of a type implicitly convertible to the type in question.This should eliminate one move-construction of the inserted object for each call.
Describe the solution
Enable
modernize-use-emplace
.Run
clang-tidy
.All changes here were automatically performed by
clang-tidy
.Describe alternatives you've considered
There is a readability cost to this check, in that the type being constructed is obscured. If we thought that too costly we might want to disable this check. But in most cases it's fairly obvious, so I think this check is a net win.
Testing
Unit tests.
Additional context