| 23 | } |
| 24 | |
| 25 | ASTDefNode *DebugInfoMap::getASTDefNode(const llvm::Value &V, int OIdx) { |
| 26 | ASTDefNode *Result = nullptr; |
| 27 | |
| 28 | if (isa<llvm::CallBase>(&V) && OIdx >= 0) { |
| 29 | const auto &CB = *llvm::dyn_cast<llvm::CallBase>(&V); |
| 30 | try { |
| 31 | OIdx -= getDiffNumArgs(CB); |
| 32 | if (OIdx >= 0) |
| 33 | return getFromArgMap(CB, OIdx); |
| 34 | } catch (std::runtime_error &E) { |
| 35 | return nullptr; |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | if (const auto *I = dyn_cast<llvm::Instruction>(&V)) |
| 40 | Result = getFromDefMap(*I); |
| 41 | else if (const auto *G = dyn_cast<llvm::GlobalValue>(&V)) |
| 42 | Result = getFromGVMap(*G); |
| 43 | if (!Result) |
| 44 | return nullptr; |
| 45 | |
| 46 | // NOTE: ignore template type |
| 47 | if (isTemplateType(*Result)) |
| 48 | return nullptr; |
| 49 | if (isNullType(*Result)) |
| 50 | return nullptr; |
| 51 | return Result; |
| 52 | } |
| 53 | |
| 54 | unsigned DebugInfoMap::getDiffNumArgs(const llvm::CallBase &CB) const { |
| 55 | auto *ACN = getFromCallMap(CB); |
no outgoing calls
no test coverage detected