summaryrefslogtreecommitdiff
path: root/tools/lto/LTOCodeGenerator.cpp
diff options
context:
space:
mode:
authorShuxin Yang <shuxin.llvm@gmail.com>2013-08-07 05:19:23 +0000
committerShuxin Yang <shuxin.llvm@gmail.com>2013-08-07 05:19:23 +0000
commit235089bdaefabcef9e9cde28eb3b0d8937b12a0d (patch)
tree88b8c979ccd4438842bee6f85309dee63f7448ad /tools/lto/LTOCodeGenerator.cpp
parent51c9043f3bc215bb3026486e5e1ef5989a8d8d8b (diff)
downloadllvm-235089bdaefabcef9e9cde28eb3b0d8937b12a0d.tar.gz
llvm-235089bdaefabcef9e9cde28eb3b0d8937b12a0d.tar.bz2
llvm-235089bdaefabcef9e9cde28eb3b0d8937b12a0d.tar.xz
Change public functions of LTOCodeGenerator from ret-false-on-succ to ret-true-on-succ.
As of this revision, all functions of LTOCodeGenerator are consistent in ret-true-on-succ. Tested on multiple OSes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187864 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/lto/LTOCodeGenerator.cpp')
-rw-r--r--tools/lto/LTOCodeGenerator.cpp32
1 files changed, 15 insertions, 17 deletions
diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp
index b2cb22e81c..758227d61e 100644
--- a/tools/lto/LTOCodeGenerator.cpp
+++ b/tools/lto/LTOCodeGenerator.cpp
@@ -128,31 +128,29 @@ bool LTOCodeGenerator::addModule(LTOModule* mod, std::string& errMsg) {
for (int i = 0, e = undefs.size(); i != e; ++i)
_asmUndefinedRefs[undefs[i]] = 1;
- return ret;
+ return !ret;
}
-bool LTOCodeGenerator::setDebugInfo(lto_debug_model debug,
- std::string& errMsg) {
+void LTOCodeGenerator::setDebugInfo(lto_debug_model debug) {
switch (debug) {
case LTO_DEBUG_MODEL_NONE:
_emitDwarfDebugInfo = false;
- return false;
+ return;
case LTO_DEBUG_MODEL_DWARF:
_emitDwarfDebugInfo = true;
- return false;
+ return;
}
llvm_unreachable("Unknown debug format!");
}
-bool LTOCodeGenerator::setCodePICModel(lto_codegen_model model,
- std::string& errMsg) {
+void LTOCodeGenerator::setCodePICModel(lto_codegen_model model) {
switch (model) {
case LTO_CODEGEN_PIC_MODEL_STATIC:
case LTO_CODEGEN_PIC_MODEL_DYNAMIC:
case LTO_CODEGEN_PIC_MODEL_DYNAMIC_NO_PIC:
_codeModel = model;
- return false;
+ return;
}
llvm_unreachable("Unknown PIC model!");
}
@@ -160,7 +158,7 @@ bool LTOCodeGenerator::setCodePICModel(lto_codegen_model model,
bool LTOCodeGenerator::writeMergedModules(const char *path,
std::string &errMsg) {
if (!determineTarget(errMsg))
- return true;
+ return false;
// Run the verifier on the merged modules.
PassManager passes;
@@ -173,7 +171,7 @@ bool LTOCodeGenerator::writeMergedModules(const char *path,
if (!ErrInfo.empty()) {
errMsg = "could not open bitcode file for writing: ";
errMsg += path;
- return true;
+ return false;
}
// write bitcode to it
@@ -184,11 +182,11 @@ bool LTOCodeGenerator::writeMergedModules(const char *path,
errMsg = "could not write bitcode file: ";
errMsg += path;
Out.os().clear_error();
- return true;
+ return false;
}
Out.keep();
- return false;
+ return true;
}
bool LTOCodeGenerator::compile_to_file(const char** name, std::string& errMsg) {
@@ -198,7 +196,7 @@ bool LTOCodeGenerator::compile_to_file(const char** name, std::string& errMsg) {
error_code EC = sys::fs::createTemporaryFile("lto-llvm", "o", FD, Filename);
if (EC) {
errMsg = EC.message();
- return true;
+ return false;
}
// generate object file
@@ -209,23 +207,23 @@ bool LTOCodeGenerator::compile_to_file(const char** name, std::string& errMsg) {
if (objFile.os().has_error()) {
objFile.os().clear_error();
sys::fs::remove(Twine(Filename));
- return true;
+ return false;
}
objFile.keep();
if (!genResult) {
sys::fs::remove(Twine(Filename));
- return true;
+ return false;
}
_nativeObjectPath = Filename.c_str();
*name = _nativeObjectPath.c_str();
- return false;
+ return true;
}
const void* LTOCodeGenerator::compile(size_t* length, std::string& errMsg) {
const char *name;
- if (compile_to_file(&name, errMsg))
+ if (!compile_to_file(&name, errMsg))
return NULL;
// remove old buffer if compile() called twice