| 119 | } |
| 120 | |
| 121 | void 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 | } |
nothing calls this directly
no test coverage detected