This is an archive of the discontinued LLVM Phabricator instance.

Change hasInitializer() to call isStrongDefinitionForLinker() instead of !isWeakForLinker()
ClosedPublic

Authored by mehdi_amini on Dec 8 2015, 2:10 PM.

Details

Summary

Available_externally global variable with initializer were considered "hasInitializer()",
while obviously it can't match the description:

Whether the global variable has an initializer, and any changes made to the
initializer will turn up in the final executable.

since modifying the initializer of an externally available variable does not make sense.

Diff Detail

Event Timeline

mehdi_amini updated this revision to Diff 42223.Dec 8 2015, 2:10 PM
mehdi_amini retitled this revision from to Change hasInitializer() to call isStrongDefinitionForLinker() instead of !isWeakForLinker().
mehdi_amini updated this object.
mehdi_amini added reviewers: pcc, rafael.
mehdi_amini added a subscriber: llvm-commits.
pcc added inline comments.Dec 8 2015, 4:52 PM
include/llvm/IR/GlobalVariable.h
107–108

The call to hasInitializer() is redundant now.

mehdi_amini updated this revision to Diff 42262.Dec 8 2015, 6:29 PM

Remove redundant call to hasInitializer()

rafael accepted this revision.Dec 9 2015, 5:23 AM
rafael edited edge metadata.

LGTM

This revision is now accepted and ready to land.Dec 9 2015, 5:23 AM