diff options
author | dim <dim@FreeBSD.org> | 2013-04-08 18:45:10 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-04-08 18:45:10 +0000 |
commit | c72c57c9e9b69944e3e009cd5e209634839581d3 (patch) | |
tree | 4fc2f184c499d106f29a386c452b49e5197bf63d /tools/libclang/CXCompilationDatabase.cpp | |
parent | 5b20025c30d23d521e12c1f33ec8fa6b821952cd (diff) | |
download | FreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.zip FreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.tar.gz |
Vendor import of clang trunk r178860:
http://llvm.org/svn/llvm-project/cfe/trunk@178860
Diffstat (limited to 'tools/libclang/CXCompilationDatabase.cpp')
-rw-r--r-- | tools/libclang/CXCompilationDatabase.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/tools/libclang/CXCompilationDatabase.cpp b/tools/libclang/CXCompilationDatabase.cpp index 7bd319a..e35ac27 100644 --- a/tools/libclang/CXCompilationDatabase.cpp +++ b/tools/libclang/CXCompilationDatabase.cpp @@ -1,10 +1,9 @@ #include "clang-c/CXCompilationDatabase.h" -#include "clang/Tooling/CompilationDatabase.h" #include "CXString.h" +#include "clang/Tooling/CompilationDatabase.h" using namespace clang; using namespace clang::tooling; -using namespace clang::cxstring; extern "C" { @@ -59,6 +58,17 @@ clang_CompilationDatabase_getCompileCommands(CXCompilationDatabase CDb, return 0; } +CXCompileCommands +clang_CompilationDatabase_getAllCompileCommands(CXCompilationDatabase CDb) { + if (CompilationDatabase *db = static_cast<CompilationDatabase *>(CDb)) { + const std::vector<CompileCommand> CCmd(db->getAllCompileCommands()); + if (!CCmd.empty()) + return new AllocatedCXCompileCommands( CCmd ); + } + + return 0; +} + void clang_CompileCommands_dispose(CXCompileCommands Cmds) { @@ -96,10 +106,10 @@ CXString clang_CompileCommand_getDirectory(CXCompileCommand CCmd) { if (!CCmd) - return createCXString((const char*)NULL); + return cxstring::createNull(); CompileCommand *cmd = static_cast<CompileCommand *>(CCmd); - return createCXString(cmd->Directory); + return cxstring::createRef(cmd->Directory.c_str()); } unsigned @@ -115,14 +125,14 @@ CXString clang_CompileCommand_getArg(CXCompileCommand CCmd, unsigned Arg) { if (!CCmd) - return createCXString((const char*)NULL); + return cxstring::createNull(); CompileCommand *Cmd = static_cast<CompileCommand *>(CCmd); if (Arg >= Cmd->CommandLine.size()) - return createCXString((const char*)NULL); + return cxstring::createNull(); - return createCXString(Cmd->CommandLine[Arg]); + return cxstring::createRef(Cmd->CommandLine[Arg].c_str()); } |