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

Method of

lib/astirmap/LocIndex.cpp:27–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25}
26
27LocIndex LocIndex::of(const llvm::AllocaInst &AI) {
28 const auto *F = AI.getFunction();
29 assert(F && "Unexpected Program State");
30
31 for (auto &IterB : *F)
32 for (auto &IterI : IterB) {
33 const auto *CB = llvm::dyn_cast<llvm::CallBase>(&IterI);
34 if (!CB)
35 continue;
36
37 const auto *CF = CB->getCalledFunction();
38 if (!CF || !CF->isIntrinsic() || CF->getName() != "llvm.dbg.declare")
39 continue;
40
41 assert(CB->getNumArgOperands() > 0 && "Unexpected Program State");
42
43 const auto *M1 =
44 llvm::dyn_cast_or_null<llvm::MetadataAsValue>(CB->getArgOperand(0));
45 if (!M1)
46 continue;
47
48 const auto *M2 =
49 llvm::dyn_cast_or_null<llvm::LocalAsMetadata>(M1->getMetadata());
50 if (!M2 || M2->getValue() != &AI)
51 continue;
52
53 const auto &Loc = CB->getDebugLoc();
54 if (Loc.get())
55 return LocIndex(getFullPath(CB->getDebugLoc()), Loc.getLine(),
56 Loc.getCol());
57 }
58 throw std::runtime_error("DebugLoc Not Found");
59}
60
61LocIndex LocIndex::of(const llvm::Instruction &I) {
62 if (auto *AI = llvm::dyn_cast<llvm::AllocaInst>(&I))

Callers

nothing calls this directly

Calls 8

LocIndexClass · 0.85
getFullPathFunction · 0.85
getFunctionMethod · 0.80
getCalledFunctionMethod · 0.80
getNameMethod · 0.45
getValueMethod · 0.45
getMethod · 0.45
getLineMethod · 0.45

Tested by

no test coverage detected