[PATCH] D39982: [IRBuilder] Set the insert point and debug location together

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 6 14:49:17 PST 2017


vsk added inline comments.


================
Comment at: include/llvm-c/Core.h:2832
 LLVMBuilderRef LLVMCreateBuilder(void);
+/** Deprecated: Use LLVMPositionBuilderWithLoc instead. */
 void LLVMPositionBuilder(LLVMBuilderRef Builder, LLVMBasicBlockRef Block,
----------------
whitequark wrote:
> Why should we deprecate these at all? It's legal to pass Loc = NULL for no location, right? Then why shouldn't we make e.g. `LLVMPositionBuilderBefore(...)` an alias to `LLVMPositionBuilderBeforeWithLoc(..., NULL)` and keep existing code working? Very few frontends in the wild bother with any debug information at all, I don't think it makes sense to break all of them.
We should deprecate these APIs because they aren't great for building frontends which do emit debug info, and because these APIs will (soon, hopefully) have no C++ counterparts.

It's legal to pass Loc = NULL, but that rewrite is only behavior-preserving for frontends which emit no debug info. To make the transition easier for these frontends, I can provide an upgrade script which rewrites PositionBuilder* to PositionBuilder*WithLoc(..., NULL). Does that sound OK to you?


https://reviews.llvm.org/D39982





More information about the llvm-commits mailing list