[llvm] r180881 - This patch breaks up Wrap.h so that it does not have to include all of
Filip Pizlo
fpizlo at apple.com
Wed May 1 15:37:52 PDT 2013
Thanks!
But it's currently blocked on this:
> 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
>
On May 1, 2013, at 3:31 PM, "Kaylor, Andrew" <andrew.kaylor at intel.com> wrote:
> I see you have commit access now. :-)
>
> Feel free to commit your other patch whenever you have it ready. I'll give it a final review after commit, but I don't expect you'll have to change anything significant.
>
> -Andy
>
> -----Original Message-----
> From: llvm-commits-bounces at cs.uiuc.edu [mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Filip Pizlo
> Sent: Wednesday, May 01, 2013 1:59 PM
> To: llvm-commits at cs.uiuc.edu
> Subject: [llvm] r180881 - This patch breaks up Wrap.h so that it does not have to include all of
>
> Author: fpizlo
> Date: Wed May 1 15:59:00 2013
> New Revision: 180881
>
> URL: http://llvm.org/viewvc/llvm-project?rev=180881&view=rev
> Log:
> This patch breaks up Wrap.h so that it does not have to include all of the things, and renames it to CBindingWrapping.h. I also moved CBindingWrapping.h into Support/.
>
> This new file just contains the macros for defining different wrap/unwrap methods.
>
> The calls to those macros, as well as any custom wrap/unwrap definitions (like for array of Values for example), are put into corresponding C++ headers.
>
> Doing this required some #include surgery, since some .cpp files relied on the fact that including Wrap.h implicitly caused the inclusion of a bunch of other things.
>
> This also now means that the C++ headers will include their corresponding C API headers; for example Value.h must include llvm-c/Core.h. I think this is harmless, since the C API headers contain just external function declarations and some C types, so I don't believe there should be any nasty dependency issues here.
>
>
> Added:
> llvm/trunk/include/llvm/Support/CBindingWrapping.h
> Removed:
> llvm/trunk/include/llvm/Wrap.h
> Modified:
> llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h
> llvm/trunk/include/llvm/IR/BasicBlock.h
> llvm/trunk/include/llvm/IR/IRBuilder.h
> llvm/trunk/include/llvm/IR/LLVMContext.h
> llvm/trunk/include/llvm/IR/Module.h
> llvm/trunk/include/llvm/IR/Type.h
> llvm/trunk/include/llvm/IR/Use.h
> llvm/trunk/include/llvm/IR/Value.h
> llvm/trunk/include/llvm/PassManager.h
> llvm/trunk/include/llvm/PassRegistry.h
> llvm/trunk/include/llvm/Support/MemoryBuffer.h
> llvm/trunk/lib/Analysis/Analysis.cpp
> llvm/trunk/lib/Analysis/IPA/IPA.cpp
> llvm/trunk/lib/Bitcode/Reader/BitReader.cpp
> llvm/trunk/lib/Bitcode/Writer/BitWriter.cpp
> llvm/trunk/lib/CodeGen/CodeGen.cpp
> llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp
> llvm/trunk/lib/IR/Core.cpp
> llvm/trunk/lib/Linker/LinkModules.cpp
> llvm/trunk/lib/Object/Object.cpp
> llvm/trunk/lib/Target/Target.cpp
> llvm/trunk/lib/Target/TargetMachineC.cpp
> llvm/trunk/lib/Transforms/IPO/IPO.cpp
> llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp
> llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
> llvm/trunk/lib/Transforms/Instrumentation/Instrumentation.cpp
> llvm/trunk/lib/Transforms/ObjCARC/ObjCARC.cpp
> llvm/trunk/lib/Transforms/Scalar/Scalar.cpp
> llvm/trunk/lib/Transforms/Utils/Utils.cpp
> llvm/trunk/lib/Transforms/Vectorize/Vectorize.cpp
>
> Modified: llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h (original)
> +++ llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h Wed May 1
> +++ 15:59:00 2013
> @@ -26,7 +26,6 @@
> #include "llvm/Support/ValueHandle.h"
> #include "llvm/Target/TargetMachine.h"
> #include "llvm/Target/TargetOptions.h"
> -#include "llvm/Wrap.h"
> #include <map>
> #include <string>
> #include <vector>
> @@ -634,7 +633,8 @@ public:
> ExecutionEngine *create(TargetMachine *TM); };
>
> -DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ExecutionEngine, LLVMExecutionEngineRef)
> +// Create wrappers for C Binding types (see CBindingWrapping.h).
> +DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ExecutionEngine,
> +LLVMExecutionEngineRef)
>
> } // End llvm namespace
>
>
> Modified: llvm/trunk/include/llvm/IR/BasicBlock.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/BasicBlock.h?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/IR/BasicBlock.h (original)
> +++ llvm/trunk/include/llvm/IR/BasicBlock.h Wed May 1 15:59:00 2013
> @@ -18,6 +18,7 @@
> #include "llvm/ADT/ilist.h"
> #include "llvm/IR/Instruction.h"
> #include "llvm/IR/SymbolTableListTraits.h"
> +#include "llvm/Support/CBindingWrapping.h"
> #include "llvm/Support/DataTypes.h"
>
> namespace llvm {
> @@ -298,6 +299,9 @@ private:
> }
> };
>
> +// Create wrappers for C Binding types (see CBindingWrapping.h).
> +DEFINE_SIMPLE_CONVERSION_FUNCTIONS(BasicBlock, LLVMBasicBlockRef)
> +
> } // End llvm namespace
>
> #endif
>
> Modified: llvm/trunk/include/llvm/IR/IRBuilder.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/IRBuilder.h?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/IR/IRBuilder.h (original)
> +++ llvm/trunk/include/llvm/IR/IRBuilder.h Wed May 1 15:59:00 2013
> @@ -23,6 +23,7 @@
> #include "llvm/IR/Instructions.h"
> #include "llvm/IR/LLVMContext.h"
> #include "llvm/IR/Operator.h"
> +#include "llvm/Support/CBindingWrapping.h"
> #include "llvm/Support/ConstantFolder.h"
>
> namespace llvm {
> @@ -1396,6 +1397,9 @@ public:
> }
> };
>
> +// Create wrappers for C Binding types (see CBindingWrapping.h).
> +DEFINE_SIMPLE_CONVERSION_FUNCTIONS(IRBuilder<>, LLVMBuilderRef)
> +
> }
>
> #endif
>
> Modified: llvm/trunk/include/llvm/IR/LLVMContext.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/LLVMContext.h?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/IR/LLVMContext.h (original)
> +++ llvm/trunk/include/llvm/IR/LLVMContext.h Wed May 1 15:59:00 2013
> @@ -15,7 +15,9 @@
> #ifndef LLVM_IR_LLVMCONTEXT_H
> #define LLVM_IR_LLVMCONTEXT_H
>
> +#include "llvm/Support/CBindingWrapping.h"
> #include "llvm/Support/Compiler.h"
> +#include "llvm-c/Core.h"
>
> namespace llvm {
>
> @@ -109,6 +111,19 @@ private:
> /// only care about operating on a single thread.
> extern LLVMContext &getGlobalContext();
>
> +// Create wrappers for C Binding types (see CBindingWrapping.h).
> +DEFINE_SIMPLE_CONVERSION_FUNCTIONS(LLVMContext, LLVMContextRef)
> +
> +/* Specialized opaque context conversions.
> + */
> +inline LLVMContext **unwrap(LLVMContextRef* Tys) {
> + return reinterpret_cast<LLVMContext**>(Tys);
> +}
> +
> +inline LLVMContextRef *wrap(const LLVMContext **Tys) {
> + return
> +reinterpret_cast<LLVMContextRef*>(const_cast<LLVMContext**>(Tys));
> +}
> +
> }
>
> #endif
>
> Modified: llvm/trunk/include/llvm/IR/Module.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Module.h?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/IR/Module.h (original)
> +++ llvm/trunk/include/llvm/IR/Module.h Wed May 1 15:59:00 2013
> @@ -20,6 +20,7 @@
> #include "llvm/IR/GlobalAlias.h"
> #include "llvm/IR/GlobalVariable.h"
> #include "llvm/IR/Metadata.h"
> +#include "llvm/Support/CBindingWrapping.h"
> #include "llvm/Support/DataTypes.h"
>
> namespace llvm {
> @@ -584,6 +585,16 @@ inline raw_ostream &operator<<(raw_ostre
> return O;
> }
>
> +// Create wrappers for C Binding types (see CBindingWrapping.h).
> +DEFINE_SIMPLE_CONVERSION_FUNCTIONS(Module, LLVMModuleRef)
> +
> +/* LLVMModuleProviderRef exists for historical reasons, but now just
> +holds a
> + * Module.
> + */
> +inline Module *unwrap(LLVMModuleProviderRef MP) {
> + return reinterpret_cast<Module*>(MP); }
> +
> } // End llvm namespace
>
> #endif
>
> Modified: llvm/trunk/include/llvm/IR/Type.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Type.h?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/IR/Type.h (original)
> +++ llvm/trunk/include/llvm/IR/Type.h Wed May 1 15:59:00 2013
> @@ -17,8 +17,10 @@
>
> #include "llvm/ADT/APFloat.h"
> #include "llvm/Support/Casting.h"
> +#include "llvm/Support/CBindingWrapping.h"
> #include "llvm/Support/DataTypes.h"
> #include "llvm/Support/ErrorHandling.h"
> +#include "llvm-c/Core.h"
>
> namespace llvm {
>
> @@ -467,6 +469,19 @@ template <> struct GraphTraits<const Typ
> }
> };
>
> +// Create wrappers for C Binding types (see CBindingWrapping.h).
> +DEFINE_ISA_CONVERSION_FUNCTIONS(Type, LLVMTypeRef)
> +
> +/* Specialized opaque type conversions.
> + */
> +inline Type **unwrap(LLVMTypeRef* Tys) {
> + return reinterpret_cast<Type**>(Tys); }
> +
> +inline LLVMTypeRef *wrap(Type **Tys) {
> + return reinterpret_cast<LLVMTypeRef*>(const_cast<Type**>(Tys));
> +}
> +
> } // End llvm namespace
>
> #endif
>
> Modified: llvm/trunk/include/llvm/IR/Use.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Use.h?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/IR/Use.h (original)
> +++ llvm/trunk/include/llvm/IR/Use.h Wed May 1 15:59:00 2013
> @@ -26,7 +26,9 @@
> #define LLVM_IR_USE_H
>
> #include "llvm/ADT/PointerIntPair.h"
> +#include "llvm/Support/CBindingWrapping.h"
> #include "llvm/Support/Compiler.h"
> +#include "llvm-c/Core.h"
> #include <cstddef>
> #include <iterator>
>
> @@ -214,6 +216,9 @@ public:
> unsigned getOperandNo() const;
> };
>
> +// Create wrappers for C Binding types (see CBindingWrapping.h).
> +DEFINE_SIMPLE_CONVERSION_FUNCTIONS(Use, LLVMUseRef)
> +
> } // End llvm namespace
>
> #endif
>
> Modified: llvm/trunk/include/llvm/IR/Value.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Value.h?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/IR/Value.h (original)
> +++ llvm/trunk/include/llvm/IR/Value.h Wed May 1 15:59:00 2013
> @@ -16,7 +16,9 @@
>
> #include "llvm/IR/Use.h"
> #include "llvm/Support/Casting.h"
> +#include "llvm/Support/CBindingWrapping.h"
> #include "llvm/Support/Compiler.h"
> +#include "llvm-c/Core.h"
>
> namespace llvm {
>
> @@ -406,6 +408,29 @@ public:
> enum { NumLowBitsAvailable = 2 };
> };
>
> +// Create wrappers for C Binding types (see CBindingWrapping.h).
> +DEFINE_ISA_CONVERSION_FUNCTIONS(Value, LLVMValueRef)
> +
> +/* Specialized opaque value conversions.
> + */
> +inline Value **unwrap(LLVMValueRef *Vals) {
> + return reinterpret_cast<Value**>(Vals); }
> +
> +template<typename T>
> +inline T **unwrap(LLVMValueRef *Vals, unsigned Length) { #ifdef DEBUG
> + for (LLVMValueRef *I = Vals, *E = Vals + Length; I != E; ++I)
> + cast<T>(*I);
> +#endif
> + (void)Length;
> + return reinterpret_cast<T**>(Vals);
> +}
> +
> +inline LLVMValueRef *wrap(const Value **Vals) {
> + return reinterpret_cast<LLVMValueRef*>(const_cast<Value**>(Vals));
> +}
> +
> } // End llvm namespace
>
> #endif
>
> Modified: llvm/trunk/include/llvm/PassManager.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassManager.h?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/PassManager.h (original)
> +++ llvm/trunk/include/llvm/PassManager.h Wed May 1 15:59:00 2013
> @@ -18,6 +18,7 @@
> #define LLVM_PASSMANAGER_H
>
> #include "llvm/Pass.h"
> +#include "llvm/Support/CBindingWrapping.h"
>
> namespace llvm {
>
> @@ -98,6 +99,9 @@ private:
> Module *M;
> };
>
> +// Create wrappers for C Binding types (see CBindingWrapping.h).
> +DEFINE_STDCXX_CONVERSION_FUNCTIONS(PassManagerBase, LLVMPassManagerRef)
> +
> } // End llvm namespace
>
> #endif
>
> Modified: llvm/trunk/include/llvm/PassRegistry.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassRegistry.h?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/PassRegistry.h (original)
> +++ llvm/trunk/include/llvm/PassRegistry.h Wed May 1 15:59:00 2013
> @@ -18,6 +18,8 @@
> #define LLVM_PASSREGISTRY_H
>
> #include "llvm/ADT/StringRef.h"
> +#include "llvm/Support/CBindingWrapping.h"
> +#include "llvm-c/Core.h"
>
> namespace llvm {
>
> @@ -79,6 +81,9 @@ public:
> void removeRegistrationListener(PassRegistrationListener *L); };
>
> +// Create wrappers for C Binding types (see CBindingWrapping.h).
> +DEFINE_STDCXX_CONVERSION_FUNCTIONS(PassRegistry, LLVMPassRegistryRef)
> +
> }
>
> #endif
>
> Added: llvm/trunk/include/llvm/Support/CBindingWrapping.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CBindingWrapping.h?rev=180881&view=auto
> ==============================================================================
> --- llvm/trunk/include/llvm/Support/CBindingWrapping.h (added)
> +++ llvm/trunk/include/llvm/Support/CBindingWrapping.h Wed May 1
> +++ 15:59:00 2013
> @@ -0,0 +1,46 @@
> +//===- llvm/Wrap.h - C++ Type Wrapping for the C Interface -----*- C++
> +-*-===// //
> +// The LLVM Compiler Infrastructure
> +//
> +// This file is distributed under the University of Illinois Open
> +Source // License. See LICENSE.TXT for details.
> +//
> +//===------------------------------------------------------------------
> +----===//
> +//
> +// This file declares the wrapping macros for the C interface.
> +//
> +//===------------------------------------------------------------------
> +----===//
> +
> +#ifndef LLVM_C_BINDING_WRAPPING_H
> +#define LLVM_C_BINDING_WRAPPING_H
> +
> +#include "llvm/Support/Casting.h"
> +
> +#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref) \
> + inline ty *unwrap(ref P) { \
> + return reinterpret_cast<ty*>(P); \
> + } \
> + \
> + inline ref wrap(const ty *P) { \
> + return reinterpret_cast<ref>(const_cast<ty*>(P)); \
> + }
> +
> +#define DEFINE_ISA_CONVERSION_FUNCTIONS(ty, ref) \
> + DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref) \
> + \
> + template<typename T> \
> + inline T *unwrap(ref P) { \
> + return cast<T>(unwrap(P)); \
> + }
> +
> +#define DEFINE_STDCXX_CONVERSION_FUNCTIONS(ty, ref) \
> + DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref) \
> + \
> + template<typename T> \
> + inline T *unwrap(ref P) { \
> + T *Q = (T*)unwrap(P); \
> + assert(Q && "Invalid cast!"); \
> + return Q; \
> + }
> +
> +#endif
>
> Modified: llvm/trunk/include/llvm/Support/MemoryBuffer.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MemoryBuffer.h?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Support/MemoryBuffer.h (original)
> +++ llvm/trunk/include/llvm/Support/MemoryBuffer.h Wed May 1 15:59:00
> +++ 2013
> @@ -15,8 +15,10 @@
> #define LLVM_SUPPORT_MEMORYBUFFER_H
>
> #include "llvm/ADT/StringRef.h"
> +#include "llvm/Support/CBindingWrapping.h"
> #include "llvm/Support/Compiler.h"
> #include "llvm/Support/DataTypes.h"
> +#include "llvm-c/Core.h"
>
> namespace llvm {
>
> @@ -137,6 +139,9 @@ public:
> virtual BufferKind getBufferKind() const = 0; };
>
> +// Create wrappers for C Binding types (see CBindingWrapping.h).
> +DEFINE_SIMPLE_CONVERSION_FUNCTIONS(MemoryBuffer, LLVMMemoryBufferRef)
> +
> } // end namespace llvm
>
> #endif
>
> Removed: llvm/trunk/include/llvm/Wrap.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Wrap.h?rev=180880&view=auto
> ==============================================================================
> --- llvm/trunk/include/llvm/Wrap.h (original)
> +++ llvm/trunk/include/llvm/Wrap.h (removed)
> @@ -1,124 +0,0 @@
> -//===- llvm/Wrap.h - C++ Type Wrapping for the C Interface -----*- C++ -*-===// -//
> -// The LLVM Compiler Infrastructure
> -//
> -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details.
> -//
> -//===----------------------------------------------------------------------===//
> -//
> -// This file declares the wrapping functions for the C interface.
> -//
> -//===----------------------------------------------------------------------===//
> -
> -#ifndef LLVM_WRAP_H
> -#define LLVM_WRAP_H
> -
> -#include "llvm-c/Core.h"
> -#include "llvm/IR/BasicBlock.h"
> -#include "llvm/IR/IRBuilder.h"
> -#include "llvm/IR/Module.h"
> -#include "llvm/IR/Type.h"
> -#include "llvm/PassRegistry.h"
> -
> -/* When included into a C++ source file, also declares 'wrap' and 'unwrap'
> - helpers to perform opaque reference<-->pointer conversions. These helpers
> - are shorter and more tightly typed than writing the casts by hand when
> - authoring bindings. In assert builds, they will do runtime type checking.
> -
> - Need these includes to support the LLVM 'cast' template for the C++ 'wrap'
> - and 'unwrap' conversion functions. */
> -
> -namespace llvm {
> - class MemoryBuffer;
> - class PassManagerBase;
> - struct GenericValue;
> - class ExecutionEngine;
> -
> - #define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref) \
> - inline ty *unwrap(ref P) { \
> - return reinterpret_cast<ty*>(P); \
> - } \
> - \
> - inline ref wrap(const ty *P) { \
> - return reinterpret_cast<ref>(const_cast<ty*>(P)); \
> - }
> -
> - #define DEFINE_ISA_CONVERSION_FUNCTIONS(ty, ref) \
> - DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref) \
> - \
> - template<typename T> \
> - inline T *unwrap(ref P) { \
> - return cast<T>(unwrap(P)); \
> - }
> -
> - #define DEFINE_STDCXX_CONVERSION_FUNCTIONS(ty, ref) \
> - DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref) \
> - \
> - template<typename T> \
> - inline T *unwrap(ref P) { \
> - T *Q = (T*)unwrap(P); \
> - assert(Q && "Invalid cast!"); \
> - return Q; \
> - }
> -
> - DEFINE_ISA_CONVERSION_FUNCTIONS (Type, LLVMTypeRef )
> - DEFINE_ISA_CONVERSION_FUNCTIONS (Value, LLVMValueRef )
> - DEFINE_SIMPLE_CONVERSION_FUNCTIONS(Module, LLVMModuleRef )
> - DEFINE_SIMPLE_CONVERSION_FUNCTIONS(BasicBlock, LLVMBasicBlockRef )
> - DEFINE_SIMPLE_CONVERSION_FUNCTIONS(IRBuilder<>, LLVMBuilderRef )
> - DEFINE_SIMPLE_CONVERSION_FUNCTIONS(MemoryBuffer, LLVMMemoryBufferRef )
> - DEFINE_SIMPLE_CONVERSION_FUNCTIONS(LLVMContext, LLVMContextRef )
> - DEFINE_SIMPLE_CONVERSION_FUNCTIONS(Use, LLVMUseRef )
> - DEFINE_STDCXX_CONVERSION_FUNCTIONS(PassManagerBase, LLVMPassManagerRef )
> - DEFINE_STDCXX_CONVERSION_FUNCTIONS(PassRegistry, LLVMPassRegistryRef )
> -
> - /* LLVMModuleProviderRef exists for historical reasons, but now just holds a
> - * Module.
> - */
> - inline Module *unwrap(LLVMModuleProviderRef MP) {
> - return reinterpret_cast<Module*>(MP);
> - }
> -
> - /* Specialized opaque context conversions.
> - */
> - inline LLVMContext **unwrap(LLVMContextRef* Tys) {
> - return reinterpret_cast<LLVMContext**>(Tys);
> - }
> -
> - inline LLVMContextRef *wrap(const LLVMContext **Tys) {
> - return reinterpret_cast<LLVMContextRef*>(const_cast<LLVMContext**>(Tys));
> - }
> -
> - /* Specialized opaque type conversions.
> - */
> - inline Type **unwrap(LLVMTypeRef* Tys) {
> - return reinterpret_cast<Type**>(Tys);
> - }
> -
> - inline LLVMTypeRef *wrap(Type **Tys) {
> - return reinterpret_cast<LLVMTypeRef*>(const_cast<Type**>(Tys));
> - }
> -
> - /* Specialized opaque value conversions.
> - */
> - inline Value **unwrap(LLVMValueRef *Vals) {
> - return reinterpret_cast<Value**>(Vals);
> - }
> -
> - template<typename T>
> - inline T **unwrap(LLVMValueRef *Vals, unsigned Length) {
> - #ifdef DEBUG
> - for (LLVMValueRef *I = Vals, *E = Vals + Length; I != E; ++I)
> - cast<T>(*I);
> - #endif
> - (void)Length;
> - return reinterpret_cast<T**>(Vals);
> - }
> -
> - inline LLVMValueRef *wrap(const Value **Vals) {
> - return reinterpret_cast<LLVMValueRef*>(const_cast<Value**>(Vals));
> - }
> -}
> -
> -#endif
>
> Modified: llvm/trunk/lib/Analysis/Analysis.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/Analysis.cpp?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Analysis/Analysis.cpp (original)
> +++ llvm/trunk/lib/Analysis/Analysis.cpp Wed May 1 15:59:00 2013
> @@ -9,9 +9,10 @@
>
> #include "llvm-c/Analysis.h"
> #include "llvm-c/Initialization.h"
> -#include "llvm/Wrap.h"
> #include "llvm/Analysis/Verifier.h"
> #include "llvm/InitializePasses.h"
> +#include "llvm/IR/Module.h"
> +#include "llvm/PassRegistry.h"
> #include <cstring>
>
> using namespace llvm;
>
> Modified: llvm/trunk/lib/Analysis/IPA/IPA.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/IPA.cpp?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Analysis/IPA/IPA.cpp (original)
> +++ llvm/trunk/lib/Analysis/IPA/IPA.cpp Wed May 1 15:59:00 2013
> @@ -12,7 +12,7 @@
> //===----------------------------------------------------------------------===//
>
> #include "llvm/InitializePasses.h"
> -#include "llvm/Wrap.h"
> +#include "llvm/PassRegistry.h"
> #include "llvm-c/Initialization.h"
>
> using namespace llvm;
>
> Modified: llvm/trunk/lib/Bitcode/Reader/BitReader.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitReader.cpp?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Bitcode/Reader/BitReader.cpp (original)
> +++ llvm/trunk/lib/Bitcode/Reader/BitReader.cpp Wed May 1 15:59:00 2013
> @@ -8,9 +8,9 @@
> //===----------------------------------------------------------------------===//
>
> #include "llvm-c/BitReader.h"
> -#include "llvm/Wrap.h"
> #include "llvm/Bitcode/ReaderWriter.h"
> #include "llvm/IR/LLVMContext.h"
> +#include "llvm/IR/Module.h"
> #include "llvm/Support/MemoryBuffer.h"
> #include <cstring>
> #include <string>
>
> Modified: llvm/trunk/lib/Bitcode/Writer/BitWriter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitWriter.cpp?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Bitcode/Writer/BitWriter.cpp (original)
> +++ llvm/trunk/lib/Bitcode/Writer/BitWriter.cpp Wed May 1 15:59:00 2013
> @@ -8,8 +8,8 @@
> //===----------------------------------------------------------------------===//
>
> #include "llvm-c/BitWriter.h"
> -#include "llvm/Wrap.h"
> #include "llvm/Bitcode/ReaderWriter.h"
> +#include "llvm/IR/Module.h"
> #include "llvm/Support/raw_ostream.h"
> using namespace llvm;
>
>
> Modified: llvm/trunk/lib/CodeGen/CodeGen.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodeGen.cpp?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/CodeGen.cpp (original)
> +++ llvm/trunk/lib/CodeGen/CodeGen.cpp Wed May 1 15:59:00 2013
> @@ -13,7 +13,7 @@
> //===----------------------------------------------------------------------===//
>
> #include "llvm/InitializePasses.h"
> -#include "llvm/Wrap.h"
> +#include "llvm/PassRegistry.h"
> #include "llvm-c/Initialization.h"
>
> using namespace llvm;
>
> Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp (original)
> +++ llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp Wed May
> +++ 1 15:59:00 2013
> @@ -15,13 +15,15 @@
> #include "llvm-c/ExecutionEngine.h"
> #include "llvm/ExecutionEngine/ExecutionEngine.h"
> #include "llvm/ExecutionEngine/GenericValue.h"
> +#include "llvm/IR/DerivedTypes.h"
> +#include "llvm/IR/Module.h"
> #include "llvm/Support/ErrorHandling.h"
> #include <cstring>
>
> using namespace llvm;
>
> // Wrapping the C bindings types.
> -DEFINE_SIMPLE_CONVERSION_FUNCTIONS(GenericValue, LLVMGenericValueRef )
> +DEFINE_SIMPLE_CONVERSION_FUNCTIONS(GenericValue, LLVMGenericValueRef)
>
> inline DataLayout *unwrap(LLVMTargetDataRef P) {
> return reinterpret_cast<DataLayout*>(P);
>
> Modified: llvm/trunk/lib/IR/Core.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Core.cpp?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/lib/IR/Core.cpp (original)
> +++ llvm/trunk/lib/IR/Core.cpp Wed May 1 15:59:00 2013
> @@ -13,7 +13,6 @@
> //===----------------------------------------------------------------------===//
>
> #include "llvm-c/Core.h"
> -#include "llvm/Wrap.h"
> #include "llvm/Bitcode/ReaderWriter.h"
> #include "llvm/IR/Attributes.h"
> #include "llvm/IR/Constants.h"
> @@ -22,7 +21,9 @@
> #include "llvm/IR/GlobalVariable.h"
> #include "llvm/IR/InlineAsm.h"
> #include "llvm/IR/IntrinsicInst.h"
> +#include "llvm/IR/IRBuilder.h"
> #include "llvm/IR/LLVMContext.h"
> +#include "llvm/IR/Module.h"
> #include "llvm/PassManager.h"
> #include "llvm/Support/CallSite.h"
> #include "llvm/Support/Debug.h"
>
> Modified: llvm/trunk/lib/Linker/LinkModules.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Linker/LinkModules.cpp (original)
> +++ llvm/trunk/lib/Linker/LinkModules.cpp Wed May 1 15:59:00 2013
> @@ -12,7 +12,6 @@
> //===----------------------------------------------------------------------===//
>
> #include "llvm/Linker.h"
> -#include "llvm/Wrap.h"
> #include "llvm-c/Linker.h"
> #include "llvm/ADT/DenseSet.h"
> #include "llvm/ADT/Optional.h"
>
> Modified: llvm/trunk/lib/Object/Object.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/Object.cpp?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Object/Object.cpp (original)
> +++ llvm/trunk/lib/Object/Object.cpp Wed May 1 15:59:00 2013
> @@ -12,9 +12,9 @@
> //
> //===----------------------------------------------------------------------===//
>
> +#include "llvm/ADT/SmallVector.h"
> #include "llvm/Object/ObjectFile.h"
> #include "llvm-c/Object.h"
> -#include "llvm/Wrap.h"
>
> using namespace llvm;
> using namespace object;
>
> Modified: llvm/trunk/lib/Target/Target.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Target.cpp?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/Target.cpp (original)
> +++ llvm/trunk/lib/Target/Target.cpp Wed May 1 15:59:00 2013
> @@ -16,9 +16,9 @@
> #include "llvm-c/Initialization.h"
> #include "llvm/IR/DataLayout.h"
> #include "llvm/IR/LLVMContext.h"
> +#include "llvm/IR/Value.h"
> #include "llvm/InitializePasses.h"
> #include "llvm/PassManager.h"
> -#include "llvm/Wrap.h"
> #include "llvm/Target/TargetLibraryInfo.h"
> #include <cstring>
>
>
> Modified: llvm/trunk/lib/Target/TargetMachineC.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetMachineC.cpp?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/TargetMachineC.cpp (original)
> +++ llvm/trunk/lib/Target/TargetMachineC.cpp Wed May 1 15:59:00 2013
> @@ -17,7 +17,6 @@
> #include "llvm/IR/DataLayout.h"
> #include "llvm/IR/Module.h"
> #include "llvm/PassManager.h"
> -#include "llvm/Wrap.h"
> #include "llvm/Support/CodeGen.h"
> #include "llvm/Support/FormattedStream.h"
> #include "llvm/Support/TargetRegistry.h"
>
> Modified: llvm/trunk/lib/Transforms/IPO/IPO.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/IPO.cpp?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/IPO/IPO.cpp (original)
> +++ llvm/trunk/lib/Transforms/IPO/IPO.cpp Wed May 1 15:59:00 2013
> @@ -17,7 +17,6 @@
> #include "llvm-c/Transforms/IPO.h"
> #include "llvm/InitializePasses.h"
> #include "llvm/PassManager.h"
> -#include "llvm/Wrap.h"
> #include "llvm/Transforms/IPO.h"
>
> using namespace llvm;
>
> Modified: llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp (original)
> +++ llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp Wed May 1
> +++ 15:59:00 2013
> @@ -19,7 +19,6 @@
> #include "llvm/Analysis/Passes.h"
> #include "llvm/Analysis/Verifier.h"
> #include "llvm/PassManager.h"
> -#include "llvm/Wrap.h"
> #include "llvm/Support/CommandLine.h"
> #include "llvm/Support/ManagedStatic.h"
> #include "llvm/Target/TargetLibraryInfo.h"
>
> Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp (original)
> +++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Wed
> +++ May 1 15:59:00 2013
> @@ -53,7 +53,6 @@
> #include "llvm/Support/ValueHandle.h"
> #include "llvm/Target/TargetLibraryInfo.h"
> #include "llvm/Transforms/Utils/Local.h"
> -#include "llvm/Wrap.h"
> #include <algorithm>
> #include <climits>
> using namespace llvm;
>
> Modified: llvm/trunk/lib/Transforms/Instrumentation/Instrumentation.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/Instrumentation.cpp?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Instrumentation/Instrumentation.cpp (original)
> +++ llvm/trunk/lib/Transforms/Instrumentation/Instrumentation.cpp Wed
> +++ May 1 15:59:00 2013
> @@ -13,7 +13,7 @@
> //===----------------------------------------------------------------------===//
>
> #include "llvm/InitializePasses.h"
> -#include "llvm/Wrap.h"
> +#include "llvm/PassRegistry.h"
> #include "llvm-c/Initialization.h"
>
> using namespace llvm;
>
> Modified: llvm/trunk/lib/Transforms/ObjCARC/ObjCARC.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/ObjCARC/ObjCARC.cpp?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/ObjCARC/ObjCARC.cpp (original)
> +++ llvm/trunk/lib/Transforms/ObjCARC/ObjCARC.cpp Wed May 1 15:59:00
> +++ 2013
> @@ -17,7 +17,6 @@
> #include "llvm-c/Core.h"
> #include "llvm-c/Initialization.h"
> #include "llvm/InitializePasses.h"
> -#include "llvm/Wrap.h"
> #include "llvm/Support/CommandLine.h"
>
> namespace llvm {
>
> Modified: llvm/trunk/lib/Transforms/Scalar/Scalar.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Scalar.cpp?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/Scalar.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/Scalar.cpp Wed May 1 15:59:00 2013
> @@ -21,7 +21,6 @@
> #include "llvm/IR/DataLayout.h"
> #include "llvm/InitializePasses.h"
> #include "llvm/PassManager.h"
> -#include "llvm/Wrap.h"
>
> using namespace llvm;
>
>
> Modified: llvm/trunk/lib/Transforms/Utils/Utils.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Utils.cpp?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Utils/Utils.cpp (original)
> +++ llvm/trunk/lib/Transforms/Utils/Utils.cpp Wed May 1 15:59:00 2013
> @@ -13,7 +13,7 @@
> //===----------------------------------------------------------------------===//
>
> #include "llvm/InitializePasses.h"
> -#include "llvm/Wrap.h"
> +#include "llvm/PassRegistry.h"
> #include "llvm-c/Initialization.h"
>
> using namespace llvm;
>
> Modified: llvm/trunk/lib/Transforms/Vectorize/Vectorize.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/Vectorize.cpp?rev=180881&r1=180880&r2=180881&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Vectorize/Vectorize.cpp (original)
> +++ llvm/trunk/lib/Transforms/Vectorize/Vectorize.cpp Wed May 1
> +++ 15:59:00 2013
> @@ -20,7 +20,6 @@
> #include "llvm/Analysis/Verifier.h"
> #include "llvm/InitializePasses.h"
> #include "llvm/PassManager.h"
> -#include "llvm/Wrap.h"
>
> using namespace llvm;
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130501/7ead3f1e/attachment.html>
-------------- 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/7ead3f1e/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130501/7ead3f1e/attachment-0001.html>
More information about the llvm-commits
mailing list