[PATCH] D56130: Extend Module::getOrInsertGlobal to also take the default arguments accepted by the GlobalVariable constructor.

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 29 15:18:16 PST 2018


chandlerc added a comment.

In D56130#1342432 <https://reviews.llvm.org/D56130#1342432>, @philip.pfaffe wrote:

> I get the idea of trying to separate query and creation arguments to make their meaning explicit. But how do you expect this to be used? The //default// call (i.e., the one everyone is using right now), would then look like
>
>   M.getOrInsertGlobal("Global", Ctx.getIntTy(), [] { return new GlobalVariable("Global", Ctx.getIntTy()); });
>
>
> That's //super// verbose, and to me at least it's much harder to read then just calling Module::getGlobalVariable in an `if`.


So add an overload that supplies that call back?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56130/new/

https://reviews.llvm.org/D56130





More information about the llvm-commits mailing list