summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-12-04 07:26:44 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-12-04 07:26:44 +0000
commit251ad5e06b2002ae8e0a0c1b2c03f89356fb55f5 (patch)
treefb08f72761a7ef459a4b7b29d5dafdfdc5f371ad /clang/tools/libclang
parent0e9acc94bc6bd2fdef0534b993b5a8fff70c6f77 (diff)
downloadbcm5719-llvm-251ad5e06b2002ae8e0a0c1b2c03f89356fb55f5.tar.gz
bcm5719-llvm-251ad5e06b2002ae8e0a0c1b2c03f89356fb55f5.zip
Introduce CompilationDatabase::getAllCompileCommands() that returns all
compile commands of the database and expose it via the libclang API. llvm-svn: 169226
Diffstat (limited to 'clang/tools/libclang')
-rw-r--r--clang/tools/libclang/CXCompilationDatabase.cpp11
-rw-r--r--clang/tools/libclang/libclang.exports1
2 files changed, 12 insertions, 0 deletions
diff --git a/clang/tools/libclang/CXCompilationDatabase.cpp b/clang/tools/libclang/CXCompilationDatabase.cpp
index 7bd319ac295..8567d318a27 100644
--- a/clang/tools/libclang/CXCompilationDatabase.cpp
+++ b/clang/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/clang/tools/libclang/libclang.exports b/clang/tools/libclang/libclang.exports
index 4495b66bdc1..ee34edcbb2d 100644
--- a/clang/tools/libclang/libclang.exports
+++ b/clang/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
OpenPOWER on IntegriCloud