1 //===- DebugInfo.cpp - Debug Information Helper Classes -------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements the helper classes used to build and interpret debug
11 // information in LLVM IR form.
13 //===----------------------------------------------------------------------===//
15 #include "llvm-c/DebugInfo.h"
16 #include "llvm/ADT/DenseMap.h"
17 #include "llvm/ADT/DenseSet.h"
18 #include "llvm/ADT/None.h"
19 #include "llvm/ADT/STLExtras.h"
20 #include "llvm/ADT/SmallPtrSet.h"
21 #include "llvm/ADT/SmallVector.h"
22 #include "llvm/ADT/StringRef.h"
23 #include "llvm/IR/BasicBlock.h"
24 #include "llvm/IR/Constants.h"
25 #include "llvm/IR/DebugInfoMetadata.h"
26 #include "llvm/IR/DebugLoc.h"
27 #include "llvm/IR/DebugInfo.h"
28 #include "llvm/IR/DIBuilder.h"
29 #include "llvm/IR/Function.h"
30 #include "llvm/IR/GVMaterializer.h"
31 #include "llvm/IR/Instruction.h"
32 #include "llvm/IR/IntrinsicInst.h"
33 #include "llvm/IR/LLVMContext.h"
34 #include "llvm/IR/Metadata.h"
35 #include "llvm/IR/Module.h"
36 #include "llvm/Support/Casting.h"
42 using namespace llvm::dwarf;
44 DISubprogram *llvm::getDISubprogram(const MDNode *Scope) {
45 if (auto *LocalScope = dyn_cast_or_null<DILocalScope>(Scope))
46 return LocalScope->getSubprogram();
50 //===----------------------------------------------------------------------===//
51 // DebugInfoFinder implementations.
52 //===----------------------------------------------------------------------===//
54 void DebugInfoFinder::reset() {
63 void DebugInfoFinder::processModule(const Module &M) {
64 for (auto *CU : M.debug_compile_units()) {
66 for (auto DIG : CU->getGlobalVariables()) {
67 if (!addGlobalVariable(DIG))
69 auto *GV = DIG->getVariable();
70 processScope(GV->getScope());
71 processType(GV->getType().resolve());
73 for (auto *ET : CU->getEnumTypes())
75 for (auto *RT : CU->getRetainedTypes())
76 if (auto *T = dyn_cast<DIType>(RT))
79 processSubprogram(cast<DISubprogram>(RT));
80 for (auto *Import : CU->getImportedEntities()) {
81 auto *Entity = Import->getEntity().resolve();
82 if (auto *T = dyn_cast<DIType>(Entity))
84 else if (auto *SP = dyn_cast<DISubprogram>(Entity))
85 processSubprogram(SP);
86 else if (auto *NS = dyn_cast<DINamespace>(Entity))
87 processScope(NS->getScope());
88 else if (auto *M = dyn_cast<DIModule>(Entity))
89 processScope(M->getScope());
92 for (auto &F : M.functions()) {
93 if (auto *SP = cast_or_null<DISubprogram>(F.getSubprogram()))
94 processSubprogram(SP);
95 // There could be subprograms from inlined functions referenced from
96 // instructions only. Walk the function to find them.
97 for (const BasicBlock &BB : F) {
98 for (const Instruction &I : BB) {
101 processLocation(M, I.getDebugLoc().get());
107 void DebugInfoFinder::processLocation(const Module &M, const DILocation *Loc) {
110 processScope(Loc->getScope());
111 processLocation(M, Loc->getInlinedAt());
114 void DebugInfoFinder::processType(DIType *DT) {
117 processScope(DT->getScope().resolve());
118 if (auto *ST = dyn_cast<DISubroutineType>(DT)) {
119 for (DITypeRef Ref : ST->getTypeArray())
120 processType(Ref.resolve());
123 if (auto *DCT = dyn_cast<DICompositeType>(DT)) {
124 processType(DCT->getBaseType().resolve());
125 for (Metadata *D : DCT->getElements()) {
126 if (auto *T = dyn_cast<DIType>(D))
128 else if (auto *SP = dyn_cast<DISubprogram>(D))
129 processSubprogram(SP);
133 if (auto *DDT = dyn_cast<DIDerivedType>(DT)) {
134 processType(DDT->getBaseType().resolve());
138 void DebugInfoFinder::processScope(DIScope *Scope) {
141 if (auto *Ty = dyn_cast<DIType>(Scope)) {
145 if (auto *CU = dyn_cast<DICompileUnit>(Scope)) {
149 if (auto *SP = dyn_cast<DISubprogram>(Scope)) {
150 processSubprogram(SP);
153 if (!addScope(Scope))
155 if (auto *LB = dyn_cast<DILexicalBlockBase>(Scope)) {
156 processScope(LB->getScope());
157 } else if (auto *NS = dyn_cast<DINamespace>(Scope)) {
158 processScope(NS->getScope());
159 } else if (auto *M = dyn_cast<DIModule>(Scope)) {
160 processScope(M->getScope());
164 void DebugInfoFinder::processSubprogram(DISubprogram *SP) {
165 if (!addSubprogram(SP))
167 processScope(SP->getScope().resolve());
168 processType(SP->getType());
169 for (auto *Element : SP->getTemplateParams()) {
170 if (auto *TType = dyn_cast<DITemplateTypeParameter>(Element)) {
171 processType(TType->getType().resolve());
172 } else if (auto *TVal = dyn_cast<DITemplateValueParameter>(Element)) {
173 processType(TVal->getType().resolve());
178 void DebugInfoFinder::processDeclare(const Module &M,
179 const DbgDeclareInst *DDI) {
180 auto *N = dyn_cast<MDNode>(DDI->getVariable());
184 auto *DV = dyn_cast<DILocalVariable>(N);
188 if (!NodesSeen.insert(DV).second)
190 processScope(DV->getScope());
191 processType(DV->getType().resolve());
194 void DebugInfoFinder::processValue(const Module &M, const DbgValueInst *DVI) {
195 auto *N = dyn_cast<MDNode>(DVI->getVariable());
199 auto *DV = dyn_cast<DILocalVariable>(N);
203 if (!NodesSeen.insert(DV).second)
205 processScope(DV->getScope());
206 processType(DV->getType().resolve());
209 bool DebugInfoFinder::addType(DIType *DT) {
213 if (!NodesSeen.insert(DT).second)
216 TYs.push_back(const_cast<DIType *>(DT));
220 bool DebugInfoFinder::addCompileUnit(DICompileUnit *CU) {
223 if (!NodesSeen.insert(CU).second)
230 bool DebugInfoFinder::addGlobalVariable(DIGlobalVariableExpression *DIG) {
231 if (!NodesSeen.insert(DIG).second)
238 bool DebugInfoFinder::addSubprogram(DISubprogram *SP) {
242 if (!NodesSeen.insert(SP).second)
249 bool DebugInfoFinder::addScope(DIScope *Scope) {
252 // FIXME: Ocaml binding generates a scope with no content, we treat it
254 if (Scope->getNumOperands() == 0)
256 if (!NodesSeen.insert(Scope).second)
258 Scopes.push_back(Scope);
262 static MDNode *stripDebugLocFromLoopID(MDNode *N) {
263 assert(N->op_begin() != N->op_end() && "Missing self reference?");
265 // if there is no debug location, we do not have to rewrite this MDNode.
266 if (std::none_of(N->op_begin() + 1, N->op_end(), [](const MDOperand &Op) {
267 return isa<DILocation>(Op.get());
271 // If there is only the debug location without any actual loop metadata, we
272 // can remove the metadata.
273 if (std::none_of(N->op_begin() + 1, N->op_end(), [](const MDOperand &Op) {
274 return !isa<DILocation>(Op.get());
278 SmallVector<Metadata *, 4> Args;
279 // Reserve operand 0 for loop id self reference.
280 auto TempNode = MDNode::getTemporary(N->getContext(), None);
281 Args.push_back(TempNode.get());
282 // Add all non-debug location operands back.
283 for (auto Op = N->op_begin() + 1; Op != N->op_end(); Op++) {
284 if (!isa<DILocation>(*Op))
288 // Set the first operand to itself.
289 MDNode *LoopID = MDNode::get(N->getContext(), Args);
290 LoopID->replaceOperandWith(0, LoopID);
294 bool llvm::stripDebugInfo(Function &F) {
295 bool Changed = false;
296 if (F.getMetadata(LLVMContext::MD_dbg)) {
298 F.setSubprogram(nullptr);
301 DenseMap<MDNode*, MDNode*> LoopIDsMap;
302 for (BasicBlock &BB : F) {
303 for (auto II = BB.begin(), End = BB.end(); II != End;) {
304 Instruction &I = *II++; // We may delete the instruction, increment now.
305 if (isa<DbgInfoIntrinsic>(&I)) {
310 if (I.getDebugLoc()) {
312 I.setDebugLoc(DebugLoc());
316 auto *TermInst = BB.getTerminator();
318 // This is invalid IR, but we may not have run the verifier yet
320 if (auto *LoopID = TermInst->getMetadata(LLVMContext::MD_loop)) {
321 auto *NewLoopID = LoopIDsMap.lookup(LoopID);
323 NewLoopID = LoopIDsMap[LoopID] = stripDebugLocFromLoopID(LoopID);
324 if (NewLoopID != LoopID)
325 TermInst->setMetadata(LLVMContext::MD_loop, NewLoopID);
331 bool llvm::StripDebugInfo(Module &M) {
332 bool Changed = false;
334 for (Module::named_metadata_iterator NMI = M.named_metadata_begin(),
335 NME = M.named_metadata_end(); NMI != NME;) {
336 NamedMDNode *NMD = &*NMI;
339 // We're stripping debug info, and without them, coverage information
340 // doesn't quite make sense.
341 if (NMD->getName().startswith("llvm.dbg.") ||
342 NMD->getName() == "llvm.gcov") {
343 NMD->eraseFromParent();
348 for (Function &F : M)
349 Changed |= stripDebugInfo(F);
351 for (auto &GV : M.globals()) {
352 SmallVector<MDNode *, 1> MDs;
353 GV.getMetadata(LLVMContext::MD_dbg, MDs);
355 GV.eraseMetadata(LLVMContext::MD_dbg);
360 if (GVMaterializer *Materializer = M.getMaterializer())
361 Materializer->setStripDebugInfo();
368 /// Helper class to downgrade -g metadata to -gline-tables-only metadata.
369 class DebugTypeInfoRemoval {
370 DenseMap<Metadata *, Metadata *> Replacements;
373 /// The (void)() type.
374 MDNode *EmptySubroutineType;
377 /// Remember what linkage name we originally had before stripping. If we end
378 /// up making two subprograms identical who originally had different linkage
379 /// names, then we need to make one of them distinct, to avoid them getting
380 /// uniqued. Maps the new node to the old linkage name.
381 DenseMap<DISubprogram *, StringRef> NewToLinkageName;
383 // TODO: Remember the distinct subprogram we created for a given linkage name,
384 // so that we can continue to unique whenever possible. Map <newly created
385 // node, old linkage name> to the first (possibly distinct) mdsubprogram
386 // created for that combination. This is not strictly needed for correctness,
387 // but can cut down on the number of MDNodes and let us diff cleanly with the
388 // output of -gline-tables-only.
391 DebugTypeInfoRemoval(LLVMContext &C)
392 : EmptySubroutineType(DISubroutineType::get(C, DINode::FlagZero, 0,
393 MDNode::get(C, {}))) {}
395 Metadata *map(Metadata *M) {
398 auto Replacement = Replacements.find(M);
399 if (Replacement != Replacements.end())
400 return Replacement->second;
404 MDNode *mapNode(Metadata *N) { return dyn_cast_or_null<MDNode>(map(N)); }
406 /// Recursively remap N and all its referenced children. Does a DF post-order
407 /// traversal, so as to remap bottoms up.
408 void traverseAndRemap(MDNode *N) { traverse(N); }
411 // Create a new DISubprogram, to replace the one given.
412 DISubprogram *getReplacementSubprogram(DISubprogram *MDS) {
413 auto *FileAndScope = cast_or_null<DIFile>(map(MDS->getFile()));
414 StringRef LinkageName = MDS->getName().empty() ? MDS->getLinkageName() : "";
415 DISubprogram *Declaration = nullptr;
416 auto *Type = cast_or_null<DISubroutineType>(map(MDS->getType()));
417 DITypeRef ContainingType(map(MDS->getContainingType()));
418 auto *Unit = cast_or_null<DICompileUnit>(map(MDS->getUnit()));
419 auto Variables = nullptr;
420 auto TemplateParams = nullptr;
422 // Make a distinct DISubprogram, for situations that warrent it.
423 auto distinctMDSubprogram = [&]() {
424 return DISubprogram::getDistinct(
425 MDS->getContext(), FileAndScope, MDS->getName(), LinkageName,
426 FileAndScope, MDS->getLine(), Type, MDS->isLocalToUnit(),
427 MDS->isDefinition(), MDS->getScopeLine(), ContainingType,
428 MDS->getVirtuality(), MDS->getVirtualIndex(),
429 MDS->getThisAdjustment(), MDS->getFlags(), MDS->isOptimized(), Unit,
430 TemplateParams, Declaration, Variables);
433 if (MDS->isDistinct())
434 return distinctMDSubprogram();
436 auto *NewMDS = DISubprogram::get(
437 MDS->getContext(), FileAndScope, MDS->getName(), LinkageName,
438 FileAndScope, MDS->getLine(), Type, MDS->isLocalToUnit(),
439 MDS->isDefinition(), MDS->getScopeLine(), ContainingType,
440 MDS->getVirtuality(), MDS->getVirtualIndex(), MDS->getThisAdjustment(),
441 MDS->getFlags(), MDS->isOptimized(), Unit, TemplateParams, Declaration,
444 StringRef OldLinkageName = MDS->getLinkageName();
446 // See if we need to make a distinct one.
447 auto OrigLinkage = NewToLinkageName.find(NewMDS);
448 if (OrigLinkage != NewToLinkageName.end()) {
449 if (OrigLinkage->second == OldLinkageName)
453 // Otherwise, need to make a distinct one.
454 // TODO: Query the map to see if we already have one.
455 return distinctMDSubprogram();
458 NewToLinkageName.insert({NewMDS, MDS->getLinkageName()});
462 /// Create a new compile unit, to replace the one given
463 DICompileUnit *getReplacementCU(DICompileUnit *CU) {
464 // Drop skeleton CUs.
468 auto *File = cast_or_null<DIFile>(map(CU->getFile()));
469 MDTuple *EnumTypes = nullptr;
470 MDTuple *RetainedTypes = nullptr;
471 MDTuple *GlobalVariables = nullptr;
472 MDTuple *ImportedEntities = nullptr;
473 return DICompileUnit::getDistinct(
474 CU->getContext(), CU->getSourceLanguage(), File, CU->getProducer(),
475 CU->isOptimized(), CU->getFlags(), CU->getRuntimeVersion(),
476 CU->getSplitDebugFilename(), DICompileUnit::LineTablesOnly, EnumTypes,
477 RetainedTypes, GlobalVariables, ImportedEntities, CU->getMacros(),
478 CU->getDWOId(), CU->getSplitDebugInlining(),
479 CU->getDebugInfoForProfiling(), CU->getGnuPubnames());
482 DILocation *getReplacementMDLocation(DILocation *MLD) {
483 auto *Scope = map(MLD->getScope());
484 auto *InlinedAt = map(MLD->getInlinedAt());
485 if (MLD->isDistinct())
486 return DILocation::getDistinct(MLD->getContext(), MLD->getLine(),
487 MLD->getColumn(), Scope, InlinedAt);
488 return DILocation::get(MLD->getContext(), MLD->getLine(), MLD->getColumn(),
492 /// Create a new generic MDNode, to replace the one given
493 MDNode *getReplacementMDNode(MDNode *N) {
494 SmallVector<Metadata *, 8> Ops;
495 Ops.reserve(N->getNumOperands());
496 for (auto &I : N->operands())
498 Ops.push_back(map(I));
499 auto *Ret = MDNode::get(N->getContext(), Ops);
503 /// Attempt to re-map N to a newly created node.
504 void remap(MDNode *N) {
505 if (Replacements.count(N))
508 auto doRemap = [&](MDNode *N) -> MDNode * {
511 if (auto *MDSub = dyn_cast<DISubprogram>(N)) {
512 remap(MDSub->getUnit());
513 return getReplacementSubprogram(MDSub);
515 if (isa<DISubroutineType>(N))
516 return EmptySubroutineType;
517 if (auto *CU = dyn_cast<DICompileUnit>(N))
518 return getReplacementCU(CU);
521 if (auto *MDLB = dyn_cast<DILexicalBlockBase>(N))
522 // Remap to our referenced scope (recursively).
523 return mapNode(MDLB->getScope());
524 if (auto *MLD = dyn_cast<DILocation>(N))
525 return getReplacementMDLocation(MLD);
527 // Otherwise, if we see these, just drop them now. Not strictly necessary,
528 // but this speeds things up a little.
532 return getReplacementMDNode(N);
534 Replacements[N] = doRemap(N);
537 /// Do the remapping traversal.
538 void traverse(MDNode *);
541 } // end anonymous namespace
543 void DebugTypeInfoRemoval::traverse(MDNode *N) {
544 if (!N || Replacements.count(N))
547 // To avoid cycles, as well as for efficiency sake, we will sometimes prune
548 // parts of the graph.
549 auto prune = [](MDNode *Parent, MDNode *Child) {
550 if (auto *MDS = dyn_cast<DISubprogram>(Parent))
551 return Child == MDS->getVariables().get();
555 SmallVector<MDNode *, 16> ToVisit;
556 DenseSet<MDNode *> Opened;
558 // Visit each node starting at N in post order, and map them.
559 ToVisit.push_back(N);
560 while (!ToVisit.empty()) {
561 auto *N = ToVisit.back();
562 if (!Opened.insert(N).second) {
568 for (auto &I : N->operands())
569 if (auto *MDN = dyn_cast_or_null<MDNode>(I))
570 if (!Opened.count(MDN) && !Replacements.count(MDN) && !prune(N, MDN) &&
571 !isa<DICompileUnit>(MDN))
572 ToVisit.push_back(MDN);
576 bool llvm::stripNonLineTableDebugInfo(Module &M) {
577 bool Changed = false;
579 // First off, delete the debug intrinsics.
580 auto RemoveUses = [&](StringRef Name) {
581 if (auto *DbgVal = M.getFunction(Name)) {
582 while (!DbgVal->use_empty())
583 cast<Instruction>(DbgVal->user_back())->eraseFromParent();
584 DbgVal->eraseFromParent();
588 RemoveUses("llvm.dbg.declare");
589 RemoveUses("llvm.dbg.value");
591 // Delete non-CU debug info named metadata nodes.
592 for (auto NMI = M.named_metadata_begin(), NME = M.named_metadata_end();
594 NamedMDNode *NMD = &*NMI;
596 // Specifically keep dbg.cu around.
597 if (NMD->getName() == "llvm.dbg.cu")
601 // Drop all dbg attachments from global variables.
602 for (auto &GV : M.globals())
603 GV.eraseMetadata(LLVMContext::MD_dbg);
605 DebugTypeInfoRemoval Mapper(M.getContext());
606 auto remap = [&](MDNode *Node) -> MDNode * {
609 Mapper.traverseAndRemap(Node);
610 auto *NewNode = Mapper.mapNode(Node);
611 Changed |= Node != NewNode;
616 // Rewrite the DebugLocs to be equivalent to what
617 // -gline-tables-only would have created.
619 if (auto *SP = F.getSubprogram()) {
620 Mapper.traverseAndRemap(SP);
621 auto *NewSP = cast<DISubprogram>(Mapper.mapNode(SP));
622 Changed |= SP != NewSP;
623 F.setSubprogram(NewSP);
627 auto remapDebugLoc = [&](DebugLoc DL) -> DebugLoc {
628 auto *Scope = DL.getScope();
629 MDNode *InlinedAt = DL.getInlinedAt();
630 Scope = remap(Scope);
631 InlinedAt = remap(InlinedAt);
632 return DebugLoc::get(DL.getLine(), DL.getCol(), Scope, InlinedAt);
635 if (I.getDebugLoc() != DebugLoc())
636 I.setDebugLoc(remapDebugLoc(I.getDebugLoc()));
638 // Remap DILocations in untyped MDNodes (e.g., llvm.loop).
639 SmallVector<std::pair<unsigned, MDNode *>, 2> MDs;
640 I.getAllMetadata(MDs);
641 for (auto Attachment : MDs)
642 if (auto *T = dyn_cast_or_null<MDTuple>(Attachment.second))
643 for (unsigned N = 0; N < T->getNumOperands(); ++N)
644 if (auto *Loc = dyn_cast_or_null<DILocation>(T->getOperand(N)))
645 if (Loc != DebugLoc())
646 T->replaceOperandWith(N, remapDebugLoc(Loc));
651 // Create a new llvm.dbg.cu, which is equivalent to the one
652 // -gline-tables-only would have created.
653 for (auto &NMD : M.getNamedMDList()) {
654 SmallVector<MDNode *, 8> Ops;
655 for (MDNode *Op : NMD.operands())
656 Ops.push_back(remap(Op));
669 unsigned llvm::getDebugMetadataVersionFromModule(const Module &M) {
670 if (auto *Val = mdconst::dyn_extract_or_null<ConstantInt>(
671 M.getModuleFlag("Debug Info Version")))
672 return Val->getZExtValue();
676 void Instruction::applyMergedLocation(const DILocation *LocA,
677 const DILocation *LocB) {
678 setDebugLoc(DILocation::getMergedLocation(LocA, LocB, this));
681 //===----------------------------------------------------------------------===//
682 // LLVM C API implementations.
683 //===----------------------------------------------------------------------===//
685 static unsigned map_from_llvmDWARFsourcelanguage(LLVMDWARFSourceLanguage lang) {
687 #define HANDLE_DW_LANG(ID, NAME, VERSION, VENDOR) \
688 case LLVMDWARFSourceLanguage##NAME: return ID;
689 #include "llvm/BinaryFormat/Dwarf.def"
690 #undef HANDLE_DW_LANG
692 llvm_unreachable("Unhandled Tag");
695 unsigned LLVMDebugMetadataVersion() {
696 return DEBUG_METADATA_VERSION;
699 LLVMDIBuilderRef LLVMCreateDIBuilderDisallowUnresolved(LLVMModuleRef M) {
700 return wrap(new DIBuilder(*unwrap(M), false));
703 LLVMDIBuilderRef LLVMCreateDIBuilder(LLVMModuleRef M) {
704 return wrap(new DIBuilder(*unwrap(M)));
707 unsigned LLVMGetModuleDebugMetadataVersion(LLVMModuleRef M) {
708 return getDebugMetadataVersionFromModule(*unwrap(M));
711 LLVMBool LLVMStripModuleDebugInfo(LLVMModuleRef M) {
712 return StripDebugInfo(*unwrap(M));
715 void LLVMDisposeDIBuilder(LLVMDIBuilderRef Builder) {
716 delete unwrap(Builder);
719 void LLVMDIBuilderFinalize(LLVMDIBuilderRef Builder) {
720 unwrap(Builder)->finalize();
723 LLVMMetadataRef LLVMDIBuilderCreateCompileUnit(
724 LLVMDIBuilderRef Builder, LLVMDWARFSourceLanguage Lang,
725 LLVMMetadataRef FileRef, const char *Producer, size_t ProducerLen,
726 LLVMBool isOptimized, const char *Flags, size_t FlagsLen,
727 unsigned RuntimeVer, const char *SplitName, size_t SplitNameLen,
728 LLVMDWARFEmissionKind Kind, unsigned DWOId, LLVMBool SplitDebugInlining,
729 LLVMBool DebugInfoForProfiling) {
730 auto File = unwrap<DIFile>(FileRef);
732 return wrap(unwrap(Builder)->createCompileUnit(
733 map_from_llvmDWARFsourcelanguage(Lang), File,
734 StringRef(Producer, ProducerLen), isOptimized,
735 StringRef(Flags, FlagsLen), RuntimeVer,
736 StringRef(SplitName, SplitNameLen),
737 static_cast<DICompileUnit::DebugEmissionKind>(Kind), DWOId,
738 SplitDebugInlining, DebugInfoForProfiling));
742 LLVMDIBuilderCreateFile(LLVMDIBuilderRef Builder, const char *Filename,
743 size_t FilenameLen, const char *Directory,
744 size_t DirectoryLen) {
745 return wrap(unwrap(Builder)->createFile(StringRef(Filename, FilenameLen),
746 StringRef(Directory, DirectoryLen)));
750 LLVMDIBuilderCreateDebugLocation(LLVMContextRef Ctx, unsigned Line,
751 unsigned Column, LLVMMetadataRef Scope,
752 LLVMMetadataRef InlinedAt) {
753 return wrap(DILocation::get(*unwrap(Ctx), Line, Column, unwrap(Scope),