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

Method getASTDefNode

lib/astirmap/DebugInfoMap.cpp:25–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23}
24
25ASTDefNode *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
54unsigned DebugInfoMap::getDiffNumArgs(const llvm::CallBase &CB) const {
55 auto *ACN = getFromCallMap(CB);

Callers 5

getFromDefMapMethod · 0.45
collectASTIRNodesMethod · 0.45
isInvalidRDNodeMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected