Esempio n. 1
0
/// CreateLocation - Creates a debug info location.
DILocation DIFactory::CreateLocation(unsigned LineNo, unsigned ColumnNo,
                                     DIScope S, DILocation OrigLoc) {
  Value *Elts[] = {
    ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
    ConstantInt::get(Type::getInt32Ty(VMContext), ColumnNo),
    S.getNode(),
    OrigLoc.getNode(),
  };
  return DILocation(MDNode::get(VMContext, &Elts[0], 4));
}
Esempio n. 2
0
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());
}