Fix LLVM C API for DataLayout
authorMehdi Amini <mehdi.amini@apple.com>
Wed, 26 Aug 2015 18:22:34 +0000 (18:22 +0000)
committerMehdi Amini <mehdi.amini@apple.com>
Wed, 26 Aug 2015 18:22:34 +0000 (18:22 +0000)
commit1919cba95e290aaa5ca48a4b50db28255af768c4
treea084aa58cb1c9e722bb27145b403331c65d7e21f
parent044c4e6484bb39289e994583d0ec42c34e89ae60
Fix LLVM C API for DataLayout

We removed access to the DataLayout on the TargetMachine and
deprecated the C API function LLVMGetTargetMachineData() in r243114.
However the way I tried to be backward compatible was broken: I
changed the wrapper of the TargetMachine to be a structure that
includes the DataLayout as well. However the TargetMachine is also
wrapped by the ExecutionEngine, in the more classic way. A client
using the TargetMachine wrapped by the ExecutionEngine and trying
to get the DataLayout would break.

It seems tricky to solve the problem completely in the C API
implementation. This patch tries to address this backward
compatibility in a more lighter way in the C++ API. The C API is
restored in its original state and the removed C++ API is
reintroduced, but privately. The C API is friended to the
TargetMachine and should be the only consumer for this API.

Reviewers: ributzka

Differential Revision: http://reviews.llvm.org/D12263

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246044 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Target/TargetMachine.h
lib/Target/TargetMachineC.cpp