Fix LLVM C API for DataLayout
authorMehdi Amini <mehdi.amini@apple.com>
Tue, 25 Aug 2015 01:07:25 +0000 (01:07 +0000)
committerMehdi Amini <mehdi.amini@apple.com>
Tue, 25 Aug 2015 01:07:25 +0000 (01:07 +0000)
commit8b07e8e08fc5f5741e7a7ad57f48916e66d4ac22
treed0ff49b793eddae9b4abea9e207f0e2cbf0a8088
parent654072f80a6fe83f91464d3686a0f6573c92234b
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@245916 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Target/TargetMachine.h
lib/Target/TargetMachineC.cpp