[PATCH] D21580: IR: Introduce Module::global_objects().

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 22 11:36:53 PDT 2016


On 22 June 2016 at 12:37, Peter Collingbourne <peter at pcc.me.uk> wrote:
> pcc added inline comments.
>
> ================
> Comment at: include/llvm/IR/Module.h:610
> @@ -609,1 +609,3 @@
>
> +  template<class IType, class GIType, class GOType, class MType>
> +  class global_object_iterator_t {
> ----------------
> rafael wrote:
>> Why do you need the template?
>>
>> MType is always Module, for example.
> It may be either `Module` or `const Module`. The other parameters are similar (see `{,const_}global_object_iterator` below).

Is that the preferred way to do it? I see that DenseMap has a "bool
IsConst" template parameter. It is a bit more verbose but less
confusing IMHO.

Cheers,
Rafael


More information about the llvm-commits mailing list