| 12 | namespace fs = std::experimental::filesystem; |
| 13 | |
| 14 | UTLoader::UTLoader(std::shared_ptr<SourceLoader> SrcLoader, |
| 15 | std::shared_ptr<APILoader> APILoader, |
| 16 | std::vector<std::string> ReportPaths) { |
| 17 | if (SrcLoader) |
| 18 | Source = SrcLoader->load(); |
| 19 | |
| 20 | if (APILoader) |
| 21 | APIs = APILoader->load(); |
| 22 | |
| 23 | for (auto &Path : ReportPaths) { |
| 24 | if (!fs::is_directory(Path)) |
| 25 | continue; |
| 26 | |
| 27 | for (auto &ReportFile : util::readDirectory(Path)) { |
| 28 | auto JsonValue = util::parseJsonFileToJsonValue(ReportFile.c_str()); |
| 29 | AllocSizeReport.fromJson(JsonValue); |
| 30 | ArrayReport.fromJson(JsonValue); |
| 31 | ConstReport.fromJson(JsonValue); |
| 32 | DirectionReport.fromJson(JsonValue); |
| 33 | FilePathReport.fromJson(JsonValue); |
| 34 | LoopReport.fromJson(JsonValue); |
| 35 | TypeReport.fromJson(JsonValue); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | if (Source) { |
| 40 | AllocSizeAnalyzer AAnalyzer(Source->getLLVMModule(), &AllocSizeReport); |
| 41 | AllocSizeReport = AAnalyzer.result(); |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | const std::set<std::string> &UTLoader::getAPIs() const { return APIs; } |
| 46 |
nothing calls this directly
no test coverage detected