MCPcopy Create free account
hub / github.com/Samsung/UTopia / SourceAnalyzerImpl

Method SourceAnalyzerImpl

lib/sourceanalysis/SourceAnalyzerImpl.cpp:12–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10using namespace ast_matchers;
11
12SourceAnalyzerImpl::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
36std::unique_ptr<AnalyzerReport> SourceAnalyzerImpl::getReport() {
37 return std::make_unique<SourceAnalysisReport>(Report);

Callers

nothing calls this directly

Calls 10

getRelativePathFunction · 0.85
getNormalizedPathFunction · 0.85
emptyMethod · 0.80
getBaseDirMethod · 0.80
setMainFuncLocMethod · 0.80
addSourceInfoMethod · 0.80
setSrcBaseDirMethod · 0.80
getASTUnitsMethod · 0.45
getFilePathMethod · 0.45

Tested by

no test coverage detected