summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/bindings/go/llvm/analysis.go1
-rw-r--r--llvm/bindings/go/llvm/bitreader.go1
-rw-r--r--llvm/bindings/go/llvm/executionengine.go1
-rw-r--r--llvm/bindings/go/llvm/linker.go1
-rw-r--r--llvm/bindings/go/llvm/target.go1
-rw-r--r--llvm/docs/ReleaseNotes.rst6
-rw-r--r--llvm/include/llvm-c/Analysis.h2
-rw-r--r--llvm/include/llvm-c/BitReader.h2
-rw-r--r--llvm/include/llvm-c/BitWriter.h2
-rw-r--r--llvm/include/llvm-c/Core.h106
-rw-r--r--llvm/include/llvm-c/ErrorHandling.h51
-rw-r--r--llvm/include/llvm-c/ExecutionEngine.h2
-rw-r--r--llvm/include/llvm-c/IRReader.h2
-rw-r--r--llvm/include/llvm-c/Initialization.h2
-rw-r--r--llvm/include/llvm-c/Linker.h2
-rw-r--r--llvm/include/llvm-c/Object.h2
-rw-r--r--llvm/include/llvm-c/Support.h20
-rw-r--r--llvm/include/llvm-c/Target.h2
-rw-r--r--llvm/include/llvm-c/TargetMachine.h2
-rw-r--r--llvm/include/llvm-c/Transforms/IPO.h2
-rw-r--r--llvm/include/llvm-c/Transforms/PassManagerBuilder.h2
-rw-r--r--llvm/include/llvm-c/Transforms/Scalar.h2
-rw-r--r--llvm/include/llvm-c/Transforms/Vectorize.h3
-rw-r--r--llvm/include/llvm-c/Types.h124
-rw-r--r--llvm/include/llvm/IR/DiagnosticInfo.h1
-rw-r--r--llvm/include/llvm/IR/LLVMContext.h1
-rw-r--r--llvm/include/llvm/IR/Type.h1
-rw-r--r--llvm/include/llvm/IR/Use.h1
-rw-r--r--llvm/include/llvm/IR/Value.h1
-rw-r--r--llvm/include/llvm/PassRegistry.h1
-rw-r--r--llvm/include/llvm/Support/CBindingWrapping.h1
-rw-r--r--llvm/include/llvm/Support/MemoryBuffer.h1
-rw-r--r--llvm/lib/Bitcode/Reader/BitReader.cpp1
-rw-r--r--llvm/lib/Support/ErrorHandling.cpp2
-rw-r--r--llvm/lib/Support/PrettyStackTrace.cpp2
-rw-r--r--llvm/tools/llvm-c-test/object.c1
-rw-r--r--llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp1
-rw-r--r--llvm/unittests/IR/ConstantsTest.cpp1
-rw-r--r--llvm/unittests/Linker/LinkModulesTest.cpp1
39 files changed, 212 insertions, 146 deletions
diff --git a/llvm/bindings/go/llvm/analysis.go b/llvm/bindings/go/llvm/analysis.go
index 7b0d8e3e8b8..3ae4b71def7 100644
--- a/llvm/bindings/go/llvm/analysis.go
+++ b/llvm/bindings/go/llvm/analysis.go
@@ -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/Core.h"
#include <stdlib.h>
*/
import "C"
diff --git a/llvm/bindings/go/llvm/bitreader.go b/llvm/bindings/go/llvm/bitreader.go
index 98112a99dd3..92652863fdc 100644
--- a/llvm/bindings/go/llvm/bitreader.go
+++ b/llvm/bindings/go/llvm/bitreader.go
@@ -15,6 +15,7 @@ package llvm
/*
#include "llvm-c/BitReader.h"
+#include "llvm-c/Core.h"
#include <stdlib.h>
*/
import "C"
diff --git a/llvm/bindings/go/llvm/executionengine.go b/llvm/bindings/go/llvm/executionengine.go
index 94d4e83b4cf..91f8366ca75 100644
--- a/llvm/bindings/go/llvm/executionengine.go
+++ b/llvm/bindings/go/llvm/executionengine.go
@@ -14,6 +14,7 @@
package llvm
/*
+#include "llvm-c/Core.h"
#include "llvm-c/ExecutionEngine.h"
#include <stdlib.h>
*/
diff --git a/llvm/bindings/go/llvm/linker.go b/llvm/bindings/go/llvm/linker.go
index 63979c2f5ac..ca16f7637b2 100644
--- a/llvm/bindings/go/llvm/linker.go
+++ b/llvm/bindings/go/llvm/linker.go
@@ -14,6 +14,7 @@
package llvm
/*
+#include "llvm-c/Core.h"
#include "llvm-c/Linker.h"
#include <stdlib.h>
*/
diff --git a/llvm/bindings/go/llvm/target.go b/llvm/bindings/go/llvm/target.go
index bd1d0f3a440..6b1895b9ac6 100644
--- a/llvm/bindings/go/llvm/target.go
+++ b/llvm/bindings/go/llvm/target.go
@@ -14,6 +14,7 @@
package llvm
/*
+#include "llvm-c/Core.h"
#include "llvm-c/Target.h"
#include "llvm-c/TargetMachine.h"
#include <stdlib.h>
diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index f43190fdd8e..ccefad22c00 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -52,6 +52,12 @@ Non-comprehensive list of changes in this release
* 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
diff --git a/llvm/include/llvm-c/Analysis.h b/llvm/include/llvm-c/Analysis.h
index f0bdddc50ab..36dcb89e0e0 100644
--- a/llvm/include/llvm-c/Analysis.h
+++ b/llvm/include/llvm-c/Analysis.h
@@ -19,7 +19,7 @@
#ifndef LLVM_C_ANALYSIS_H
#define LLVM_C_ANALYSIS_H
-#include "llvm-c/Core.h"
+#include "llvm-c/Types.h"
#ifdef __cplusplus
extern "C" {
diff --git a/llvm/include/llvm-c/BitReader.h b/llvm/include/llvm-c/BitReader.h
index 900bc5bc09f..4c8378c8c5f 100644
--- a/llvm/include/llvm-c/BitReader.h
+++ b/llvm/include/llvm-c/BitReader.h
@@ -19,7 +19,7 @@
#ifndef LLVM_C_BITREADER_H
#define LLVM_C_BITREADER_H
-#include "llvm-c/Core.h"
+#include "llvm-c/Types.h"
#ifdef __cplusplus
extern "C" {
diff --git a/llvm/include/llvm-c/BitWriter.h b/llvm/include/llvm-c/BitWriter.h
index f25ad3a445f..797d03179ab 100644
--- a/llvm/include/llvm-c/BitWriter.h
+++ b/llvm/include/llvm-c/BitWriter.h
@@ -19,7 +19,7 @@
#ifndef LLVM_C_BITWRITER_H
#define LLVM_C_BITWRITER_H
-#include "llvm-c/Core.h"
+#include "llvm-c/Types.h"
#ifdef __cplusplus
extern "C" {
diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h
index 2221b963075..c8fda15c5ed 100644
--- a/llvm/include/llvm-c/Core.h
+++ b/llvm/include/llvm-c/Core.h
@@ -15,7 +15,8 @@
#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" {
@@ -40,15 +41,6 @@ extern "C" {
* 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.
@@ -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,
@@ -438,30 +362,6 @@ void LLVMShutdown(void);
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
*
@@ -2438,7 +2338,7 @@ void LLVMInstructionEraseFromParent(LLVMValueRef Inst);
*
* @see llvm::Instruction::getOpCode()
*/
-LLVMOpcode LLVMGetInstructionOpcode(LLVMValueRef Inst);
+LLVMOpcode LLVMGetInstructionOpcode(LLVMValueRef Inst);
/**
* Obtain the predicate of an instruction.
diff --git a/llvm/include/llvm-c/ErrorHandling.h b/llvm/include/llvm-c/ErrorHandling.h
new file mode 100644
index 00000000000..5a80bc5e654
--- /dev/null
+++ b/llvm/include/llvm-c/ErrorHandling.h
@@ -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
diff --git a/llvm/include/llvm-c/ExecutionEngine.h b/llvm/include/llvm-c/ExecutionEngine.h
index eb3ecabfa8a..6b000fa0d6f 100644
--- a/llvm/include/llvm-c/ExecutionEngine.h
+++ b/llvm/include/llvm-c/ExecutionEngine.h
@@ -19,7 +19,7 @@
#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"
diff --git a/llvm/include/llvm-c/IRReader.h b/llvm/include/llvm-c/IRReader.h
index 5001afb7ed7..5b58d9921fb 100644
--- a/llvm/include/llvm-c/IRReader.h
+++ b/llvm/include/llvm-c/IRReader.h
@@ -14,7 +14,7 @@
#ifndef LLVM_C_IRREADER_H
#define LLVM_C_IRREADER_H
-#include "llvm-c/Core.h"
+#include "llvm-c/Types.h"
#ifdef __cplusplus
extern "C" {
diff --git a/llvm/include/llvm-c/Initialization.h b/llvm/include/llvm-c/Initialization.h
index 44194f8ea31..90c8396f7ad 100644
--- a/llvm/include/llvm-c/Initialization.h
+++ b/llvm/include/llvm-c/Initialization.h
@@ -16,7 +16,7 @@
#ifndef LLVM_C_INITIALIZATION_H
#define LLVM_C_INITIALIZATION_H
-#include "llvm-c/Core.h"
+#include "llvm-c/Types.h"
#ifdef __cplusplus
extern "C" {
diff --git a/llvm/include/llvm-c/Linker.h b/llvm/include/llvm-c/Linker.h
index 94b65886d35..4d9bd46a259 100644
--- a/llvm/include/llvm-c/Linker.h
+++ b/llvm/include/llvm-c/Linker.h
@@ -14,7 +14,7 @@
#ifndef LLVM_C_LINKER_H
#define LLVM_C_LINKER_H
-#include "llvm-c/Core.h"
+#include "llvm-c/Types.h"
#ifdef __cplusplus
extern "C" {
diff --git a/llvm/include/llvm-c/Object.h b/llvm/include/llvm-c/Object.h
index 9cab5c426c4..a2980e89fe3 100644
--- a/llvm/include/llvm-c/Object.h
+++ b/llvm/include/llvm-c/Object.h
@@ -19,7 +19,7 @@
#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
diff --git a/llvm/include/llvm-c/Support.h b/llvm/include/llvm-c/Support.h
index eca3b7a4203..735d1fbc78c 100644
--- a/llvm/include/llvm-c/Support.h
+++ b/llvm/include/llvm-c/Support.h
@@ -15,31 +15,13 @@
#define LLVM_C_SUPPORT_H
#include "llvm/Support/DataTypes.h"
+#include "llvm-c/Types.h"
#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.
*
diff --git a/llvm/include/llvm-c/Target.h b/llvm/include/llvm-c/Target.h
index b465b4b88db..24d2cb4c959 100644
--- a/llvm/include/llvm-c/Target.h
+++ b/llvm/include/llvm-c/Target.h
@@ -19,7 +19,7 @@
#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)
diff --git a/llvm/include/llvm-c/TargetMachine.h b/llvm/include/llvm-c/TargetMachine.h
index d4993e7e6da..30370809365 100644
--- a/llvm/include/llvm-c/TargetMachine.h
+++ b/llvm/include/llvm-c/TargetMachine.h
@@ -19,7 +19,7 @@
#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
diff --git a/llvm/include/llvm-c/Transforms/IPO.h b/llvm/include/llvm-c/Transforms/IPO.h
index 448078012ea..3af7425dd26 100644
--- a/llvm/include/llvm-c/Transforms/IPO.h
+++ b/llvm/include/llvm-c/Transforms/IPO.h
@@ -15,7 +15,7 @@
#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" {
diff --git a/llvm/include/llvm-c/Transforms/PassManagerBuilder.h b/llvm/include/llvm-c/Transforms/PassManagerBuilder.h
index 3d7a9d677ea..69786b341ab 100644
--- a/llvm/include/llvm-c/Transforms/PassManagerBuilder.h
+++ b/llvm/include/llvm-c/Transforms/PassManagerBuilder.h
@@ -14,7 +14,7 @@
#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;
diff --git a/llvm/include/llvm-c/Transforms/Scalar.h b/llvm/include/llvm-c/Transforms/Scalar.h
index 48c19a6e311..c989ee86b9f 100644
--- a/llvm/include/llvm-c/Transforms/Scalar.h
+++ b/llvm/include/llvm-c/Transforms/Scalar.h
@@ -19,7 +19,7 @@
#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" {
diff --git a/llvm/include/llvm-c/Transforms/Vectorize.h b/llvm/include/llvm-c/Transforms/Vectorize.h
index c9102da6029..a82ef49cb16 100644
--- a/llvm/include/llvm-c/Transforms/Vectorize.h
+++ b/llvm/include/llvm-c/Transforms/Vectorize.h
@@ -20,7 +20,7 @@
#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" {
@@ -51,4 +51,3 @@ void LLVMAddSLPVectorizePass(LLVMPassManagerRef PM);
#endif /* defined(__cplusplus) */
#endif
-
diff --git a/llvm/include/llvm-c/Types.h b/llvm/include/llvm-c/Types.h
new file mode 100644
index 00000000000..19029584efc
--- /dev/null
+++ b/llvm/include/llvm-c/Types.h
@@ -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
diff --git a/llvm/include/llvm/IR/DiagnosticInfo.h b/llvm/include/llvm/IR/DiagnosticInfo.h
index e1438767726..f69955e5ed4 100644
--- a/llvm/include/llvm/IR/DiagnosticInfo.h
+++ b/llvm/include/llvm/IR/DiagnosticInfo.h
@@ -15,7 +15,6 @@
#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"
diff --git a/llvm/include/llvm/IR/LLVMContext.h b/llvm/include/llvm/IR/LLVMContext.h
index e99f02420ef..c546fc3d1ee 100644
--- a/llvm/include/llvm/IR/LLVMContext.h
+++ b/llvm/include/llvm/IR/LLVMContext.h
@@ -15,7 +15,6 @@
#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"
diff --git a/llvm/include/llvm/IR/Type.h b/llvm/include/llvm/IR/Type.h
index 4378709c0c6..97227cebdb1 100644
--- a/llvm/include/llvm/IR/Type.h
+++ b/llvm/include/llvm/IR/Type.h
@@ -15,7 +15,6 @@
#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"
diff --git a/llvm/include/llvm/IR/Use.h b/llvm/include/llvm/IR/Use.h
index 160d71b03e7..a738677f8e5 100644
--- a/llvm/include/llvm/IR/Use.h
+++ b/llvm/include/llvm/IR/Use.h
@@ -25,7 +25,6 @@
#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"
diff --git a/llvm/include/llvm/IR/Value.h b/llvm/include/llvm/IR/Value.h
index 7f11ba3d1f6..fbcfd2b03d5 100644
--- a/llvm/include/llvm/IR/Value.h
+++ b/llvm/include/llvm/IR/Value.h
@@ -14,7 +14,6 @@
#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"
diff --git a/llvm/include/llvm/PassRegistry.h b/llvm/include/llvm/PassRegistry.h
index 8c28ef5e7e6..e7fe1f53a4d 100644
--- a/llvm/include/llvm/PassRegistry.h
+++ b/llvm/include/llvm/PassRegistry.h
@@ -17,7 +17,6 @@
#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"
diff --git a/llvm/include/llvm/Support/CBindingWrapping.h b/llvm/include/llvm/Support/CBindingWrapping.h
index 786ba183b3b..d4633aa7d3c 100644
--- a/llvm/include/llvm/Support/CBindingWrapping.h
+++ b/llvm/include/llvm/Support/CBindingWrapping.h
@@ -15,6 +15,7 @@
#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) { \
diff --git a/llvm/include/llvm/Support/MemoryBuffer.h b/llvm/include/llvm/Support/MemoryBuffer.h
index d6ff69d50f5..73d643537a6 100644
--- a/llvm/include/llvm/Support/MemoryBuffer.h
+++ b/llvm/include/llvm/Support/MemoryBuffer.h
@@ -14,7 +14,6 @@
#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"
diff --git a/llvm/lib/Bitcode/Reader/BitReader.cpp b/llvm/lib/Bitcode/Reader/BitReader.cpp
index 5ac068645c8..7ace802ba21 100644
--- a/llvm/lib/Bitcode/Reader/BitReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitReader.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#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"
diff --git a/llvm/lib/Support/ErrorHandling.cpp b/llvm/lib/Support/ErrorHandling.cpp
index a25e21ae043..2808bd34af0 100644
--- a/llvm/lib/Support/ErrorHandling.cpp
+++ b/llvm/lib/Support/ErrorHandling.cpp
@@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//
#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"
diff --git a/llvm/lib/Support/PrettyStackTrace.cpp b/llvm/lib/Support/PrettyStackTrace.cpp
index d6782a70e1a..05b3e31644b 100644
--- a/llvm/lib/Support/PrettyStackTrace.cpp
+++ b/llvm/lib/Support/PrettyStackTrace.cpp
@@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//
#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"
diff --git a/llvm/tools/llvm-c-test/object.c b/llvm/tools/llvm-c-test/object.c
index a5421d9066d..43521787b60 100644
--- a/llvm/tools/llvm-c-test/object.c
+++ b/llvm/tools/llvm-c-test/object.c
@@ -13,6 +13,7 @@
\*===----------------------------------------------------------------------===*/
#include "llvm-c-test.h"
+#include "llvm-c/Core.h"
#include "llvm-c/Object.h"
#include <stdio.h>
#include <stdlib.h>
diff --git a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
index 07707c91cd9..776d26970a3 100644
--- a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
@@ -9,6 +9,7 @@
#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"
diff --git a/llvm/unittests/IR/ConstantsTest.cpp b/llvm/unittests/IR/ConstantsTest.cpp
index e3b303a350d..7471584097d 100644
--- a/llvm/unittests/IR/ConstantsTest.cpp
+++ b/llvm/unittests/IR/ConstantsTest.cpp
@@ -15,6 +15,7 @@
#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 {
diff --git a/llvm/unittests/Linker/LinkModulesTest.cpp b/llvm/unittests/Linker/LinkModulesTest.cpp
index 5d3945e93b5..322a44f8aaf 100644
--- a/llvm/unittests/Linker/LinkModulesTest.cpp
+++ b/llvm/unittests/Linker/LinkModulesTest.cpp
@@ -16,6 +16,7 @@
#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"
OpenPOWER on IntegriCloud