Fix LLVM C API for DataLayout
[oota-llvm.git] / include / llvm / Target / TargetMachine.h
index d707e7c029303166369a48dc84b7a8db16ddedba..0060fb72caf322f8b1249b56bc4317d9736bbd9f 100644 (file)
@@ -59,6 +59,13 @@ class PassManagerBase;
 }
 using legacy::PassManagerBase;
 
+extern "C" {
+// This function from the C API is deprecated. We still supports it using a
+// private method on the TargetMachine for now. But it needs to be friended and
+// so we forward declare it here.
+LLVMTargetDataRef LLVMGetTargetMachineData(LLVMTargetMachineRef T);
+}
+
 //===----------------------------------------------------------------------===//
 ///
 /// Primary interface to the complete machine description for the target
@@ -103,6 +110,12 @@ protected: // Can only create subclasses.
 
   unsigned RequireStructuredCFG : 1;
 
+  /// This API is here to support the C API, deprecated in 3.7 release.
+  /// This should never be used outside of legacy existing client.
+  const DataLayout &getDataLayout() const { return DL; }
+  friend struct LLVMOpaqueTargetData * ::LLVMGetTargetMachineData(
+      LLVMTargetMachineRef T);
+
 public:
   mutable TargetOptions Options;