| 15 | ProjectDir(std::move(ProjectDir)) {} |
| 16 | |
| 17 | std::unique_ptr<BuildDB> BuildDB::fromJson(const std::string &Path) { |
| 18 | if (!fs::is_regular_file(Path)) |
| 19 | return nullptr; |
| 20 | |
| 21 | try { |
| 22 | auto JsonRoot = util::parseJsonFileToJsonValue(Path.c_str()); |
| 23 | std::vector<std::string> ASTFiles; |
| 24 | for (auto AST : JsonRoot["ast"]) { |
| 25 | ASTFiles.emplace_back(AST.asString()); |
| 26 | } |
| 27 | return std::make_unique<BuildDB>(JsonRoot["bc"].asString(), ASTFiles, |
| 28 | JsonRoot["project_dir"].asString()); |
| 29 | } catch (...) { |
| 30 | return nullptr; |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | std::string BuildDB::getBCPath() const { return BCPath; } |
| 35 | std::vector<std::string> BuildDB::getASTPaths() const { return ASTPaths; } |
nothing calls this directly
no test coverage detected