| 45 | } |
| 46 | |
| 47 | void IRNode::setIndex(const GlobalValue &G) { |
| 48 | if (const auto *GVariable = dyn_cast<GlobalVariable>(&G)) { |
| 49 | SmallVector<DIGlobalVariableExpression *, 10> Debugs; |
| 50 | GVariable->getDebugInfo(Debugs); |
| 51 | |
| 52 | for (auto *Debug : Debugs) { |
| 53 | if (!Debug || !Debug->getVariable()) |
| 54 | continue; |
| 55 | |
| 56 | auto *Var = Debug->getVariable(); |
| 57 | Name = Var->getDisplayName(); |
| 58 | if (Name.empty()) |
| 59 | continue; |
| 60 | |
| 61 | Index = LocIndex(getFullPath(*Var), 0, 0); |
| 62 | break; |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | if (!Name.empty()) |
| 67 | return; |
| 68 | |
| 69 | Name = G.getName(); |
| 70 | assert(!Name.empty() && "Unexpected Program State"); |
| 71 | } |
nothing calls this directly
no test coverage detected