llvm.org GIT mirror llvm / 266acb9
llvm-c/lto.h: Avoid use of bool. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193255 91177308-0d34-0410-b5e6-96231b3b80d8 NAKAMURA Takumi 7 years ago
2 changed file(s) with 18 addition(s) and 21 deletion(s). Raw diff Collapse all Expand all
1515 #ifndef LLVM_C_LTO_H
1616 #define LLVM_C_LTO_H
1717
18 #ifndef __cplusplus
19 #include
20 #endif
2118 #include
2219 #include
2320
8885 /**
8986 * Checks if a file is a loadable object file.
9087 */
91 extern bool
88 extern int
9289 lto_module_is_object_file(const char* path);
9390
9491
9592 /**
9693 * Checks if a file is a loadable object compiled for requested target.
9794 */
98 extern bool
95 extern int
9996 lto_module_is_object_file_for_target(const char* path,
10097 const char* target_triple_prefix);
10198
103100 /**
104101 * Checks if a buffer is a loadable object file.
105102 */
106 extern bool
103 extern int
107104 lto_module_is_object_file_in_memory(const void* mem, size_t length);
108105
109106
110107 /**
111108 * Checks if a buffer is a loadable object compiled for requested target.
112109 */
113 extern bool
110 extern int
114111 lto_module_is_object_file_in_memory_for_target(const void* mem, size_t length,
115112 const char* target_triple_prefix);
116113
209206 * Add an object module to the set of modules for which code will be generated.
210207 * Returns true on error (check lto_get_error_message() for details).
211208 */
212 extern bool
209 extern int
213210 lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod);
214211
215212
218215 * Sets if debug info should be generated.
219216 * Returns true on error (check lto_get_error_message() for details).
220217 */
221 extern bool
218 extern int
222219 lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model);
223220
224221
226223 * Sets which PIC code model to generated.
227224 * Returns true on error (check lto_get_error_message() for details).
228225 */
229 extern bool
226 extern int
230227 lto_codegen_set_pic_model(lto_code_gen_t cg, lto_codegen_model);
231228
232229
272269 * merged contents of all modules added so far.
273270 * Returns true on error (check lto_get_error_message() for details).
274271 */
275 extern bool
272 extern int
276273 lto_codegen_write_merged_modules(lto_code_gen_t cg, const char* path);
277274
278275 /**
290287 * Generates code for all added modules into one native object file.
291288 * The name of the file is written to name. Returns true on error.
292289 */
293 extern bool
290 extern int
294291 lto_codegen_compile_to_file(lto_code_gen_t cg, const char** name);
295292
296293
8989 }
9090
9191 /// lto_module_is_object_file - Validates if a file is a loadable object file.
92 bool lto_module_is_object_file(const char* path) {
92 int lto_module_is_object_file(const char* path) {
9393 return LTOModule::isBitcodeFile(path);
9494 }
9595
9696 /// lto_module_is_object_file_for_target - Validates if a file is a loadable
9797 /// object file compilable for requested target.
98 bool lto_module_is_object_file_for_target(const char* path,
98 int lto_module_is_object_file_for_target(const char* path,
9999 const char* target_triplet_prefix) {
100100 return LTOModule::isBitcodeFileForTarget(path, target_triplet_prefix);
101101 }
102102
103103 /// lto_module_is_object_file_in_memory - Validates if a buffer is a loadable
104104 /// object file.
105 bool lto_module_is_object_file_in_memory(const void* mem, size_t length) {
105 int lto_module_is_object_file_in_memory(const void* mem, size_t length) {
106106 return LTOModule::isBitcodeFile(mem, length);
107107 }
108108
109109 /// lto_module_is_object_file_in_memory_for_target - Validates if a buffer is a
110110 /// loadable object file compilable for the target.
111 bool
111 int
112112 lto_module_is_object_file_in_memory_for_target(const void* mem,
113113 size_t length,
114114 const char* target_triplet_prefix) {
215215 /// lto_codegen_add_module - Add an object module to the set of modules for
216216 /// which code will be generated. Returns true on error (check
217217 /// lto_get_error_message() for details).
218 bool lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod) {
218 int lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod) {
219219 return !cg->addModule(mod, sLastErrorString);
220220 }
221221
222222 /// lto_codegen_set_debug_model - Sets what if any format of debug info should
223223 /// be generated. Returns true on error (check lto_get_error_message() for
224224 /// details).
225 bool lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model debug) {
225 int lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model debug) {
226226 cg->setDebugInfo(debug);
227227 return false;
228228 }
229229
230230 /// lto_codegen_set_pic_model - Sets what code model to generated. Returns true
231231 /// on error (check lto_get_error_message() for details).
232 bool lto_codegen_set_pic_model(lto_code_gen_t cg, lto_codegen_model model) {
232 int lto_codegen_set_pic_model(lto_code_gen_t cg, lto_codegen_model model) {
233233 cg->setCodePICModel(model);
234234 return false;
235235 }
266266 /// lto_codegen_write_merged_modules - Writes a new file at the specified path
267267 /// that contains the merged contents of all modules added so far. Returns true
268268 /// on error (check lto_get_error_message() for details).
269 bool lto_codegen_write_merged_modules(lto_code_gen_t cg, const char *path) {
269 int lto_codegen_write_merged_modules(lto_code_gen_t cg, const char *path) {
270270 if (!parsedOptions) {
271271 cg->parseCodeGenDebugOptions();
272272 parsedOptions = true;
292292 /// lto_codegen_compile_to_file - Generates code for all added modules into one
293293 /// native object file. The name of the file is written to name. Returns true on
294294 /// error.
295 bool lto_codegen_compile_to_file(lto_code_gen_t cg, const char **name) {
295 int lto_codegen_compile_to_file(lto_code_gen_t cg, const char **name) {
296296 if (!parsedOptions) {
297297 cg->parseCodeGenDebugOptions();
298298 parsedOptions = true;