[cfe-dev] Debug Info Generation in Clang.
Chris Lattner
clattner at apple.com
Tue Apr 29 09:45:48 PDT 2008
On Apr 29, 2008, at 3:54 AM, Sanjiv.Gupta at microchip.com wrote:
> I was thinking that putting it in CodeGenFunction::EmitStmt may
> result in redundant stoppoint being emitted. But that is taken care
> of by EmitStopPoint function itself, which checks to see if we have
> changed from the previous line number. So EmitStmt looks the correct
> place.
Yep, that makes sense to me too.
> Other things I wanted to know:
>
> 1. Where does an instance of CodeGenDebugInfo should be kept? The
> choices are:
> (A) CodeGenerator inside the ModuleBuilder.cpp. But for that we
> will need to provide the CodeGenDebugInfo.h inside include/clang/
> CodeGen.
> (B) As a member of CodeGenModule, and construct it when the
> CodeGenModule is constructed.
>
>
> I am currently using (B).
(B) seems right.
> Of course we will need to use a command-line flag to construct the
> CodeGenDebugInfo.
-g! :)
> 2. llvm-gcc uses FullPath to create a CompileUnitCache. I want to
> use SourceLocation (an unsigned int) for that purpose. Is that
> unique for full paths?
I'm not sure what you mean, what do you need here exactly? a unique
ID for each source file / header in a translation unit?
> 3. SourceManager does not provide APIs like GetDirName (),
> GetFullPath (). GetDirName() should be easy to provide as we can get
> the DirectoryEntry from Loc and then its name. Should I add this one?
> GetFullPath () would be little tricky to implement due to path name
> variations on different platforms.
The filename for a file should be returned by
'SourceMgr.getSourceName(Loc);'. Does this work for you?
-Chris
More information about the cfe-dev
mailing list