diff options
author | Derek Schuff <dschuff@chromium.org> | 2013-05-06 12:34:34 -0700 |
---|---|---|
committer | Derek Schuff <dschuff@chromium.org> | 2013-05-06 12:34:34 -0700 |
commit | 7b64d98c72e1b453934519b1033d3e60679a4197 (patch) | |
tree | 903fe6f8fc072c6014f2d3d457de720dc3665025 | |
parent | 7ecb66dd080ef1291bd166475c87e2f6b4a1d1a8 (diff) |
Fix build warnings/UB in LTOCodeGenerator.cpp
Change the gatherModuleForLinking interface to return void,
and add a default case in setMergedModuleOutputFormat to silence gcc warning.
BUG=cleanup
R=jvoung@chromium.org, mseaborn@chromium.org
Review URL: https://codereview.chromium.org/14582019
-rw-r--r-- | include/llvm-c/lto.h | 2 | ||||
-rw-r--r-- | tools/lto/LTOCodeGenerator.cpp | 4 | ||||
-rw-r--r-- | tools/lto/LTOCodeGenerator.h | 2 | ||||
-rw-r--r-- | tools/lto/lto.cpp | 4 |
4 files changed, 7 insertions, 5 deletions
diff --git a/include/llvm-c/lto.h b/include/llvm-c/lto.h index a2bfddb0a6..ce3546bd49 100644 --- a/include/llvm-c/lto.h +++ b/include/llvm-c/lto.h @@ -268,7 +268,7 @@ lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod); * should now by owned by the lto_code_gen_t, and will be freed when * the link is done. */ -extern bool +extern void lto_codegen_gather_module_for_link(lto_code_gen_t cg, lto_module_t mod); /** diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp index 7b89f81aa4..720924807e 100644 --- a/tools/lto/LTOCodeGenerator.cpp +++ b/tools/lto/LTOCodeGenerator.cpp @@ -106,7 +106,7 @@ bool LTOCodeGenerator::addModule(LTOModule* mod, std::string& errMsg) { // @LOCALMOD-BEGIN /// Add a module that will be merged with the final output module. /// The merging does not happen until linkGatheredModulesAndDispose(). -bool LTOCodeGenerator::gatherModuleForLinking(LTOModule* mod) { +void LTOCodeGenerator::gatherModuleForLinking(LTOModule* mod) { _gatheredModules.push_back(mod); } @@ -205,6 +205,8 @@ void LTOCodeGenerator::setMergedModuleOutputFormat(lto_output_format format) case LTO_OUTPUT_FORMAT_EXEC: outputFormat = Module::ExecutableOutputFormat; break; + default: + llvm_unreachable("Unexpected output format"); } Module *mergedModule = _linker.getModule(); mergedModule->setOutputFormat(outputFormat); diff --git a/tools/lto/LTOCodeGenerator.h b/tools/lto/LTOCodeGenerator.h index 508c743875..4cc3928340 100644 --- a/tools/lto/LTOCodeGenerator.h +++ b/tools/lto/LTOCodeGenerator.h @@ -44,7 +44,7 @@ struct LTOCodeGenerator { // @LOCALMOD-BEGIN // Alternative methods of adding modules, which delay merging modules until // all modules are available. - bool gatherModuleForLinking(struct LTOModule*); + void gatherModuleForLinking(struct LTOModule*); bool linkGatheredModulesAndDispose(std::string &errMsg); // @LOCALMOD-END bool setDebugInfo(lto_debug_model, std::string &errMsg); diff --git a/tools/lto/lto.cpp b/tools/lto/lto.cpp index 222cfba5c4..1915acbdae 100644 --- a/tools/lto/lto.cpp +++ b/tools/lto/lto.cpp @@ -205,8 +205,8 @@ bool lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod) { } // @LOCALMOD-BEGIN -bool lto_codegen_gather_module_for_link(lto_code_gen_t cg, lto_module_t mod) { - return cg->gatherModuleForLinking(mod); +void lto_codegen_gather_module_for_link(lto_code_gen_t cg, lto_module_t mod) { + cg->gatherModuleForLinking(mod); } bool lto_codegen_link_gathered_modules_and_dispose(lto_code_gen_t cg) { |