llvm-project/clang/lib/StaticAnalyzer/Frontend
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
..
AnalysisConsumer.cpp Use 'override/final' instead of 'virtual' for overridden methods 2015-04-11 02:00:23 +00:00
CMakeLists.txt [CMake] clangStaticAnalyzerFrontend: Add clangLex, corresponding to r216550. 2014-08-28 12:42:28 +00:00
CheckerRegistration.cpp Remove std::move that was preventing return value optimization. 2015-01-17 00:46:55 +00:00
FrontendActions.cpp Add support for the static analyzer to synthesize function implementations from external model files. 2014-08-27 15:14:15 +00:00
Makefile
ModelConsumer.cpp [Analysis] Add missing newlines at end of file. 2014-10-09 20:34:45 +00:00
ModelInjector.cpp Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types 2015-05-29 19:42:19 +00:00
ModelInjector.h Use 'override/final' instead of 'virtual' for overridden methods 2015-04-11 02:00:23 +00:00