[LLVMdev] More DIFactory questions

Devang Patel dpatel at apple.com
Tue Aug 31 10:31:04 PDT 2010

On Aug 31, 2010, at 9:03 AM, Talin wrote:

> 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.

You can just create DISubprogram and set isArtificial flag to indicate that this is a compiler generated function. You can pick your main source file as the file and 0 for the line number here.

More information about the llvm-dev mailing list