[PATCH] Some code improvements (no functional change)

Artyom Skrobov Artyom.Skrobov at arm.com
Wed Apr 23 03:48:33 PDT 2014

Hello Duncan -- did you have an opportunity to look at my revised patch?

-----Original Message-----
From: Artyom Skrobov [mailto:Artyom.Skrobov at arm.com] 
Sent: 17 April 2014 12:36
To: 'Duncan P. N. Exon Smith'
Cc: llvm-commits
Subject: RE: [PATCH] Some code improvements (no functional change)

> 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/ExecutionEngine/ExecutionEngineBindings.cpp as in the original patch.

More information about the llvm-commits mailing list