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

Method handle

lib/indcallsolver/TestTypeVirtSolverHandler.cpp:121–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121void TestTypeVirtSolverHandler::handle(const GlobalVariable &GV) {
122 SmallVector<MDNode *, 2> MDTypes;
123 GV.getMetadata(LLVMContext::MD_type, MDTypes);
124 if (MDTypes.empty() || GV.isDeclaration() || !GV.isConstant() ||
125 !GV.hasInitializer())
126 return;
127
128 for (const auto *MDType : MDTypes) {
129 if (!MDType || MDType->getNumOperands() < 2)
130 continue;
131
132 const auto *MDTypeID = MDType->getOperand(1).get();
133 const auto *ConstantMD =
134 dyn_cast_or_null<ConstantAsMetadata>(MDType->getOperand(0));
135 if (!ConstantMD)
136 continue;
137
138 const auto *CI = dyn_cast_or_null<ConstantInt>(ConstantMD->getValue());
139 if (!CI)
140 continue;
141
142 TypeIDMap[MDTypeID].emplace(TypeMetaInfo(&GV, CI->getZExtValue()));
143 }
144}

Callers

nothing calls this directly

Calls 4

TypeMetaInfoClass · 0.85
emptyMethod · 0.80
getMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected