summaryrefslogtreecommitdiffstats
path: root/clang/tools
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2014-03-20 12:48:36 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2014-03-20 12:48:36 +0000
commitefb1eb981b46fc6a6c089514b9db82a54e0a11cc (patch)
tree16f62d8ca2d71fab94e7769f7ca39a179e630661 /clang/tools
parent93fe5e810dce206495a89bdbdf15a7d8694d7530 (diff)
downloadbcm5719-llvm-efb1eb981b46fc6a6c089514b9db82a54e0a11cc.tar.gz
bcm5719-llvm-efb1eb981b46fc6a6c089514b9db82a54e0a11cc.zip
Tooling: Move heavyweight vectors around instead of copying.
While there convert to range-based for loops. No functionality change. llvm-svn: 204338
Diffstat (limited to 'clang/tools')
-rw-r--r--clang/tools/libclang/CXCompilationDatabase.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/clang/tools/libclang/CXCompilationDatabase.cpp b/clang/tools/libclang/CXCompilationDatabase.cpp
index 156a3e22a61..f4728fe0a1c 100644
--- a/clang/tools/libclang/CXCompilationDatabase.cpp
+++ b/clang/tools/libclang/CXCompilationDatabase.cpp
@@ -40,9 +40,8 @@ struct AllocatedCXCompileCommands
{
std::vector<CompileCommand> CCmd;
- AllocatedCXCompileCommands(const std::vector<CompileCommand>& Cmd)
- : CCmd(Cmd)
- { }
+ AllocatedCXCompileCommands(std::vector<CompileCommand> Cmd)
+ : CCmd(std::move(Cmd)) {}
};
CXCompileCommands
@@ -50,10 +49,9 @@ clang_CompilationDatabase_getCompileCommands(CXCompilationDatabase CDb,
const char *CompleteFileName)
{
if (CompilationDatabase *db = static_cast<CompilationDatabase *>(CDb)) {
- const std::vector<CompileCommand>
- CCmd(db->getCompileCommands(CompleteFileName));
+ std::vector<CompileCommand> CCmd(db->getCompileCommands(CompleteFileName));
if (!CCmd.empty())
- return new AllocatedCXCompileCommands( CCmd );
+ return new AllocatedCXCompileCommands(std::move(CCmd));
}
return 0;
@@ -62,9 +60,9 @@ clang_CompilationDatabase_getCompileCommands(CXCompilationDatabase CDb,
CXCompileCommands
clang_CompilationDatabase_getAllCompileCommands(CXCompilationDatabase CDb) {
if (CompilationDatabase *db = static_cast<CompilationDatabase *>(CDb)) {
- const std::vector<CompileCommand> CCmd(db->getAllCompileCommands());
+ std::vector<CompileCommand> CCmd(db->getAllCompileCommands());
if (!CCmd.empty())
- return new AllocatedCXCompileCommands( CCmd );
+ return new AllocatedCXCompileCommands(std::move(CCmd));
}
return 0;
OpenPOWER on IntegriCloud