Commit 68465773 authored by Ole Christian Eidheim's avatar Ole Christian Eidheim
Browse files

Added error handling for CompilationDatabase

parent 5f60c3a4
......@@ -2,13 +2,13 @@
#include <exception>
clangmm::CompilationDatabase::CompilationDatabase(const std::string &project_path) {
CXCompilationDatabase_Error error;
cx_db = clang_CompilationDatabase_fromDirectory(project_path.c_str(), &error);
if(error) {
//TODO: compile_commands.json is missing, create it?
}
cx_db = clang_CompilationDatabase_fromDirectory(project_path.c_str(), &cx_db_error);
}
clangmm::CompilationDatabase::~CompilationDatabase() {
clang_CompilationDatabase_dispose(cx_db);
}
clangmm::CompilationDatabase::operator bool() const {
return !static_cast<bool>(cx_db_error);
}
......@@ -6,9 +6,12 @@
namespace clangmm {
class CompilationDatabase {
CXCompilationDatabase_Error cx_db_error;
public:
explicit CompilationDatabase(const std::string &project_path);
~CompilationDatabase();
operator bool() const;
CXCompilationDatabase cx_db;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment