[cfe-dev] Debug Info Generation in Clang.
Chris Lattner
clattner at apple.com
Wed Apr 30 08:57:18 PDT 2008
On Apr 30, 2008, at 4:18 AM, Sanjiv.Gupta at microchip.com wrote:
>>> 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
>>
>
> %llvm.dbg.compile_unit.type = type {
> uint, ;; Tag = 17 + LLVMDebugVersion (DW_TAG_compile_unit)
> { }*, ;; Compile unit anchor = cast = (%llvm.dbg.anchor.type*
> %llvm.dbg.compile_units to { }*)
> uint, ;; Dwarf language identifier (ex. DW_LANG_C89)
> sbyte*, ;; Source file name
> sbyte*, ;; Source file directory (includes trailing slash)
> sbyte* ;; Producer (ex. "4.0.1 LLVM (LLVM research group)")
> }
>
> I do not know how to retrieve last two pieces of information here.
> DirectoryEntry.getName() gives relative path but not absolute.
Ok, use SourceMgr.getFileEntryForLoc(Loc), which returns a FileEntry.
A FileEntry has a 'getName()' accessor for the file name, and
'getDir()' which returns a directory entry. DirectoryEntry has
'getName()' to get the name of the dir.
> What is the API to retrive version string?
I would just set it to 'clang' or something.
-Chris
More information about the cfe-dev
mailing list