This is an archive of the discontinued LLVM Phabricator instance.

IR: Introduce Module::global_objects().
ClosedPublic

Authored by pcc on Jun 21 2016, 5:46 PM.

Details

Summary

This is a convenience iterator that allows clients to enumerate the
GlobalObjects within a Module.

Also start using it in a few places where it is obviously the right thing
to use.

Diff Detail

Repository
rL LLVM

Event Timeline

pcc updated this revision to Diff 61473.Jun 21 2016, 5:46 PM
pcc retitled this revision from to IR: Introduce Module::global_objects()..
pcc updated this object.
pcc added a reviewer: eugenis.
pcc added a subscriber: llvm-commits.
rafael added inline comments.
include/llvm/IR/Module.h
610 ↗(On Diff #61473)

Why do you need the template?

MType is always Module, for example.

pcc added inline comments.Jun 22 2016, 9:37 AM
include/llvm/IR/Module.h
610 ↗(On Diff #61473)

It may be either Module or const Module. The other parameters are similar (see {,const_}global_object_iterator below).

pcc updated this revision to Diff 61584.Jun 22 2016, 12:07 PM
  • Use a single IsConst template parameter
rafael accepted this revision.Jun 22 2016, 12:15 PM
rafael added a reviewer: rafael.

LGTM other than the odd typedef name.

include/llvm/IR/Module.h
620 ↗(On Diff #61584)

qModule?

This revision is now accepted and ready to land.Jun 22 2016, 12:15 PM
pcc added inline comments.Jun 22 2016, 12:59 PM
include/llvm/IR/Module.h
620 ↗(On Diff #61584)

"qualified Module". Although I suppose "ModuleTy" would be a little more conventional. Will change.

This revision was automatically updated to reflect the committed changes.