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

Method load

tests/inputanalysis/TestDefAnalyzer.cpp:39–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37 return true;
38 }
39 std::unique_ptr<DefAnalyzer> load(std::string BaseDirPath,
40 std::string CodePath,
41 std::string CompileOptions,
42 std::set<std::string> APINames) {
43 std::vector<std::string> CodePaths = {CodePath};
44 auto CH = TestHelperFactory().createCompileHelper(
45 BaseDirPath, CodePaths, CompileOptions, CompileHelper::SourceType_CPP);
46 if (!CH)
47 return nullptr;
48
49 auto AL = std::make_shared<APIManualLoader>(APINames);
50 if (!AL)
51 return nullptr;
52
53 Loader = std::make_unique<UTLoader>(CH, AL);
54 if (!Loader)
55 return nullptr;
56
57 auto Factory = createTCAnalyzerFactory("gtest");
58 if (!Factory)
59 return nullptr;
60
61 auto Extractor = Factory->createTCExtractor(Loader->getSourceCollection());
62 if (!Extractor)
63 return nullptr;
64
65 Extractor->load();
66 std::vector<Unittest> TCs;
67 for (const auto &TCName : Extractor->getTCNames()) {
68 const auto &UT = Extractor->getTC(TCName);
69 if (!UT)
70 continue;
71
72 TCs.emplace_back(*UT);
73 }
74
75 const auto &M = Loader->getSourceCollection().getLLVMModule();
76 std::set<Function *> Funcs;
77 for (const auto &APIName : APINames) {
78 const auto *F = M.getFunction(APIName);
79 if (!F)
80 continue;
81
82 Funcs.insert(const_cast<Function *>(F));
83 }
84
85 return std::make_unique<DefAnalyzer>(
86 Loader.get(), TCs, Funcs,
87 std::make_shared<DebugInfoMap>(Loader->getSourceCollection()));
88 }
89};
90
91TEST_F(TestDefAnalyzer, StringP) {

Callers 1

initMethod · 0.45

Calls 10

TestHelperFactoryClass · 0.85
createTCAnalyzerFactoryFunction · 0.85
createCompileHelperMethod · 0.80
getSourceCollectionMethod · 0.80
getTCNamesMethod · 0.80
getTCMethod · 0.80
getLLVMModuleMethod · 0.80
getFunctionMethod · 0.80
createTCExtractorMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected