This is an archive of the discontinued LLVM Phabricator instance.

Fixed Dwarf debug info emission to skip DILexicalBlockFile entries
ClosedPublic

Authored by aaboud on Apr 2 2016, 9:42 AM.

Details

Summary

Without this change the imported entity defined under DILexicalBlockFile (in the test example) will be created under DW_TAG_lexical_block corresponded with DILexicalBlockFile.
This will not happen for a local variable.

Notice that I am fine with creating lexical block entry for each DILexicalBlockFile, but either we do so for all local decls or for none.

Diff Detail

Event Timeline

aaboud updated this revision to Diff 52464.Apr 2 2016, 9:42 AM
aaboud retitled this revision from to Fixed Dwarf debug info emission to skip DILexicalBlockFile entries.
aaboud updated this object.
aaboud added reviewers: dblaikie, aprantl, echristo.
aaboud added a subscriber: llvm-commits.
aprantl edited edge metadata.Apr 4 2016, 10:51 AM

Since this is such a common pattern; what about adding a getNonLexicalBlockFileParent() (better names appreciated) to DIScope?

This would also be a good place for documenting why a consumer would want to skip over DILexicalBlockFiles.

aaboud updated this revision to Diff 53165.Apr 10 2016, 1:01 AM
aaboud edited edge metadata.

Followed Adrian comment.
Introduced DILocalScope::getNonLexicalBlockFileScope() function and used it everywhere we look for the real basic block and want to skip the DILexicalBlockFile entries.

As for names, yeah... be nice if we had a better name for LexicalBlockFile - it's not really a LexicalBlock at all, as such. Though I suppose we still use them as strict nesting, etc. Meh.

David, do you suggest a different name for the function I am adding, or you want to change the name of the DILexicalBlockFile?
How about these suggested names:
getNonFileScope()
getRealScope()
getSourceLocalScope()

Or you prefer other name?

dblaikie edited edge metadata.Apr 13 2016, 3:07 PM
dblaikie added a subscriber: dblaikie.

Nah, just go with it - if someone figures out a better name some time we
can change it then.

This revision was automatically updated to reflect the committed changes.