[PATCH][llvm-c] Rename 'struct LLVMTargetMachine' to 'struct LLVMOpaqueTargetMachine'

Filip Pizlo fpizlo at apple.com
Wed May 1 14:16:05 PDT 2013


Currently, the LLVM C++ code has a class called llvm::LLVMTargetMachine, while the C API has a struct called LLVMTargetMachine.

If you're unlucky enough to include both headers, you will get crazy build errors.  Luckily trunk doesn't do this, but I just accidentally caused it to happen because of an unrelated and seemingly benign change.

We should be able to include both C++ and C headers *somewhere* in the llvm .cpp files, if not broadly in any of them, since otherwise you'd have a really bad time if you wanted to write bindings.

The offending line in the C API looks like this:

typedef struct LLVMTargetMachine *LLVMTargetMachineRef;

I'm assuming that from a source compatibility standpoint, we only care about LLVMTargetMachineRef still working; the fact that the struct was called 'struct LLVMTargetMachine' should not be something that C API clients rely on.  So, the easiest fix to get around this appears to be do just change this to 'struct LLVMOpaqueTargetMachine'.

-Filip

-------------- next part --------------
A non-text attachment was scrubbed...
Name: opaquetm.patch
Type: application/octet-stream
Size: 450 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130501/2bd36218/attachment.obj>


More information about the llvm-commits mailing list