aboutsummaryrefslogtreecommitdiff
path: root/tools/libclang/CXCompilationDatabase.cpp
diff options
context:
space:
mode:
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];
}