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

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 13 14:47:26 PST 2017


vsk created this revision.
Herald added a reviewer: deadalnix.

The APIs for setting the insertion point of an IRBuilder behave
inconsistently w.r.t updating the current debug location. The overloads
of SetInsertPoint() may or may not change the current debug location,
and may or may not select a correct location, depending on the selected
overload and the current state of the IRBuilder.

This is inconvenient and causes correctness problems. For more
background on this issue, see the thread:

  [llvm-dev] [RFC] Setting the current debug loc when the insertion
  point changes

This patch deprecates the following APIs:

  SetInsertPoint(BasicBlock *)
  SetInsertPoint(Instruction *)
  SetInsertPoint(BasicBlock *, BasicBlock::iterator)

They are superseded by the following APIs:

  setInsertPoint(BasicBlock *, const DebugLoc &)
  setInsertPoint(Instruction *, const DebugLoc &)
  setInsertPoint(BasicBlock *, BasicBlock::iterator, const DebugLoc &)
  getUnknownDebugLocation(BasicBlock *, BasicBlock::iterator)
  getUnknownDebugLocation(Instruction *)

The new APIs offer consistent handling of debug locations by requiring
clients to be more explicit. Uses of the old APIs should be audited and
phased out. New C APIs are available.


https://reviews.llvm.org/D39982

Files:
  include/llvm-c/Core.h
  include/llvm/IR/IRBuilder.h
  lib/IR/Core.cpp
  lib/IR/IRBuilder.cpp
  tools/llvm-c-test/calc.c
  tools/llvm-c-test/echo.cpp
  unittests/IR/IRBuilderTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39982.122732.patch
Type: text/x-patch
Size: 11822 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171113/cf896ee7/attachment-0001.bin>


More information about the llvm-commits mailing list