summaryrefslogtreecommitdiffstats
path: root/clang/include
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/include
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/include')
-rw-r--r--clang/include/clang-c/CXCompilationDatabase.h6
-rw-r--r--clang/include/clang-c/Index.h2
-rw-r--r--clang/include/clang/Tooling/CompilationDatabase.h10
-rw-r--r--clang/include/clang/Tooling/JSONCompilationDatabase.h8
4 files changed, 25 insertions, 1 deletions
diff --git a/clang/include/clang-c/CXCompilationDatabase.h b/clang/include/clang-c/CXCompilationDatabase.h
index d11133cf932..ff1ec63db05 100644
--- a/clang/include/clang-c/CXCompilationDatabase.h
+++ b/clang/include/clang-c/CXCompilationDatabase.h
@@ -95,6 +95,12 @@ clang_CompilationDatabase_getCompileCommands(CXCompilationDatabase,
const char *CompleteFileName);
/**
+ * \brief Get all the compile commands in the given compilation database.
+ */
+CINDEX_LINKAGE CXCompileCommands
+clang_CompilationDatabase_getAllCompileCommands(CXCompilationDatabase);
+
+/**
* \brief Free the given CompileCommands
*/
CINDEX_LINKAGE void clang_CompileCommands_dispose(CXCompileCommands);
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h
index aa3403cc80c..24c754d995c 100644
--- a/clang/include/clang-c/Index.h
+++ b/clang/include/clang-c/Index.h
@@ -32,7 +32,7 @@
* compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable.
*/
#define CINDEX_VERSION_MAJOR 0
-#define CINDEX_VERSION_MINOR 6
+#define CINDEX_VERSION_MINOR 7
#define CINDEX_VERSION_ENCODE(major, minor) ( \
((major) * 10000) \
diff --git a/clang/include/clang/Tooling/CompilationDatabase.h b/clang/include/clang/Tooling/CompilationDatabase.h
index a40bffec78b..d75cc5fc340 100644
--- a/clang/include/clang/Tooling/CompilationDatabase.h
+++ b/clang/include/clang/Tooling/CompilationDatabase.h
@@ -106,6 +106,10 @@ public:
/// \brief Returns the list of all files available in the compilation database.
virtual std::vector<std::string> getAllFiles() const = 0;
+
+ /// \brief Returns all compile commands for all the files in the compilation
+ /// database.
+ virtual std::vector<CompileCommand> getAllCompileCommands() const = 0;
};
/// \brief Interface for compilation database plugins.
@@ -181,6 +185,12 @@ public:
/// Note: This is always an empty list for the fixed compilation database.
virtual std::vector<std::string> getAllFiles() const;
+ /// \brief Returns all compile commands for all the files in the compilation
+ /// database.
+ ///
+ /// Note: This is always an empty list for the fixed compilation database.
+ virtual std::vector<CompileCommand> getAllCompileCommands() const;
+
private:
/// This is built up to contain a single entry vector to be returned from
/// getCompileCommands after adding the positional argument.
diff --git a/clang/include/clang/Tooling/JSONCompilationDatabase.h b/clang/include/clang/Tooling/JSONCompilationDatabase.h
index d62ab5c5036..0424d946298 100644
--- a/clang/include/clang/Tooling/JSONCompilationDatabase.h
+++ b/clang/include/clang/Tooling/JSONCompilationDatabase.h
@@ -75,6 +75,10 @@ public:
/// These are the 'file' entries of the JSON objects.
virtual std::vector<std::string> getAllFiles() const;
+ /// \brief Returns all compile commands for all the files in the compilation
+ /// database.
+ virtual std::vector<CompileCommand> getAllCompileCommands() const;
+
private:
/// \brief Constructs a JSON compilation database on a memory buffer.
JSONCompilationDatabase(llvm::MemoryBuffer *Database)
@@ -91,6 +95,10 @@ private:
typedef std::pair<llvm::yaml::ScalarNode*,
llvm::yaml::ScalarNode*> CompileCommandRef;
+ /// \brief Converts the given array of CompileCommandRefs to CompileCommands.
+ void getCommands(ArrayRef<CompileCommandRef> CommandsRef,
+ std::vector<CompileCommand> &Commands) const;
+
// Maps file paths to the compile command lines for that file.
llvm::StringMap< std::vector<CompileCommandRef> > IndexByFile;
OpenPOWER on IntegriCloud