| 10 | using namespace ast_matchers; |
| 11 | |
| 12 | SourceAnalyzerImpl::SourceAnalyzerImpl(const SourceCollection &SC) { |
| 13 | for (const auto *ASTUnit : SC.getASTUnits()) { |
| 14 | if (!ASTUnit) |
| 15 | continue; |
| 16 | |
| 17 | auto *MainFD = getMainFuncDecl(*ASTUnit); |
| 18 | if (MainFD) { |
| 19 | Location MainFuncLoc; |
| 20 | MainFuncLoc.setFullLocationFromFunctionDecl(MainFD); |
| 21 | |
| 22 | if (util::getRelativePath(MainFuncLoc.getFilePath(), SC.getBaseDir()) |
| 23 | .empty()) |
| 24 | continue; |
| 25 | |
| 26 | Report.setMainFuncLoc(MainFuncLoc); |
| 27 | } |
| 28 | |
| 29 | Report.addSourceInfo( |
| 30 | util::getNormalizedPath(ASTUnit->getOriginalSourceFileName().str()), |
| 31 | getEndOffset(*ASTUnit), getIncludes(*ASTUnit)); |
| 32 | } |
| 33 | Report.setSrcBaseDir(SC.getBaseDir()); |
| 34 | } |
| 35 | |
| 36 | std::unique_ptr<AnalyzerReport> SourceAnalyzerImpl::getReport() { |
| 37 | return std::make_unique<SourceAnalysisReport>(Report); |
nothing calls this directly
no test coverage detected