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

Chris Lattner clattner at apple.com
Wed May 1 15:38:11 PDT 2013


On May 1, 2013, at 2:16 PM, Filip Pizlo <fpizlo at apple.com> wrote:

> 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'.

Ok.

-Chris



More information about the llvm-commits mailing list