summaryrefslogtreecommitdiff
path: root/tools/libclang/CXCompilationDatabase.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2014-11-24 09:15:30 +0000
committerDimitry Andric <dim@FreeBSD.org>2014-11-24 09:15:30 +0000
commit9f4dbff6669c8037f3b036bcf580d14f1a4f12a5 (patch)
tree47df2c12b57214af6c31e47404b005675b8b7ffc /tools/libclang/CXCompilationDatabase.cpp
parentf73d5f23a889b93d89ddef61ac0995df40286bb8 (diff)
Notes
Diffstat (limited to 'tools/libclang/CXCompilationDatabase.cpp')
-rw-r--r--tools/libclang/CXCompilationDatabase.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/tools/libclang/CXCompilationDatabase.cpp b/tools/libclang/CXCompilationDatabase.cpp
index 433caecd38a6..51677e721035 100644
--- a/tools/libclang/CXCompilationDatabase.cpp
+++ b/tools/libclang/CXCompilationDatabase.cpp
@@ -8,7 +8,7 @@ using namespace clang::tooling;
extern "C" {
-// FIXME: do something more usefull with the error message
+// FIXME: do something more useful with the error message
CXCompilationDatabase
clang_CompilationDatabase_fromDirectory(const char *BuildDir,
CXCompilationDatabase_Error *ErrorCode)
@@ -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,24 +49,23 @@ 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;
+ return nullptr;
}
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;
+ return nullptr;
}
void
@@ -92,13 +90,13 @@ CXCompileCommand
clang_CompileCommands_getCommand(CXCompileCommands Cmds, unsigned I)
{
if (!Cmds)
- return 0;
+ return nullptr;
AllocatedCXCompileCommands *ACC =
static_cast<AllocatedCXCompileCommands *>(Cmds);
if (I >= ACC->CCmd.size())
- return 0;
+ return nullptr;
return &ACC->CCmd[I];
}