X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTarget%2FTargetMachineC.cpp;h=f82566c37baa43c4d237fdffd8f720514ac526d1;hb=30e7d038e978a442d0f791fc151c0088559f5ec8;hp=6255448a7e3c5ba21076d359fbde0bff8e10aa42;hpb=8b07e8e08fc5f5741e7a7ad57f48916e66d4ac22;p=oota-llvm.git diff --git a/lib/Target/TargetMachineC.cpp b/lib/Target/TargetMachineC.cpp index 6255448a7e3..f82566c37ba 100644 --- a/lib/Target/TargetMachineC.cpp +++ b/lib/Target/TargetMachineC.cpp @@ -32,6 +32,15 @@ using namespace llvm; +namespace llvm { +// Friend to the TargetMachine, access legacy API that are made private in C++ +struct C_API_PRIVATE_ACCESS { + static const DataLayout &getDataLayout(const TargetMachine &T) { + return T.getDataLayout(); + } +}; +} + static TargetMachine *unwrap(LLVMTargetMachineRef P) { return reinterpret_cast(P); } @@ -168,7 +177,7 @@ char* LLVMGetTargetMachineFeatureString(LLVMTargetMachineRef T) { /** Deprecated: use LLVMGetDataLayout(LLVMModuleRef M) instead. */ LLVMTargetDataRef LLVMGetTargetMachineData(LLVMTargetMachineRef T) { - return wrap(&unwrap(T)->getDataLayout()); + return wrap(&C_API_PRIVATE_ACCESS::getDataLayout(*unwrap(T))); } void LLVMSetTargetMachineAsmVerbosity(LLVMTargetMachineRef T,