Here are some issues that I am unclear about. What would be great is if the answers could be incorporated into the comments and documentation for DIFactory and DebugInfo.h:<div><br></div><div>1) What types of DIScope are valid arguments for DebugLoc::get()? The method takes an MDNode* argument, so looking at the function signature is no help.</div>

<div><br></div><div>For example, DIFile is a subtype of DIScope, however looking at DwarfDebug::recordSourceLine, I see that DIFile scopes are not valid for source lines.</div><div><br></div><div>2) What is the proper DIScope for executable code that is not part of a source-level function? For example, suppose I have code that is used to generate the initialization expression for a static variable. A similar example would be a default constructor, or any of the various implicit casting functions used when dealing with dynamic types. Now, although that code is in an LLVM function, that function was synthesized by the compiler and was never defined in any source file, so even if I were to create a DISubprogram scope for it, there's no valid source location information for it.</div>

<meta charset="utf-8"><div><br></div><div>If DIFile were allowed as a scope, then the issue would be straightforward, I would just declare the scope to be the source file.</div><div><br></div><div>3) Similarly, suppose I have synthesized code that is taken from a different module. An example is a static variable contained within a template defined in a different source file. Again, if DIFile were allowed as a scope, then I'd simply use the file which originally defined the template. I don't think I can use DICompileUnit, since (I'm guessing) only one of those are allowed per module.</div>

<div><br></div><div>(Side note: I've never understood the relationship between DICompileUnit and DIFile. I'm guessing, however, that DICompileUnit acts like a container for all of the DIDescriptors within a module - that is, even if the DIDescriptor is referring to an external symbol, the compile unit for that descriptor is the module *containing* the reference, not the module of the *target* of the reference. DIFile, on the other hand, is I think the target. If this is not the case, then why have both?) </div>

<div><br></div><div>If my assumptions are correct, then, you can't have more than one DICompileUnit per module, and the only way for code that was inlined from another module to indicate where it came from is to have a scope which is a DISubprogram, where that subprogram's DIFile is the file from where the code was defined. However, if the code didn't come from a function but was synthesized by the compiler, then I'm not sure how to generate a valid DISubprogram.</div>

<div><br></div><div>4) What is the meaning of the "inlinedAt" argument for DebugLoc::get()? Does it mean the location where the inlined code was defined, or the location where it was expanded?</div><div><br></div>

<div>-- <br>-- Talin<br>
</div>