Demoting CHelpers.h to include/llvm/Support.
authorGordon Henriksen <gordonhenriksen@mac.com>
Sat, 29 Sep 2007 01:38:42 +0000 (01:38 +0000)
committerGordon Henriksen <gordonhenriksen@mac.com>
Sat, 29 Sep 2007 01:38:42 +0000 (01:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42465 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CHelpers.h [deleted file]
include/llvm/Support/CHelpers.h [new file with mode: 0644]
lib/Bitcode/Writer/BitWriter.cpp
lib/VMCore/Core.cpp

diff --git a/include/llvm/CHelpers.h b/include/llvm/CHelpers.h
deleted file mode 100644 (file)
index 0ae7503..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-//===-- Support/CHelpers.h - Utilities for writing C bindings -------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-// 
-// These opaque reference<-->pointer conversions are shorter and more tightly
-// typed than writing the casts by hand in C bindings. In assert builds, they
-// will do type checking.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SUPPORT_CHELPERS_H
-#define LLVM_SUPPORT_CHELPERS_H
-
-#include "llvm/Module.h"
-#include "llvm/Type.h"
-#include "llvm/Value.h"
-
-typedef struct LLVMOpaqueModule *LLVMModuleRef;
-typedef struct LLVMOpaqueType *LLVMTypeRef;
-typedef struct LLVMOpaqueValue *LLVMValueRef;
-
-namespace llvm {
-  /// Opaque module conversions
-  /// 
-  inline Module *unwrap(LLVMModuleRef M) {
-    return reinterpret_cast<Module*>(M);
-  }
-  
-  inline LLVMModuleRef wrap(Module *M) {
-    return reinterpret_cast<LLVMModuleRef>(M);
-  }
-  
-  /// Opaque type conversions
-  /// 
-  inline Type *unwrap(LLVMTypeRef Ty) {
-    return reinterpret_cast<Type*>(Ty);
-  }
-  
-  template<typename T>
-  inline T *unwrap(LLVMTypeRef Ty) {
-    return cast<T>(unwrap(Ty));
-  }
-  
-  inline Type **unwrap(LLVMTypeRef* Tys) {
-    return reinterpret_cast<Type**>(Tys);
-  }
-  
-  inline LLVMTypeRef wrap(const Type *Ty) {
-    return reinterpret_cast<LLVMTypeRef>(const_cast<Type*>(Ty));
-  }
-  
-  inline LLVMTypeRef *wrap(const Type **Tys) {
-    return reinterpret_cast<LLVMTypeRef*>(const_cast<Type**>(Tys));
-  }
-  
-  /// Opaque value conversions
-  /// 
-  inline Value *unwrap(LLVMValueRef Val) {
-    return reinterpret_cast<Value*>(Val);
-  }
-  
-  template<typename T>
-  inline T *unwrap(LLVMValueRef Val) {
-    return cast<T>(unwrap(Val));
-  }
-
-  inline Value **unwrap(LLVMValueRef *Vals) {
-    return reinterpret_cast<Value**>(Vals);
-  }
-  
-  template<typename T>
-  inline T **unwrap(LLVMValueRef *Vals, unsigned Length) {
-    #if DEBUG
-    for (LLVMValueRef *I = Vals, E = Vals + Length; I != E; ++I)
-      cast<T>(*I);
-    #endif
-    return reinterpret_cast<T**>(Vals);
-  }
-  
-  inline LLVMValueRef wrap(const Value *Val) {
-    return reinterpret_cast<LLVMValueRef>(const_cast<Value*>(Val));
-  }
-  
-  inline LLVMValueRef *wrap(const Value **Vals) {
-    return reinterpret_cast<LLVMValueRef*>(const_cast<Value**>(Vals));
-  }
-  
-  /// Basic block conversions
-  /// 
-  inline BasicBlock *unwrap(LLVMBasicBlockRef BBRef) {
-    return reinterpret_cast<BasicBlock*>(BBRef);
-  }
-  
-  inline LLVMBasicBlockRef wrap(const BasicBlock *BB) {
-    return reinterpret_cast<LLVMBasicBlockRef>(const_cast<BasicBlock*>(BB));
-  }
-}
-
-#endif
diff --git a/include/llvm/Support/CHelpers.h b/include/llvm/Support/CHelpers.h
new file mode 100644 (file)
index 0000000..0ae7503
--- /dev/null
@@ -0,0 +1,104 @@
+//===-- Support/CHelpers.h - Utilities for writing C bindings -------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// 
+// These opaque reference<-->pointer conversions are shorter and more tightly
+// typed than writing the casts by hand in C bindings. In assert builds, they
+// will do type checking.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_SUPPORT_CHELPERS_H
+#define LLVM_SUPPORT_CHELPERS_H
+
+#include "llvm/Module.h"
+#include "llvm/Type.h"
+#include "llvm/Value.h"
+
+typedef struct LLVMOpaqueModule *LLVMModuleRef;
+typedef struct LLVMOpaqueType *LLVMTypeRef;
+typedef struct LLVMOpaqueValue *LLVMValueRef;
+
+namespace llvm {
+  /// Opaque module conversions
+  /// 
+  inline Module *unwrap(LLVMModuleRef M) {
+    return reinterpret_cast<Module*>(M);
+  }
+  
+  inline LLVMModuleRef wrap(Module *M) {
+    return reinterpret_cast<LLVMModuleRef>(M);
+  }
+  
+  /// Opaque type conversions
+  /// 
+  inline Type *unwrap(LLVMTypeRef Ty) {
+    return reinterpret_cast<Type*>(Ty);
+  }
+  
+  template<typename T>
+  inline T *unwrap(LLVMTypeRef Ty) {
+    return cast<T>(unwrap(Ty));
+  }
+  
+  inline Type **unwrap(LLVMTypeRef* Tys) {
+    return reinterpret_cast<Type**>(Tys);
+  }
+  
+  inline LLVMTypeRef wrap(const Type *Ty) {
+    return reinterpret_cast<LLVMTypeRef>(const_cast<Type*>(Ty));
+  }
+  
+  inline LLVMTypeRef *wrap(const Type **Tys) {
+    return reinterpret_cast<LLVMTypeRef*>(const_cast<Type**>(Tys));
+  }
+  
+  /// Opaque value conversions
+  /// 
+  inline Value *unwrap(LLVMValueRef Val) {
+    return reinterpret_cast<Value*>(Val);
+  }
+  
+  template<typename T>
+  inline T *unwrap(LLVMValueRef Val) {
+    return cast<T>(unwrap(Val));
+  }
+
+  inline Value **unwrap(LLVMValueRef *Vals) {
+    return reinterpret_cast<Value**>(Vals);
+  }
+  
+  template<typename T>
+  inline T **unwrap(LLVMValueRef *Vals, unsigned Length) {
+    #if DEBUG
+    for (LLVMValueRef *I = Vals, E = Vals + Length; I != E; ++I)
+      cast<T>(*I);
+    #endif
+    return reinterpret_cast<T**>(Vals);
+  }
+  
+  inline LLVMValueRef wrap(const Value *Val) {
+    return reinterpret_cast<LLVMValueRef>(const_cast<Value*>(Val));
+  }
+  
+  inline LLVMValueRef *wrap(const Value **Vals) {
+    return reinterpret_cast<LLVMValueRef*>(const_cast<Value**>(Vals));
+  }
+  
+  /// Basic block conversions
+  /// 
+  inline BasicBlock *unwrap(LLVMBasicBlockRef BBRef) {
+    return reinterpret_cast<BasicBlock*>(BBRef);
+  }
+  
+  inline LLVMBasicBlockRef wrap(const BasicBlock *BB) {
+    return reinterpret_cast<LLVMBasicBlockRef>(const_cast<BasicBlock*>(BB));
+  }
+}
+
+#endif
index 7b90586fd7064bc683c7d069a12a20d5db6c62c9..b2e7ac2ec0f02fa91093ffc13681699e9b420528 100644 (file)
@@ -8,8 +8,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm-c/BitWriter.h"
-#include "llvm/CHelpers.h"
 #include "llvm/Bitcode/ReaderWriter.h"
+#include "llvm/Support/CHelpers.h"
 #include <fstream>
 
 using namespace llvm;
index 9fc4d40746cd92a6b31f1d99da06520110168bdb..f35951d45b0947943949d7eee9ceeda60690239e 100644 (file)
 
 #include "llvm-c/Core.h"
 #include "llvm/Bitcode/ReaderWriter.h"
-#include "llvm/CHelpers.h"
 #include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/GlobalVariable.h"
+#include "llvm/Support/CHelpers.h"
 #include "llvm/Support/LLVMBuilder.h"
 #include "llvm/TypeSymbolTable.h"
 #include <cassert>