[cfe-dev] Debug Info Generation in Clang.

Sanjiv.Gupta at microchip.com Sanjiv.Gupta at microchip.com
Tue Apr 29 03:54:35 PDT 2008


> I may be wrong, but shouldn't you better put it in 
> CodeGenFunction::EmitStmt. ScalarExpr is only one Expr on 
> scalar type which is one kind of Stmt. You would miss a lot 
> of interesting stoppoint.
> Also, for expression, you probably don't wan't to put a 
> stoppoint for each operation. I don't know what would be the 
> best granularity for this...
> 
> Regards,
> 
> --
> Cédric

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.

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

Of course we will need to use a command-line flag to construct the CodeGenDebugInfo. 

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?

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.

-Sanjiv




More information about the cfe-dev mailing list