/// processLocation - Process DILocation. void DebugInfoFinder::processLocation(DILocation Loc) { if (Loc.isNull()) return; DIScope S(Loc.getScope().getNode()); if (S.isNull()) return; if (S.isCompileUnit()) addCompileUnit(DICompileUnit(S.getNode())); else if (S.isSubprogram()) processSubprogram(DISubprogram(S.getNode())); else if (S.isLexicalBlock()) processLexicalBlock(DILexicalBlock(S.getNode())); processLocation(Loc.getOrigLocation()); }
static MDNode *UpdateInlinedAtInfo(MDNode *InsnMD, MDNode *TheCallMD, LLVMContext &Context) { DILocation ILoc(InsnMD); if (ILoc.isNull()) return InsnMD; DILocation CallLoc(TheCallMD); if (CallLoc.isNull()) return InsnMD; DILocation OrigLocation = ILoc.getOrigLocation(); MDNode *NewLoc = TheCallMD; if (!OrigLocation.isNull()) NewLoc = UpdateInlinedAtInfo(OrigLocation.getNode(), TheCallMD, Context); SmallVector<Value *, 4> MDVs; MDVs.push_back(InsnMD->getElement(0)); // Line MDVs.push_back(InsnMD->getElement(1)); // Col MDVs.push_back(InsnMD->getElement(2)); // Scope MDVs.push_back(NewLoc); return MDNode::get(Context, MDVs.data(), MDVs.size()); }