diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-12-04 07:26:44 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-12-04 07:26:44 +0000 |
commit | 7e96bfb4d507700a122f270a11ce3fc0e8e36c85 (patch) | |
tree | 373b58577b83eede589540df135b3b3d6bdc373a /tools | |
parent | 1fec8fcfffb653a32fb147505677b3fe1fef2503 (diff) | |
download | clang-7e96bfb4d507700a122f270a11ce3fc0e8e36c85.tar.gz |
Introduce CompilationDatabase::getAllCompileCommands() that returns all
compile commands of the database and expose it via the libclang API.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169226 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/libclang/CXCompilationDatabase.cpp | 11 | ||||
-rw-r--r-- | tools/libclang/libclang.exports | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/tools/libclang/CXCompilationDatabase.cpp b/tools/libclang/CXCompilationDatabase.cpp index 7bd319ac29..8567d318a2 100644 --- a/tools/libclang/CXCompilationDatabase.cpp +++ b/tools/libclang/CXCompilationDatabase.cpp @@ -59,6 +59,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) { diff --git a/tools/libclang/libclang.exports b/tools/libclang/libclang.exports index 4495b66bdc..ee34edcbb2 100644 --- a/tools/libclang/libclang.exports +++ b/tools/libclang/libclang.exports @@ -250,6 +250,7 @@ clang_tokenize clang_CompilationDatabase_fromDirectory clang_CompilationDatabase_dispose clang_CompilationDatabase_getCompileCommands +clang_CompilationDatabase_getAllCompileCommands clang_CompileCommands_dispose clang_CompileCommands_getSize clang_CompileCommands_getCommand |