This is an archive of the discontinued LLVM Phabricator instance.

Remove getDataLayout() from Instruction/GlobalValue/BasicBlock/Function
ClosedPublic

Authored by mehdi_amini on Mar 2 2015, 10:08 PM.

Details

Summary

This does not conceptually belongs here. Instead provide a shortcut
getModule() that provides access to the DataLayout.

Diff Detail

Event Timeline

mehdi_amini retitled this revision from to Remove getDataLayout() from Instruction/GlobalValue/BasicBlock/Function.
mehdi_amini updated this object.
mehdi_amini edited the test plan for this revision. (Show Details)
mehdi_amini added reviewers: echristo, chandlerc.
mehdi_amini added a subscriber: Unknown Object (MLST).
echristo accepted this revision.Mar 3 2015, 12:44 PM
echristo edited edge metadata.

LGTM with perhaps a comment of "this can crash if parent is null, don't call this without a parent" or something. Up to you on the comment :)

-eric

This revision is now accepted and ready to land.Mar 3 2015, 12:44 PM

Thanks.

Note there is already a comment in the Doxygen.
This one for the BasicBlock:

/// Note: this is undefined behavior if the block does not have a parent.

And this one for the instruction:

/// Note: this is undefined behavior if the instruction does not have a
/// parent, or the parent basic block does not have a parent function.


Mehdi

Cool. Thanks!

-eric

mehdi_amini closed this revision.Mar 3 2015, 2:03 PM