Reorganize the C API headers to improve build times.
authorEric Christopher <echristo@gmail.com>
Fri, 18 Dec 2015 01:46:52 +0000 (01:46 +0000)
committerEric Christopher <echristo@gmail.com>
Fri, 18 Dec 2015 01:46:52 +0000 (01:46 +0000)
Type specific declarations have been moved to Type.h and error handling
routines have been moved to ErrorHandling.h. Both are included in Core.h
so nothing should change for projects directly including the headers,
but transitive dependencies may be affected.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255965 91177308-0d34-0410-b5e6-96231b3b80d8

39 files changed:
bindings/go/llvm/analysis.go
bindings/go/llvm/bitreader.go
bindings/go/llvm/executionengine.go
bindings/go/llvm/linker.go
bindings/go/llvm/target.go
docs/ReleaseNotes.rst
include/llvm-c/Analysis.h
include/llvm-c/BitReader.h
include/llvm-c/BitWriter.h
include/llvm-c/Core.h
include/llvm-c/ErrorHandling.h [new file with mode: 0644]
include/llvm-c/ExecutionEngine.h
include/llvm-c/IRReader.h
include/llvm-c/Initialization.h
include/llvm-c/Linker.h
include/llvm-c/Object.h
include/llvm-c/Support.h
include/llvm-c/Target.h
include/llvm-c/TargetMachine.h
include/llvm-c/Transforms/IPO.h
include/llvm-c/Transforms/PassManagerBuilder.h
include/llvm-c/Transforms/Scalar.h
include/llvm-c/Transforms/Vectorize.h
include/llvm-c/Types.h [new file with mode: 0644]
include/llvm/IR/DiagnosticInfo.h
include/llvm/IR/LLVMContext.h
include/llvm/IR/Type.h
include/llvm/IR/Use.h
include/llvm/IR/Value.h
include/llvm/PassRegistry.h
include/llvm/Support/CBindingWrapping.h
include/llvm/Support/MemoryBuffer.h
lib/Bitcode/Reader/BitReader.cpp
lib/Support/ErrorHandling.cpp
lib/Support/PrettyStackTrace.cpp
tools/llvm-c-test/object.c
unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
unittests/IR/ConstantsTest.cpp
unittests/Linker/LinkModulesTest.cpp

index 7b0d8e3e8b8a8f8bcbc83d1debcaaed82990c920..3ae4b71def7c0f8a58e44362e17a4975fe836859 100644 (file)
@@ -15,6 +15,7 @@ package llvm
 
 /*
 #include "llvm-c/Analysis.h" // If you are getting an error here read bindings/go/README.txt
 
 /*
 #include "llvm-c/Analysis.h" // If you are getting an error here read bindings/go/README.txt
+#include "llvm-c/Core.h"
 #include <stdlib.h>
 */
 import "C"
 #include <stdlib.h>
 */
 import "C"
index 98112a99dd3b718ddde687eadbd17ed33da056d1..92652863fdcad7f057d7b873ea2152867b7bc15b 100644 (file)
@@ -15,6 +15,7 @@ package llvm
 
 /*
 #include "llvm-c/BitReader.h"
 
 /*
 #include "llvm-c/BitReader.h"
+#include "llvm-c/Core.h"
 #include <stdlib.h>
 */
 import "C"
 #include <stdlib.h>
 */
 import "C"
index 94d4e83b4cf33e8c5126cf442f4fd9fce64c6b05..91f8366ca75d7a9100cff1773d45e140d69530d0 100644 (file)
@@ -14,6 +14,7 @@
 package llvm
 
 /*
 package llvm
 
 /*
+#include "llvm-c/Core.h"
 #include "llvm-c/ExecutionEngine.h"
 #include <stdlib.h>
 */
 #include "llvm-c/ExecutionEngine.h"
 #include <stdlib.h>
 */
index 63979c2f5ac5c8e32866a69658896f1f6fc84b79..ca16f7637b2b23d2db49506f1c12a61a5e8c210e 100644 (file)
@@ -14,6 +14,7 @@
 package llvm
 
 /*
 package llvm
 
 /*
+#include "llvm-c/Core.h"
 #include "llvm-c/Linker.h"
 #include <stdlib.h>
 */
 #include "llvm-c/Linker.h"
 #include <stdlib.h>
 */
