summaryrefslogtreecommitdiff
path: root/include/llvm-c
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2013-10-24 22:26:04 +0000
committerReid Kleckner <reid@kleckner.net>2013-10-24 22:26:04 +0000
commit07d5aef3057b2e403b20d683e7477c93fde67d99 (patch)
treee092e60447874e1e789e69a11fc1c95b31d38bcd /include/llvm-c
parent9e39e0d56d105f97b9d8f851403619bb0d9f780d (diff)
lto.h: Use lto_bool_t instead of int to restore the ABI
This reverts commit r193255 and instead creates an lto_bool_t typedef that points to bool, _Bool, or unsigned char depending on what is available. Only recent versions of MSVC provide a stdbool.h header. Reviewers: rafael.espindola Differential Revision: http://llvm-reviews.chandlerc.com/D2019 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193377 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm-c')
-rw-r--r--include/llvm-c/lto.h32
1 files changed, 23 insertions, 9 deletions
diff --git a/include/llvm-c/lto.h b/include/llvm-c/lto.h
index 5004240b3ff..02105bcde96 100644
--- a/include/llvm-c/lto.h
+++ b/include/llvm-c/lto.h
@@ -19,6 +19,20 @@
#include <stddef.h>
#include <sys/types.h>
+#ifndef __cplusplus
+#if !defined(_MSC_VER)
+#include <stdbool.h>
+typedef bool lto_bool_t;
+#else
+// MSVC in particular does not have anything like _Bool or bool in C, but we can
+// at least make sure the type is the same size. The implementation side will
+// use C++ bool.
+typedef unsigned char lto_bool_t;
+#endif
+#else
+typedef bool lto_bool_t;
+#endif
+
/**
* @defgroup LLVMCLTO LTO
* @ingroup LLVMC
@@ -86,14 +100,14 @@ lto_get_error_message(void);
/**
* Checks if a file is a loadable object file.
*/
-extern int
+extern lto_bool_t
lto_module_is_object_file(const char* path);
/**
* Checks if a file is a loadable object compiled for requested target.
*/
-extern int
+extern lto_bool_t
lto_module_is_object_file_for_target(const char* path,
const char* target_triple_prefix);
@@ -101,14 +115,14 @@ lto_module_is_object_file_for_target(const char* path,
/**
* Checks if a buffer is a loadable object file.
*/
-extern int
+extern lto_bool_t
lto_module_is_object_file_in_memory(const void* mem, size_t length);
/**
* Checks if a buffer is a loadable object compiled for requested target.
*/
-extern int
+extern lto_bool_t
lto_module_is_object_file_in_memory_for_target(const void* mem, size_t length,
const char* target_triple_prefix);
@@ -207,7 +221,7 @@ lto_codegen_dispose(lto_code_gen_t);
* Add an object module to the set of modules for which code will be generated.
* Returns true on error (check lto_get_error_message() for details).
*/
-extern int
+extern lto_bool_t
lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod);
@@ -216,7 +230,7 @@ lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod);
* Sets if debug info should be generated.
* Returns true on error (check lto_get_error_message() for details).
*/
-extern int
+extern lto_bool_t
lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model);
@@ -224,7 +238,7 @@ lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model);
* Sets which PIC code model to generated.
* Returns true on error (check lto_get_error_message() for details).
*/
-extern int
+extern lto_bool_t
lto_codegen_set_pic_model(lto_code_gen_t cg, lto_codegen_model);
@@ -270,7 +284,7 @@ extern void lto_codegen_add_dso_symbol(lto_code_gen_t cg, const char *symbol);
* merged contents of all modules added so far.
* Returns true on error (check lto_get_error_message() for details).
*/
-extern int
+extern lto_bool_t
lto_codegen_write_merged_modules(lto_code_gen_t cg, const char* path);
/**
@@ -288,7 +302,7 @@ lto_codegen_compile(lto_code_gen_t cg, size_t* length);
* Generates code for all added modules into one native object file.
* The name of the file is written to name. Returns true on error.
*/
-extern int
+extern lto_bool_t
lto_codegen_compile_to_file(lto_code_gen_t cg, const char** name);