Go to file
Benjamin Kramer f5e2fc474d 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: 238602
2015-05-29 19:43:39 +00:00
clang Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types 2015-05-29 19:42:19 +00:00
clang-tools-extra [clang-tidy] Fix for llvm.org/PR23355 2015-05-29 09:49:59 +00:00
compiler-rt Use sanitizer_atomic_clang.h with clang-cl instead of the MSVC variant 2015-05-29 17:56:39 +00:00
debuginfo-tests New round of fixes for "Always compile debuginfo-tests for the host triple" 2014-10-18 23:47:59 +00:00
libclc Use a more accurate implementation for exp 2015-05-13 03:55:09 +00:00
libcxx Fix PR#23647 - make_shared<volatile bool> - second try 2015-05-27 22:44:47 +00:00
libcxxabi libcxx: Switch to use __gnu_unwind_frame() for libunwind. 2015-05-29 15:34:24 +00:00
libunwind libunwind: Fix unw_step() for ARM EHABI. 2015-05-29 15:33:38 +00:00
lld COFF: Add /subsystem option. 2015-05-29 16:34:31 +00:00
lldb TestHandleSegv: also assert that we have a thread 2015-05-29 19:38:41 +00:00
llgo [llgo] cmd/llgoi: use line editor 2015-05-23 15:16:09 +00:00
llvm Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types 2015-05-29 19:43:39 +00:00
openmp Allow CMAKE_OSX_ARCHITECTURES to build fat library. 2015-05-29 16:13:56 +00:00
polly Exploit non-negative numerators 2015-05-29 17:08:19 +00:00