This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Don't turn .push_back({1, 2}) into .emplace_back(1, 2) for pairs
AbandonedPublic

Authored by kuhar on Apr 20 2017, 2:59 PM.

Details

Reviewers
Prazek
Summary

This patch prevents modernize-use-emplace from changing push_backs of brace initialized pairs (.push_back({1, 2})) to .emplace_back(1, 2).
Pair's constructor doesn't have any interesting logic and basically performs aggregate initialization. There also doesn't seem to be much win
in terms of making code more concise, thus is makes little sense to turn such push_back calls into emplace_backs.

The change is inspired by the recent discussion on changing and enforcing coding guidelines:
[llvm-dev] [cfe-dev] Modernizing LLVM Coding Style Guide and enforcing Clang-tidy
http://lists.llvm.org/pipermail/llvm-dev/2016-December/108559.html

Diff Detail

Event Timeline

kuhar created this revision.Apr 20 2017, 2:59 PM
kuhar abandoned this revision.Apr 20 2017, 3:35 PM