Fix LLVM C API for DataLayout
authorMehdi Amini <mehdi.amini@apple.com>
Wed, 26 Aug 2015 21:16:29 +0000 (21:16 +0000)
committerMehdi Amini <mehdi.amini@apple.com>
Wed, 26 Aug 2015 21:16:29 +0000 (21:16 +0000)
commit026583408f2699afe170eb2b28c0014951222d3a
tree5de3a0a48254058e2bcb4c53f0abb8c2bc48d839
parent548643ecdacb143f5e5f534b741ff4d6f5311c19
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@246082 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Target/TargetMachine.h
lib/Target/TargetMachineC.cpp