[PATCH] Some code improvements (no functional change)

Artyom Skrobov Artyom.Skrobov at arm.com
Thu Apr 17 04:35:53 PDT 2014


> I think this one is definitely out, though.  The C API is stable, so
> we'd have to support this forever.  And you're putting C++ code into it,
> which is probably just wrong.
>
> If you can find an appropriate place in include/llvm/, maybe?

Duncan, perhaps include/llvm/IR/DataLayout.h is a good place for this?

--- a/include/llvm/IR/DataLayout.h
+++ b/include/llvm/IR/DataLayout.h
@@ -445,6 +445,16 @@ public:
   }
 };
 
+typedef struct LLVMOpaqueTargetData *LLVMTargetDataRef;
+
+inline DataLayout *unwrap(LLVMTargetDataRef P) {
+   return reinterpret_cast<DataLayout*>(P);
+}
+
+inline LLVMTargetDataRef wrap(const DataLayout *P) {
+   return reinterpret_cast<LLVMTargetDataRef>(const_cast<DataLayout*>(P));
+}
+
 class DataLayoutPass : public ImmutablePass {
   DataLayout DL;

--
That's together with the same changes in lib/Target/Target.cpp,
lib/Target/TargetMachineC.cpp,
lib/ExecutionEngine/ExecutionEngineBindings.cpp as in the original patch.








More information about the llvm-commits mailing list