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

Philip Pfaffe via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 29 14:47:26 PST 2018


philip.pfaffe added a comment.

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`.


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

https://reviews.llvm.org/D56130





More information about the llvm-commits mailing list