This is an archive of the discontinued LLVM Phabricator instance.

Fix the bitcode upgrade for DIGlobalVariable in a DIImportedEntity context.
ClosedPublic

Authored by aprantl on Jan 31 2017, 2:07 PM.

Details

Summary

The bitcode upgrade for DIGlobalVariable unconditionally wrapped DIGlobalVariables in a DIGlobalVariableExpression. When a DIGlobalVariable is referenced by a DIImportedEntity, however, this is wrong. This patch fixes the bitcode upgrade by deferring the creation of DIGlobalVariableExpressions until we know the context of the DIGlobalVariable.

rdar://problem/30134279

Diff Detail

Repository
rL LLVM

Event Timeline

aprantl created this revision.Jan 31 2017, 2:07 PM
mehdi_amini added inline comments.Jan 31 2017, 4:12 PM
lib/Bitcode/Reader/MetadataLoader.cpp
793 ↗(On Diff #86494)

Should we have a single entry point "performDebugInfoUpgrade" instead of duplicating the calls at every exit point?

1463 ↗(On Diff #86494)

Does this need to be set to true when DGVE is correctly set below?

1470 ↗(On Diff #86494)

Are we using C-style cast elsewhere in similar situation?

Also the logic seems quite complex to me (it was already, but getting worse) around the invariant that link Attach and Expr and what we end up assigning to NextMetadataNo, or attaching.

aprantl updated this revision to Diff 87276.Feb 6 2017, 11:49 AM
aprantl marked 2 inline comments as done.

Address review comments

aprantl updated this revision to Diff 87278.Feb 6 2017, 11:51 AM

Fix whitespace.

mehdi_amini accepted this revision.Feb 6 2017, 9:50 PM

LGTM. Thanks!

This revision is now accepted and ready to land.Feb 6 2017, 9:50 PM
This revision was automatically updated to reflect the committed changes.