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

Method initializeRDAnalyzer

lib/inputanalysis/DefAnalyzer.cpp:40–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40void DefAnalyzer::initializeRDAnalyzer(
41 const SourceCollection &SC, const DirectionAnalysisReport &DirectionReport,
42 const FilePathAnalysisReport &FilePathReport) {
43 RDExtension Extension;
44
45 auto NewDirectionReport = std::make_shared<DirectionAnalysisReport>();
46 assert(NewDirectionReport && "Unexpected Program State");
47
48 for (auto Iter : DirectionReport.get()) {
49 NewDirectionReport->set(Iter.first, Iter.second);
50 }
51
52 for (auto *Constructor : util::collectConstructors(SC.getASTUnits())) {
53 if (!Constructor)
54 continue;
55
56 for (auto &MangledName : util::getMangledNames(*Constructor)) {
57 auto *F = Loader->getSourceCollection().getLLVMModule().getFunction(
58 MangledName);
59 if (!F)
60 continue;
61
62 unsigned Idx = 0;
63 if (F->hasStructRetAttr())
64 Idx += 1;
65
66 auto *A = F->getArg(Idx);
67 if (!A)
68 continue;
69
70 NewDirectionReport->set(*A, Dir_Out);
71 }
72 }
73
74 Extension.setDirectionReport(NewDirectionReport);
75
76 for (const auto &Iter : FilePathReport.get()) {
77 if (!Iter.second)
78 continue;
79
80 auto DecomposedKey = FilePathReport.decomposeArgPropReportKey(Iter.first);
81 Extension.addTermination(std::get<0>(DecomposedKey),
82 std::get<1>(DecomposedKey));
83 }
84
85 for (const auto *Method :
86 util::collectNonStaticClassMethods(SC.getASTUnits())) {
87 assert(Method && "Unexpected Program State");
88 for (auto &MangledName : util::getMangledNames(*Method))
89 Extension.addNonStaticClassMethod(MangledName);
90 }
91
92 Analyzer = std::make_unique<RDAnalyzer>(30, &Extension);
93}
94
95std::map<Unittest *, std::vector<DefAnalyzer::FuncDef>>
96DefAnalyzer::analyzeUTDefs() {

Callers

nothing calls this directly

Calls 14

collectConstructorsFunction · 0.85
getMangledNamesFunction · 0.85
getFunctionMethod · 0.80
getLLVMModuleMethod · 0.80
getSourceCollectionMethod · 0.80
getArgMethod · 0.80
addTerminationMethod · 0.80
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected