mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 15:45:08 +00:00
18 lines
544 B
C++
18 lines
544 B
C++
#include "CompilationDatabase.h"
|
|
|
|
#include <iostream>
|
|
|
|
clang::CompilationDatabase::CompilationDatabase(const std::string& project_path) {
|
|
CXCompilationDatabase_Error error;
|
|
cx_db = clang_CompilationDatabase_fromDirectory(project_path.c_str(), &error);
|
|
if (error == CXCompilationDatabase_CanNotLoadDatabase) {
|
|
std::cerr << "[FATAL]: Unable to load compile_commands.json located at \""
|
|
<< project_path << "\"";
|
|
exit(1);
|
|
}
|
|
}
|
|
|
|
clang::CompilationDatabase::~CompilationDatabase() {
|
|
clang_CompilationDatabase_dispose(cx_db);
|
|
}
|