diff options
author | dim <dim@FreeBSD.org> | 2014-11-24 09:15:30 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2014-11-24 09:15:30 +0000 |
commit | 173a4f43a911175643bda81ee675e8d9269056ea (patch) | |
tree | 47df2c12b57214af6c31e47404b005675b8b7ffc /tools/libclang/CXCompilationDatabase.cpp | |
parent | 88f7a7d5251a2d813460274c92decc143a11569b (diff) | |
download | FreeBSD-src-173a4f43a911175643bda81ee675e8d9269056ea.zip FreeBSD-src-173a4f43a911175643bda81ee675e8d9269056ea.tar.gz |
Vendor import of clang RELEASE_350/final tag r216957 (effectively, 3.5.0 release):
https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_350/final@216957
Diffstat (limited to 'tools/libclang/CXCompilationDatabase.cpp')
-rw-r--r-- | tools/libclang/CXCompilationDatabase.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/tools/libclang/CXCompilationDatabase.cpp b/tools/libclang/CXCompilationDatabase.cpp index 433caec..51677e7 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]; } |