[llvm] r193255 - llvm-c/lto.h: Avoid use of bool.

NAKAMURA Takumi geek4civic at gmail.com
Wed Oct 23 11:23:52 PDT 2013


Yeah, you might be right. I was unaware of that.
Anyways, I suppose bool would be compatible to int in C API.

Should we introduce "bool" w/o <stdbool.h> on msvc in this case?

2013/10/24 Reid Kleckner <rnk at google.com>:
> Isn't the LTO API supposed to be ABI-stable?  Could this be an ABI breaking
> change?
>
>
> On Wed, Oct 23, 2013 at 10:56 AM, NAKAMURA Takumi <geek4civic at gmail.com>
> wrote:
>>
>> Author: chapuni
>> Date: Wed Oct 23 12:56:46 2013
>> New Revision: 193255
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=193255&view=rev
>> Log:
>> llvm-c/lto.h: Avoid use of bool.
>>
>> Modified:
>>     llvm/trunk/include/llvm-c/lto.h
>>     llvm/trunk/tools/lto/lto.cpp
>>
>> Modified: llvm/trunk/include/llvm-c/lto.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/lto.h?rev=193255&r1=193254&r2=193255&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/include/llvm-c/lto.h (original)
>> +++ llvm/trunk/include/llvm-c/lto.h Wed Oct 23 12:56:46 2013
>> @@ -16,9 +16,6 @@
>>  #ifndef LLVM_C_LTO_H
>>  #define LLVM_C_LTO_H
>>
>> -#ifndef __cplusplus
>> -#include <stdbool.h>
>> -#endif
>>  #include <stddef.h>
>>  #include <sys/types.h>
>>
>> @@ -89,14 +86,14 @@ lto_get_error_message(void);
>>  /**
>>   * Checks if a file is a loadable object file.
>>   */
>> -extern bool
>> +extern int
>>  lto_module_is_object_file(const char* path);
>>
>>
>>  /**
>>   * Checks if a file is a loadable object compiled for requested target.
>>   */
>> -extern bool
>> +extern int
>>  lto_module_is_object_file_for_target(const char* path,
>>                                       const char* target_triple_prefix);
>>
>> @@ -104,14 +101,14 @@ lto_module_is_object_file_for_target(con
>>  /**
>>   * Checks if a buffer is a loadable object file.
>>   */
>> -extern bool
>> +extern int
>>  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 bool
>> +extern int
>>  lto_module_is_object_file_in_memory_for_target(const void* mem, size_t
>> length,
>>                                                const char*
>> target_triple_prefix);
>>
>> @@ -210,7 +207,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 bool
>> +extern int
>>  lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod);
>>
>>
>> @@ -219,7 +216,7 @@ lto_codegen_add_module(lto_code_gen_t cg
>>   * Sets if debug info should be generated.
>>   * Returns true on error (check lto_get_error_message() for details).
>>   */
>> -extern bool
>> +extern int
>>  lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model);
>>
>>
>> @@ -227,7 +224,7 @@ lto_codegen_set_debug_model(lto_code_gen
>>   * Sets which PIC code model to generated.
>>   * Returns true on error (check lto_get_error_message() for details).
>>   */
>> -extern bool
>> +extern int
>>  lto_codegen_set_pic_model(lto_code_gen_t cg, lto_codegen_model);
>>
>>
>> @@ -273,7 +270,7 @@ extern void lto_codegen_add_dso_symbol(l
>>   * merged contents of all modules added so far.
>>   * Returns true on error (check lto_get_error_message() for details).
>>   */
>> -extern bool
>> +extern int
>>  lto_codegen_write_merged_modules(lto_code_gen_t cg, const char* path);
>>
>>  /**
>> @@ -291,7 +288,7 @@ lto_codegen_compile(lto_code_gen_t cg, s
>>   * 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 bool
>> +extern int
>>  lto_codegen_compile_to_file(lto_code_gen_t cg, const char** name);
>>
>>
>>
>> Modified: llvm/trunk/tools/lto/lto.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/lto.cpp?rev=193255&r1=193254&r2=193255&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/tools/lto/lto.cpp (original)
>> +++ llvm/trunk/tools/lto/lto.cpp Wed Oct 23 12:56:46 2013
>> @@ -90,26 +90,26 @@ const char* lto_get_error_message() {
>>  }
>>
>>  /// lto_module_is_object_file - Validates if a file is a loadable object
>> file.
>> -bool lto_module_is_object_file(const char* path) {
>> +int lto_module_is_object_file(const char* path) {
>>    return LTOModule::isBitcodeFile(path);
>>  }
>>
>>  /// lto_module_is_object_file_for_target - Validates if a file is a
>> loadable
>>  /// object file compilable for requested target.
>> -bool lto_module_is_object_file_for_target(const char* path,
>> +int lto_module_is_object_file_for_target(const char* path,
>>                                            const char*
>> target_triplet_prefix) {
>>    return LTOModule::isBitcodeFileForTarget(path, target_triplet_prefix);
>>  }
>>
>>  /// lto_module_is_object_file_in_memory - Validates if a buffer is a
>> loadable
>>  /// object file.
>> -bool lto_module_is_object_file_in_memory(const void* mem, size_t length)
>> {
>> +int lto_module_is_object_file_in_memory(const void* mem, size_t length) {
>>    return LTOModule::isBitcodeFile(mem, length);
>>  }
>>
>>  /// lto_module_is_object_file_in_memory_for_target - Validates if a
>> buffer is a
>>  /// loadable object file compilable for the target.
>> -bool
>> +int
>>  lto_module_is_object_file_in_memory_for_target(const void* mem,
>>                                              size_t length,
>>                                              const char*
>> target_triplet_prefix) {
>> @@ -216,21 +216,21 @@ void lto_codegen_dispose(lto_code_gen_t
>>  /// lto_codegen_add_module - 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).
>> -bool lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod) {
>> +int lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod) {
>>    return !cg->addModule(mod, sLastErrorString);
>>  }
>>
>>  /// lto_codegen_set_debug_model - Sets what if any format of debug info
>> should
>>  /// be generated. Returns true on error (check lto_get_error_message()
>> for
>>  /// details).
>> -bool lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model
>> debug) {
>> +int lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model debug)
>> {
>>    cg->setDebugInfo(debug);
>>    return false;
>>  }
>>
>>  /// lto_codegen_set_pic_model - Sets what code model to generated.
>> Returns true
>>  /// on error (check lto_get_error_message() for details).
>> -bool lto_codegen_set_pic_model(lto_code_gen_t cg, lto_codegen_model
>> model) {
>> +int lto_codegen_set_pic_model(lto_code_gen_t cg, lto_codegen_model model)
>> {
>>    cg->setCodePICModel(model);
>>    return false;
>>  }
>> @@ -267,7 +267,7 @@ void lto_codegen_add_dso_symbol(lto_code
>>  /// lto_codegen_write_merged_modules - Writes a new file at the specified
>> path
>>  /// that contains the merged contents of all modules added so far.
>> Returns true
>>  /// on error (check lto_get_error_message() for details).
>> -bool lto_codegen_write_merged_modules(lto_code_gen_t cg, const char
>> *path) {
>> +int lto_codegen_write_merged_modules(lto_code_gen_t cg, const char *path)
>> {
>>    if (!parsedOptions) {
>>      cg->parseCodeGenDebugOptions();
>>      parsedOptions = true;
>> @@ -293,7 +293,7 @@ const void *lto_codegen_compile(lto_code
>>  /// lto_codegen_compile_to_file - Generates code for all added modules
>> into one
>>  /// native object file. The name of the file is written to name. Returns
>> true on
>>  /// error.
>> -bool lto_codegen_compile_to_file(lto_code_gen_t cg, const char **name) {
>> +int lto_codegen_compile_to_file(lto_code_gen_t cg, const char **name) {
>>    if (!parsedOptions) {
>>      cg->parseCodeGenDebugOptions();
>>      parsedOptions = true;
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>



More information about the llvm-commits mailing list