index bd1d0f3a440d3cfd35ca89fe9673ccf10c0d6109..6b1895b9ac60981f2a1d3e224c0e68f04c8bce6a 100644 (file)
@@ -14,6 +14,7 @@
 package llvm
 
 /*
 package llvm
 
 /*
+#include "llvm-c/Core.h"
 #include "llvm-c/Target.h"
 #include "llvm-c/TargetMachine.h"
 #include <stdlib.h>
 #include "llvm-c/Target.h"
 #include "llvm-c/TargetMachine.h"
 #include <stdlib.h>
index f43190fdd8e69fe6746b6dc2ac81c6a6ad947954..ccefad22c00a9c3954f4f6ca9dc72bc5781093ee 100644 (file)
@@ -52,6 +52,12 @@ Non-comprehensive list of changes in this release
 * The deprecated C APIs LLVMGetBitcodeModuleProviderInContext and
   LLVMGetBitcodeModuleProvider have been removed.
 
 * The deprecated C APIs LLVMGetBitcodeModuleProviderInContext and
   LLVMGetBitcodeModuleProvider have been removed.
 
+* With this release, the C API headers have been reorganized to improve build
+  time. Type specific declarations have been moved to Type.h, and error
+  handling routines have been moved to ErrorHandling.h. Both are included in
+  Core.h so nothing should change for projects directly including the headers,
+  but transitive dependencies may be affected.
+
 .. NOTE
    For small 1-3 sentence descriptions, just add an entry at the end of
    this list. If your description won't fit comfortably in one bullet
 .. NOTE
    For small 1-3 sentence descriptions, just add an entry at the end of
    this list. If your description won't fit comfortably in one bullet
index f0bdddc50ab76385bcb8044a25d508d8e4ff74e8..36dcb89e0e08fd31c1264046538b86c65ace81a2 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef LLVM_C_ANALYSIS_H
 #define LLVM_C_ANALYSIS_H
 
 #ifndef LLVM_C_ANALYSIS_H
 #define LLVM_C_ANALYSIS_H
 
-#include "llvm-c/Core.h"
+#include "llvm-c/Types.h"
 
 #ifdef __cplusplus
 extern "C" {
 
 #ifdef __cplusplus
 extern "C" {
index 900bc5bc09f20102d82e02f788c4ff1226ddb491..4c8378c8c5f39ca7a553ec3b79f9afa4a11af366 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef LLVM_C_BITREADER_H
 #define LLVM_C_BITREADER_H
 
 #ifndef LLVM_C_BITREADER_H
 #define LLVM_C_BITREADER_H
 
-#include "llvm-c/Core.h"
+#include "llvm-c/Types.h"
 
 #ifdef __cplusplus
 extern "C" {
 
 #ifdef __cplusplus
 extern "C" {
index f25ad3a445f5893d2095572882f9eee49c2568f2..797d03179ab3e991e065aa99dc26e4bedc59f9cd 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef LLVM_C_BITWRITER_H
 #define LLVM_C_BITWRITER_H
 
 #ifndef LLVM_C_BITWRITER_H
 #define LLVM_C_BITWRITER_H
 
-#include "llvm-c/Core.h"
+#include "llvm-c/Types.h"
 
 #ifdef __cplusplus
 extern "C" {
 
 #ifdef __cplusplus
 extern "C" {
index 2221b9630758fa25f81a43f31730eb4f319bbfb0..c8fda15c5ed66128c098654a1cfbb242e3989c10 100644 (file)
@@ -15,7 +15,8 @@
 #ifndef LLVM_C_CORE_H
 #define LLVM_C_CORE_H
 
 #ifndef LLVM_C_CORE_H
 #define LLVM_C_CORE_H
 
-#include "llvm-c/Support.h"
+#include "llvm-c/ErrorHandling.h"
+#include "llvm-c/Types.h"
 
 #ifdef __cplusplus
 extern "C" {
 
 #ifdef __cplusplus
 extern "C" {
@@ -40,15 +41,6 @@ extern "C" {
  * the LLVM intermediate representation as well as other related types
  * and utilities.
  *
  * the LLVM intermediate representation as well as other related types
  * and utilities.
  *
- * LLVM uses a polymorphic type hierarchy which C cannot represent, therefore
- * parameters must be passed as base types. Despite the declared types, most
- * of the functions provided operate only on branches of the type hierarchy.
- * The declared parameter names are descriptive and specify which type is
- * required. Additionally, each type hierarchy is documented along with the
- * functions that operate upon it. For more detail, refer to LLVM's C++ code.
- * If in doubt, refer to Core.cpp, which performs parameter downcasts in the
- * form unwrap<RequiredType>(Param).
- *
  * Many exotic languages can interoperate with C code but have a harder time
  * with C++ due to name mangling. So in addition to C, this interface enables
  * tools written in such languages.
  * Many exotic languages can interoperate with C code but have a harder time
  * with C++ due to name mangling. So in addition to C, this interface enables
  * tools written in such languages.
@@ -62,74 +54,6 @@ extern "C" {
  * @{
  */
 
  * @{
  */
 
-/* Opaque types. */
-
-/**
- * The top-level container for all LLVM global data. See the LLVMContext class.
- */
-typedef struct LLVMOpaqueContext *LLVMContextRef;
-
-/**
- * The top-level container for all other LLVM Intermediate Representation (IR)
- * objects.
- *
- * @see llvm::Module
- */
-typedef struct LLVMOpaqueModule *LLVMModuleRef;
-
-/**
- * Each value in the LLVM IR has a type, an LLVMTypeRef.
- *
- * @see llvm::Type
- */
-typedef struct LLVMOpaqueType *LLVMTypeRef;
-
-/**
- * Represents an individual value in LLVM IR.
- *
- * This models llvm::Value.
- */
-typedef struct LLVMOpaqueValue *LLVMValueRef;
-
-/**
- * Represents a basic block of instructions in LLVM IR.
- *
- * This models llvm::BasicBlock.
- */
-typedef struct LLVMOpaqueBasicBlock *LLVMBasicBlockRef;
-
-/**
- * Represents an LLVM basic block builder.
- *
- * This models llvm::IRBuilder.
- */
-typedef struct LLVMOpaqueBuilder *LLVMBuilderRef;
-
-/**
- * Interface used to provide a module to JIT or interpreter.
- * This is now just a synonym for llvm::Module, but we have to keep using the
- * different type to keep binary compatibility.
- */
-typedef struct LLVMOpaqueModuleProvider *LLVMModuleProviderRef;
-
-/** @see llvm::PassManagerBase */
-typedef struct LLVMOpaquePassManager *LLVMPassManagerRef;
-
-/** @see llvm::PassRegistry */
-typedef struct LLVMOpaquePassRegistry *LLVMPassRegistryRef;
-
-/**
- * Used to get the users and usees of a Value.
- *
- * @see llvm::Use */
-typedef struct LLVMOpaqueUse *LLVMUseRef;
-
-
-/**
- * @see llvm::DiagnosticInfo
- */
-typedef struct LLVMOpaqueDiagnosticInfo *LLVMDiagnosticInfoRef;
-
 typedef enum {
     LLVMZExtAttribute       = 1<<0,
     LLVMSExtAttribute       = 1<<1,
 typedef enum {
     LLVMZExtAttribute       = 1<<0,
     LLVMSExtAttribute       = 1<<1,
@@ -438,30 +362,6 @@ void LLVMShutdown(void);
 char *LLVMCreateMessage(const char *Message);
 void LLVMDisposeMessage(char *Message);
 
 char *LLVMCreateMessage(const char *Message);
 void LLVMDisposeMessage(char *Message);
 
-typedef void (*LLVMFatalErrorHandler)(const char *Reason);
-
-/**
- * Install a fatal error handler. By default, if LLVM detects a fatal error, it
- * will call exit(1). This may not be appropriate in many contexts. For example,
- * doing exit(1) will bypass many crash reporting/tracing system tools. This
- * function allows you to install a callback that will be invoked prior to the
- * call to exit(1).
- */
-void LLVMInstallFatalErrorHandler(LLVMFatalErrorHandler Handler);
-
-/**
- * Reset the fatal error handler. This resets LLVM's fatal error handling
- * behavior to the default.
- */
-void LLVMResetFatalErrorHandler(void);
-
-/**
- * Enable LLVM's built-in stack trace code. This intercepts the OS's crash
- * signals and prints which component of LLVM you were in at the time if the
- * crash.
- */
-void LLVMEnablePrettyStackTrace(void);
-
 /**
  * @defgroup LLVMCCoreContext Contexts
  *
 /**
  * @defgroup LLVMCCoreContext Contexts
  *
@@ -2438,7 +2338,7 @@ void LLVMInstructionEraseFromParent(LLVMValueRef Inst);
  *
  * @see llvm::Instruction::getOpCode()
  */
  *
  * @see llvm::Instruction::getOpCode()
  */
-LLVMOpcode   LLVMGetInstructionOpcode(LLVMValueRef Inst);
+LLVMOpcode LLVMGetInstructionOpcode(LLVMValueRef Inst);
 
 /**
  * Obtain the predicate of an instruction.
 
 /**
  * Obtain the predicate of an instruction.
diff --git a/include/llvm-c/ErrorHandling.h b/include/llvm-c/ErrorHandling.h
new file mode 100644 (file)
index 0000000..5a80bc5
--- /dev/null
@@ -0,0 +1,51 @@
+/*===-- llvm-c/ErrorHandling.h - Error Handling 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 defines the C interface to LLVM's error handling mechanism.      *|
+|*                                                                            *|
+\*===----------------------------------------------------------------------===*/
+
+#ifndef LLVM_C_ERROR_HANDLING_H
+#define LLVM_C_ERROR_HANDLING_H
+
+#include "llvm-c/Types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void (*LLVMFatalErrorHandler)(const char *Reason);
+
+/**
+ * Install a fatal error handler. By default, if LLVM detects a fatal error, it
+ * will call exit(1). This may not be appropriate in many contexts. For example,
+ * doing exit(1) will bypass many crash reporting/tracing system tools. This
+ * function allows you to install a callback that will be invoked prior to the
+ * call to exit(1).
+ */
+void LLVMInstallFatalErrorHandler(LLVMFatalErrorHandler Handler);
+
+/**
+ * Reset the fatal error handler. This resets LLVM's fatal error handling
+ * behavior to the default.
+ */
+void LLVMResetFatalErrorHandler(void);
+
+/**
+ * Enable LLVM's built-in stack trace code. This intercepts the OS's crash
+ * signals and prints which component of LLVM you were in at the time if the
+ * crash.
+ */
+void LLVMEnablePrettyStackTrace(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
index eb3ecabfa8a8c1ffda2e5f1064806263450e1a00..6b000fa0d6f9a84baf2aef96cb429bfc883dd271 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef LLVM_C_EXECUTIONENGINE_H
 #define LLVM_C_EXECUTIONENGINE_H
 
 #ifndef LLVM_C_EXECUTIONENGINE_H
 #define LLVM_C_EXECUTIONENGINE_H
 
-#include "llvm-c/Core.h"
+#include "llvm-c/Types.h"
 #include "llvm-c/Target.h"
 #include "llvm-c/TargetMachine.h"
 
 #include "llvm-c/Target.h"
 #include "llvm-c/TargetMachine.h"
 
index 5001afb7ed7db2505becbf5228e864453f08e743..5b58d9921fb0d0aa6567bc3d1061498a312ebdad 100644 (file)
@@ -14,7 +14,7 @@
 #ifndef LLVM_C_IRREADER_H
 #define LLVM_C_IRREADER_H
 
 #ifndef LLVM_C_IRREADER_H
 #define LLVM_C_IRREADER_H
 
-#include "llvm-c/Core.h"
+#include "llvm-c/Types.h"
 
 #ifdef __cplusplus
 extern "C" {
 
 #ifdef __cplusplus
 extern "C" {
index 44194f8ea3117d2483fecf9cfb4c81a17d1927e8..90c8396f7ad3b80df5b6e76a6ab11bb1ea0ccb11 100644 (file)
@@ -16,7 +16,7 @@
 #ifndef LLVM_C_INITIALIZATION_H
 #define LLVM_C_INITIALIZATION_H
 
 #ifndef LLVM_C_INITIALIZATION_H
 #define LLVM_C_INITIALIZATION_H
 
-#include "llvm-c/Core.h"
+#include "llvm-c/Types.h"
 
 #ifdef __cplusplus
 extern "C" {
 
 #ifdef __cplusplus
 extern "C" {
index 94b65886d350afae2b714fba687c04ab14f4580f..4d9bd46a259bb9b8ac002d9f9e95449a35f4cc09 100644 (file)
@@ -14,7 +14,7 @@
 #ifndef LLVM_C_LINKER_H
 #define LLVM_C_LINKER_H
 
 #ifndef LLVM_C_LINKER_H
 #define LLVM_C_LINKER_H
 
-#include "llvm-c/Core.h"
+#include "llvm-c/Types.h"
 
 #ifdef __cplusplus
 extern "C" {
 
 #ifdef __cplusplus
 extern "C" {
index 9cab5c426c4588d42706b976b06c40dcd9abce0e..a2980e89fe3dff8202aab4a5383c3e19327938e9 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef LLVM_C_OBJECT_H
 #define LLVM_C_OBJECT_H
 
 #ifndef LLVM_C_OBJECT_H
 #define LLVM_C_OBJECT_H
 
-#include "llvm-c/Core.h"
+#include "llvm-c/Types.h"
 #include "llvm/Config/llvm-config.h"
 
 #ifdef __cplusplus
 #include "llvm/Config/llvm-config.h"
 
 #ifdef __cplusplus
index eca3b7a42037ce2a82704a121b902459e0735407..735d1fbc78cc40a76ef52c146cae295e73385017 100644 (file)
 #define LLVM_C_SUPPORT_H
 
 #include "llvm/Support/DataTypes.h"
 #define LLVM_C_SUPPORT_H
 
 #include "llvm/Support/DataTypes.h"
+#include "llvm-c/Types.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-/**
- * @defgroup LLVMCSupportTypes Types and Enumerations
- *
- * @{
- */
-
-typedef int LLVMBool;
-
-/**
- * Used to pass regions of memory through LLVM interfaces.
- *
- * @see llvm::MemoryBuffer
- */
-typedef struct LLVMOpaqueMemoryBuffer *LLVMMemoryBufferRef;
-
-/**
- * @}
- */
-
 /**
  * This function permanently loads the dynamic library at the given path.
  * It is safe to call this function multiple times for the same library.
 /**
  * This function permanently loads the dynamic library at the given path.
  * It is safe to call this function multiple times for the same library.
index b465b4b88db517ac7b5fa62ec94857124aa4a7cf..24d2cb4c95982fa9cc85751717be7e581598a4de 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef LLVM_C_TARGET_H
 #define LLVM_C_TARGET_H
 
 #ifndef LLVM_C_TARGET_H
 #define LLVM_C_TARGET_H
 
-#include "llvm-c/Core.h"
+#include "llvm-c/Types.h"
 #include "llvm/Config/llvm-config.h"
 
 #if defined(_MSC_VER) && !defined(inline)
 #include "llvm/Config/llvm-config.h"
 
 #if defined(_MSC_VER) && !defined(inline)
index d4993e7e6da1e0e5f9bd4892062202db2e981af8..3037080936532fb4d16e8a622a9271ac6416bd62 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef LLVM_C_TARGETMACHINE_H
 #define LLVM_C_TARGETMACHINE_H
 
 #ifndef LLVM_C_TARGETMACHINE_H
 #define LLVM_C_TARGETMACHINE_H
 
-#include "llvm-c/Core.h"
+#include "llvm-c/Types.h"
 #include "llvm-c/Target.h"
 
 #ifdef __cplusplus
 #include "llvm-c/Target.h"
 
 #ifdef __cplusplus
index 448078012eacf355e910e7c2af232f23339896af..3af7425dd268a84d5558207f371dcc066f0f7d64 100644 (file)
@@ -15,7 +15,7 @@
 #ifndef LLVM_C_TRANSFORMS_IPO_H
 #define LLVM_C_TRANSFORMS_IPO_H
 
 #ifndef LLVM_C_TRANSFORMS_IPO_H
 #define LLVM_C_TRANSFORMS_IPO_H
 
-#include "llvm-c/Core.h"
+#include "llvm-c/Types.h"
 
 #ifdef __cplusplus
 extern "C" {
 
 #ifdef __cplusplus
 extern "C" {
index 3d7a9d677eab923630d4ffe382ee9c97a0fb8a67..69786b341ab4c2967e75c9a2fa581c8b7313f4b6 100644 (file)
@@ -14,7 +14,7 @@
 #ifndef LLVM_C_TRANSFORMS_PASSMANAGERBUILDER_H
 #define LLVM_C_TRANSFORMS_PASSMANAGERBUILDER_H
 
 #ifndef LLVM_C_TRANSFORMS_PASSMANAGERBUILDER_H
 #define LLVM_C_TRANSFORMS_PASSMANAGERBUILDER_H
 
-#include "llvm-c/Core.h"
+#include "llvm-c/Types.h"
 
 typedef struct LLVMOpaquePassManagerBuilder *LLVMPassManagerBuilderRef;
 
 
 typedef struct LLVMOpaquePassManagerBuilder *LLVMPassManagerBuilderRef;
 
index 48c19a6e31177b83a3765a411aea5d190efa3464..c989ee86b9f7f381fd1f9798498b66ddd8d1827d 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef LLVM_C_TRANSFORMS_SCALAR_H
 #define LLVM_C_TRANSFORMS_SCALAR_H
 
 #ifndef LLVM_C_TRANSFORMS_SCALAR_H
 #define LLVM_C_TRANSFORMS_SCALAR_H
 
-#include "llvm-c/Core.h"
+#include "llvm-c/Types.h"
 
 #ifdef __cplusplus
 extern "C" {
 
 #ifdef __cplusplus
 extern "C" {
index c9102da60297e02dc5d734707b7d620a8cb9a8b8..a82ef49cb167258efc363e080a089f0c56a32678 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef LLVM_C_TRANSFORMS_VECTORIZE_H
 #define LLVM_C_TRANSFORMS_VECTORIZE_H
 
 #ifndef LLVM_C_TRANSFORMS_VECTORIZE_H
 #define LLVM_C_TRANSFORMS_VECTORIZE_H
 
-#include "llvm-c/Core.h"
+#include "llvm-c/Types.h"
 
 #ifdef __cplusplus
 extern "C" {
 
 #ifdef __cplusplus
 extern "C" {
@@ -51,4 +51,3 @@ void LLVMAddSLPVectorizePass(LLVMPassManagerRef PM);
 #endif /* defined(__cplusplus) */
 
 #endif
 #endif /* defined(__cplusplus) */
 
 #endif
-
diff --git a/include/llvm-c/Types.h b/include/llvm-c/Types.h
new file mode 100644 (file)
index 0000000..1902958
--- /dev/null
@@ -0,0 +1,124 @@
+/*===-- llvm-c/Support.h - C Interface Types declarations ---------*- C -*-===*\
+|*                                                                            *|
+|*                     The LLVM Compiler Infrastructure                       *|
+|*                                                                            *|
+|* This file is distributed under the University of Illinois Open Source      *|
+|* License. See LICENSE.TXT for details.                                      *|
+|*                                                                            *|
+|*===----------------------------------------------------------------------===*|
+|*                                                                            *|
+|* This file defines types used by the the C interface to LLVM.               *|
+|*                                                                            *|
+\*===----------------------------------------------------------------------===*/
+
+#ifndef LLVM_C_TYPES_H
+#define LLVM_C_TYPES_H
+
+#include "llvm/Support/DataTypes.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @defgroup LLVMCSupportTypes Types and Enumerations
+ *
+ * @{
+ */
+
+typedef int LLVMBool;
+
+/* Opaque types. */
+
+/**
+ * LLVM uses a polymorphic type hierarchy which C cannot represent, therefore
+ * parameters must be passed as base types. Despite the declared types, most
+ * of the functions provided operate only on branches of the type hierarchy.
+ * The declared parameter names are descriptive and specify which type is
+ * required. Additionally, each type hierarchy is documented along with the
+ * functions that operate upon it. For more detail, refer to LLVM's C++ code.
+ * If in doubt, refer to Core.cpp, which performs parameter downcasts in the
+ * form unwrap<RequiredType>(Param).
+ */
+
+/**
+ * Used to pass regions of memory through LLVM interfaces.
+ *
+ * @see llvm::MemoryBuffer
+ */
+typedef struct LLVMOpaqueMemoryBuffer *LLVMMemoryBufferRef;
+
+/**
+ * The top-level container for all LLVM global data. See the LLVMContext class.
+ */
+typedef struct LLVMOpaqueContext *LLVMContextRef;
+
+/**
+ * The top-level container for all other LLVM Intermediate Representation (IR)
+ * objects.
+ *
+ * @see llvm::Module
+ */
+typedef struct LLVMOpaqueModule *LLVMModuleRef;
+
+/**
+ * Each value in the LLVM IR has a type, an LLVMTypeRef.
+ *
+ * @see llvm::Type
+ */
+typedef struct LLVMOpaqueType *LLVMTypeRef;
+
+/**
+ * Represents an individual value in LLVM IR.
+ *
+ * This models llvm::Value.
+ */
+typedef struct LLVMOpaqueValue *LLVMValueRef;
+
+/**
+ * Represents a basic block of instructions in LLVM IR.
+ *
+ * This models llvm::BasicBlock.
+ */
+typedef struct LLVMOpaqueBasicBlock *LLVMBasicBlockRef;
+
+/**
+ * Represents an LLVM basic block builder.
+ *
+ * This models llvm::IRBuilder.
+ */
+typedef struct LLVMOpaqueBuilder *LLVMBuilderRef;
+
+/**
+ * Interface used to provide a module to JIT or interpreter.
+ * This is now just a synonym for llvm::Module, but we have to keep using the
+ * different type to keep binary compatibility.
+ */
+typedef struct LLVMOpaqueModuleProvider *LLVMModuleProviderRef;
+
+/** @see llvm::PassManagerBase */
+typedef struct LLVMOpaquePassManager *LLVMPassManagerRef;
+
+/** @see llvm::PassRegistry */
+typedef struct LLVMOpaquePassRegistry *LLVMPassRegistryRef;
+
+/**
+ * Used to get the users and usees of a Value.
+ *
+ * @see llvm::Use */
+typedef struct LLVMOpaqueUse *LLVMUseRef;
+
+/**
+ * @see llvm::DiagnosticInfo
+ */
+typedef struct LLVMOpaqueDiagnosticInfo *LLVMDiagnosticInfoRef;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
index e14387677265ac9d48fb4c5f69bc37d6d27068ab..f69955e5ed48d00cbac84567c9c71e2c4ad8ff75 100644 (file)
@@ -15,7 +15,6 @@
 #ifndef LLVM_IR_DIAGNOSTICINFO_H
 #define LLVM_IR_DIAGNOSTICINFO_H
 
 #ifndef LLVM_IR_DIAGNOSTICINFO_H
 #define LLVM_IR_DIAGNOSTICINFO_H
 
-#include "llvm-c/Core.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/IR/DebugLoc.h"
 #include "llvm/IR/Module.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/IR/DebugLoc.h"
 #include "llvm/IR/Module.h"
index e99f02420efc78e6067a8b4115cca17047524540..c546fc3d1ee098e68c8e130707fe5a7ac88dcb2e 100644 (file)
@@ -15,7 +15,6 @@
 #ifndef LLVM_IR_LLVMCONTEXT_H
 #define LLVM_IR_LLVMCONTEXT_H
 
 #ifndef LLVM_IR_LLVMCONTEXT_H
 #define LLVM_IR_LLVMCONTEXT_H
 
-#include "llvm-c/Core.h"
 #include "llvm/Support/CBindingWrapping.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/Options.h"
 #include "llvm/Support/CBindingWrapping.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/Options.h"
index 4378709c0c6684cfa5e2ec28f79f6dffd6fea8c0..97227cebdb136b65b68ebfd3f71f39f27f6ce170 100644 (file)
@@ -15,7 +15,6 @@
 #ifndef LLVM_IR_TYPE_H
 #define LLVM_IR_TYPE_H
 
 #ifndef LLVM_IR_TYPE_H
 #define LLVM_IR_TYPE_H
 
-#include "llvm-c/Core.h"
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/Support/CBindingWrapping.h"
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/Support/CBindingWrapping.h"
index 160d71b03e7ff4d868219e1e65b51dc164c5771f..a738677f8e5b6bc4a7aaf19c56f8ded002296dd9 100644 (file)
@@ -25,7 +25,6 @@
 #ifndef LLVM_IR_USE_H
 #define LLVM_IR_USE_H
 
 #ifndef LLVM_IR_USE_H
 #define LLVM_IR_USE_H
 
-#include "llvm-c/Core.h"
 #include "llvm/ADT/PointerIntPair.h"
 #include "llvm/Support/CBindingWrapping.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/ADT/PointerIntPair.h"
 #include "llvm/Support/CBindingWrapping.h"
 #include "llvm/Support/Compiler.h"
index 7f11ba3d1f6d5cecb34ce4f3303514c9b7934a00..fbcfd2b03d58c9a6339de1845b077943480be087 100644 (file)
@@ -14,7 +14,6 @@
 #ifndef LLVM_IR_VALUE_H
 #define LLVM_IR_VALUE_H
 
 #ifndef LLVM_IR_VALUE_H
 #define LLVM_IR_VALUE_H
 
-#include "llvm-c/Core.h"
 #include "llvm/ADT/iterator_range.h"
 #include "llvm/IR/Use.h"
 #include "llvm/Support/CBindingWrapping.h"
 #include "llvm/ADT/iterator_range.h"
 #include "llvm/IR/Use.h"
 #include "llvm/Support/CBindingWrapping.h"
index 8c28ef5e7e614e9de71e18eb5462ecb2349eb5ea..e7fe1f53a4d40ba773367c192e11ee592f116ca4 100644 (file)
@@ -17,7 +17,6 @@
 #ifndef LLVM_PASSREGISTRY_H
 #define LLVM_PASSREGISTRY_H
 
 #ifndef LLVM_PASSREGISTRY_H
 #define LLVM_PASSREGISTRY_H
 
-#include "llvm-c/Core.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/StringMap.h"
index 786ba183b3b0d1626b524668da20c66ccf4d62ca..d4633aa7d3c6cebc1431616b282374978a339ce3 100644 (file)
@@ -15,6 +15,7 @@
 #define LLVM_SUPPORT_CBINDINGWRAPPING_H
 
 #include "llvm/Support/Casting.h"
 #define LLVM_SUPPORT_CBINDINGWRAPPING_H
 
 #include "llvm/Support/Casting.h"
+#include "llvm-c/Types.h"
 
 #define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)     \
   inline ty *unwrap(ref P) {                            \
 
 #define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)     \
   inline ty *unwrap(ref P) {                            \
index d6ff69d50f591482e7a6eceda60910db51a2c909..73d643537a6f2b5b1399856d9ef4f9b8e7ee8bed 100644 (file)
@@ -14,7 +14,6 @@
 #ifndef LLVM_SUPPORT_MEMORYBUFFER_H
 #define LLVM_SUPPORT_MEMORYBUFFER_H
 
 #ifndef LLVM_SUPPORT_MEMORYBUFFER_H
 #define LLVM_SUPPORT_MEMORYBUFFER_H
 
-#include "llvm-c/Support.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/CBindingWrapping.h"
 #include "llvm/Support/DataTypes.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/CBindingWrapping.h"
 #include "llvm/Support/DataTypes.h"
index 5ac068645c8ad2bdd1da0901249f478f9c06ac02..7ace802ba21a05b992ff1fbdbe1716e4aca6ec5b 100644 (file)
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm-c/BitReader.h"
 //===----------------------------------------------------------------------===//
 
 #include "llvm-c/BitReader.h"
+#include "llvm-c/Core.h"
 #include "llvm/Bitcode/ReaderWriter.h"
 #include "llvm/IR/DiagnosticPrinter.h"
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/Bitcode/ReaderWriter.h"
 #include "llvm/IR/DiagnosticPrinter.h"
 #include "llvm/IR/LLVMContext.h"
index a25e21ae043eb10a2568a82d6086115279eea715..2808bd34af0689a7376e508235546b7b22275a23 100644 (file)
@@ -13,7 +13,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/ErrorHandling.h"
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/ErrorHandling.h"
-#include "llvm-c/Core.h"
+#include "llvm-c/ErrorHandling.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Config/config.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Config/config.h"
index d6782a70e1a4906877151d34767e3a113b07931f..05b3e31644bdb85886fcdae2725ef69f86fdda63 100644 (file)
@@ -13,7 +13,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/PrettyStackTrace.h"
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/PrettyStackTrace.h"
-#include "llvm-c/Core.h"
+#include "llvm-c/ErrorHandling.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/Config/config.h"     // Get autoconf configuration settings
 #include "llvm/Support/Compiler.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/Config/config.h"     // Get autoconf configuration settings
 #include "llvm/Support/Compiler.h"
index a5421d9066d5e62abbf7d76947361c873bdea65d..43521787b609948455258cf23f207790ae34fb72 100644 (file)
@@ -13,6 +13,7 @@
 \*===----------------------------------------------------------------------===*/
 
 #include "llvm-c-test.h"
 \*===----------------------------------------------------------------------===*/
 
 #include "llvm-c-test.h"
+#include "llvm-c/Core.h"
 #include "llvm-c/Object.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include "llvm-c/Object.h"
 #include <stdio.h>
 #include <stdlib.h>
index 07707c91cd99eec7f13b67b0ed68f84963f84349..776d26970a311b7d163a977d5f8a7f5c55febb0b 100644 (file)
@@ -9,6 +9,7 @@
 
 #include "OrcTestCommon.h"
 #include "gtest/gtest.h"
 
 #include "OrcTestCommon.h"
 #include "gtest/gtest.h"
+#include "llvm-c/Core.h"
 #include "llvm-c/OrcBindings.h"
 #include "llvm-c/Target.h"
 #include "llvm-c/TargetMachine.h"
 #include "llvm-c/OrcBindings.h"
 #include "llvm-c/Target.h"
 #include "llvm-c/TargetMachine.h"
index e3b303a350db7317c611ba9beba907a942d4e04f..7471584097ddaa351571836e1d001e879c6ae849 100644 (file)
@@ -15,6 +15,7 @@
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/Module.h"
 #include "llvm/Support/SourceMgr.h"
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/Module.h"
 #include "llvm/Support/SourceMgr.h"
+#include "llvm-c/Core.h"
 #include "gtest/gtest.h"
 
 namespace llvm {
 #include "gtest/gtest.h"
 
 namespace llvm {
index 5d3945e93b5793eed2e0d646092f3c5b2e4f1705..322a44f8aafe5d03fd6d3d0fdd51a72465e783a4 100644 (file)
@@ -16,6 +16,7 @@
 #include "llvm/IR/Module.h"
 #include "llvm/Linker/Linker.h"
 #include "llvm/Support/SourceMgr.h"
 #include "llvm/IR/Module.h"
 #include "llvm/Linker/Linker.h"
 #include "llvm/Support/SourceMgr.h"
+#include "llvm-c/Core.h"
 #include "llvm-c/Linker.h"
 #include "gtest/gtest.h"
 
 #include "llvm-c/Linker.h"
 #include "gtest/gtest.h"