Make it illegal for two Functions to point to the same DISubprogram
authorAdrian Prantl <aprantl@apple.com>
Tue, 9 May 2017 19:47:37 +0000 (19:47 +0000)
committerAdrian Prantl <aprantl@apple.com>
Tue, 9 May 2017 19:47:37 +0000 (19:47 +0000)
commitc10d0e5ccd12f049bddb24dcf8bbb7fbbc6c68f2
tree040042696a2447b6326e2086d645a95c5eca8954
parentd979c1f80607eabadf8395ac690daf1b93f24789
Make it illegal for two Functions to point to the same DISubprogram

As recently discussed on llvm-dev [1], this patch makes it illegal for
two Functions to point to the same DISubprogram and updates
FunctionCloner to also clone the debug info of a function to conform
to the new requirement. To simplify the implementation it also factors
out the creation of inlineAt locations from the Inliner into a
general-purpose utility in DILocation.

[1] http://lists.llvm.org/pipermail/llvm-dev/2017-May/112661.html
<rdar://problem/31926379>

Differential Revision: https://reviews.llvm.org/D32975

This reapplies r302469 with a fix for a bot failure (reparentDebugInfo
now checks for the case the orig and new function are identical).

llvm-svn: 302576
llvm/include/llvm/IR/DebugLoc.h
llvm/lib/IR/DebugLoc.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/Transforms/Utils/CloneFunction.cpp
llvm/lib/Transforms/Utils/InlineFunction.cpp
llvm/test/Verifier/metadata-function-dbg.ll
llvm/unittests/Transforms/Utils/Cloning.cpp