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

Method updateAPICallsInUnittests

lib/inputanalysis/DefAnalyzer.cpp:226–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224}
225
226void DefAnalyzer::updateAPICallsInUnittests(
227 const std::map<Unittest *, std::vector<FuncDef>> &Map,
228 const DefMapGenerator &DG) const {
229 for (auto Iter : Map) {
230 std::vector<APICall> APICalls;
231 auto *UT = Iter.first;
232 for (auto &FuncDef : Iter.second) {
233 std::vector<APIArgument> APIArgs;
234 for (auto &ArgDef : FuncDef.ArgDefs) {
235 std::set<unsigned> DefIDs;
236 for (auto &Def : ArgDef.Defs) {
237 auto D = Def.getDefinition();
238 if (!D.first)
239 continue;
240
241 auto *ADN = ASTMap->getASTDefNode(*D.first, D.second);
242 if (!ADN)
243 continue;
244
245 try {
246 DefIDs.emplace(DG.getID(*ADN));
247 } catch (std::invalid_argument &E) {
248 assert(false && "Unexpected Program State");
249 }
250 }
251 APIArgs.emplace_back(DefIDs);
252 }
253 APICalls.emplace_back(*const_cast<llvm::CallBase *>(&FuncDef.CB),
254 APIArgs);
255 }
256 UT->setAPICalls(APICalls);
257 }
258}
259
260bool DefAnalyzer::isInitializedLocalVariable(const RDNode &Node) const {
261 auto &IR = Node.getTarget().getIR();

Callers

nothing calls this directly

Calls 4

getDefinitionMethod · 0.80
setAPICallsMethod · 0.80
getASTDefNodeMethod · 0.45
getIDMethod · 0.45

Tested by

no test coverage detected