diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2015-05-29 19:42:19 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2015-05-29 19:42:19 +0000 |
commit | 3204b152b53e539304f9da2aff100876aeefa856 (patch) | |
tree | 413a942366f5a46724c5658daf847ee3493e9f5e /clang/lib/Driver/Tools.cpp | |
parent | 36cbc0901f7a8ac02511143f1b5e4b6478221239 (diff) | |
download | llvm-3204b152b53e539304f9da2aff100876aeefa856.zip llvm-3204b152b53e539304f9da2aff100876aeefa856.tar.gz llvm-3204b152b53e539304f9da2aff100876aeefa856.tar.bz2 |
Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types
If the type isn't trivially moveable emplace can skip a potentially
expensive move. It also saves a couple of characters.
Call sites were found with the ASTMatcher + some semi-automated cleanup.
memberCallExpr(
argumentCountIs(1), callee(methodDecl(hasName("push_back"))),
on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))),
hasArgument(0, bindTemporaryExpr(
hasType(recordDecl(hasNonTrivialDestructor())),
has(constructExpr()))),
unless(isInTemplateInstantiation()))
No functional change intended.
llvm-svn: 238601
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 9433a7e..1dcb759 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -5608,7 +5608,7 @@ static void constructHexagonLinkArgs(Compilation &C, const JobAction &JA, for (arg_iterator it = Args.filtered_begin(options::OPT_moslib_EQ), ie = Args.filtered_end(); it != ie; ++it) { (*it)->claim(); - oslibs.push_back((*it)->getValue()); + oslibs.emplace_back((*it)->getValue()); hasStandalone = hasStandalone || (oslibs.back() == "standalone"); } if (oslibs.empty()) { |