llvm-project/clang/utils/TableGen
Benjamin Kramer 3204b152b5 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
2015-05-29 19:42:19 +00:00
..
CMakeLists.txt [CMake] Deprecate CLANG_RUNTIME_OUTPUT_INTDIR and CLANG_LIBRARY_OUTPUT_INTDIR. 2014-01-19 13:00:01 +00:00
ClangASTNodesEmitter.cpp [C++11] Use 'nullptr'. 2014-05-07 06:21:57 +00:00
ClangAttrEmitter.cpp Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types 2015-05-29 19:42:19 +00:00
ClangCommentCommandInfoEmitter.cpp Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types 2015-05-29 19:42:19 +00:00
ClangCommentHTMLNamedCharacterReferenceEmitter.cpp TableGen backends: use emitSourceFileHeader() to emit the warning about 2013-01-30 21:54:20 +00:00
ClangCommentHTMLTagsEmitter.cpp Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types 2015-05-29 19:42:19 +00:00
ClangDiagnosticsEmitter.cpp Remove many superfluous SmallString::str() calls. 2015-03-18 10:17:07 +00:00
ClangSACheckersEmitter.cpp [C++11] Use 'nullptr'. 2014-05-07 06:21:57 +00:00
Makefile Don't require exception handling for clang-tblgen. 2012-10-25 20:34:00 +00:00
NeonEmitter.cpp Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types 2015-05-29 19:42:19 +00:00
TableGen.cpp Reapplying r204952 a second time. 2014-03-31 13:14:44 +00:00
TableGenBackends.h Add missing header guards. 2014-08-08 13:24:19 +00:00