| 38 | } |
| 39 | |
| 40 | void 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 | |
| 95 | std::map<Unittest *, std::vector<DefAnalyzer::FuncDef>> |
| 96 | DefAnalyzer::analyzeUTDefs() { |
nothing calls this directly
no test coverage detected