[PATCH] D53329: Generate DIFile with main program if source is not available

Scott Linder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 16 10:35:00 PST 2018


scott.linder added a comment.

In https://reviews.llvm.org/D53329#1300435, @dblaikie wrote:

> Thanks!
>
> So I can see where/how this fails now - the LLVM backend seems to require that if any file has embedded source, they all do. Would you be able to/would you mind adding a debug info verifier check for this? That'd help make this fail sooner. (@scott.linder - perhaps you'd be able to/interested in doing this - looks like you wrote the initial implementation?)
>
> Beyond that, then the question is whether this fix is the right way to satisfy that requirement (I'm assuming the requirement is reasonable - though I've not looked at the embedded source support & have no idea if there's a way/it's reasonable to support some embedded source and some not). My big question & I've tried to do some debugging to better understand this - but don't have the time to dive much further into it (& haven't really figured it out as yet): Why is this source not accessible through this API at this point? is the fallback to the main file always accurate?
>
> (as far as I got was figuring out that SourceManager::getBufferData had an SLoc with isFile == true for the header, but isFile was false for the SLocs related to the .cpp file. Can't say I know why that is/what that means & would like to understand that (or someone else more familiar with this stuff who already knows can review this code) before approving this patch - if you could help explain this, that'd be great)


I can certainly update the verifier; my initial implementation should have included tests for this case so I would have noticed how unpleasantly it fails. I might be a bit slow to get a patch up, as I'm on vacation all next week.

The decision to require "all or nothing" for embedded source came after quite a bit of discussion, and the original proposal does include a boolean flag (see http://dwarfstd.org/ShowIssue.php?issue=180201.1). LLVM is still the only implementation I know of, and it is not in any actual DWARF standard yet, so if there are strong use-cases for allowing some sources be absent this could still be changed.


Repository:
  rC Clang

https://reviews.llvm.org/D53329





More information about the cfe-commits mailing list