From 95866fa7b208b8bff68bc6c2d0f5d0bcbd3a2816 Mon Sep 17 00:00:00 2001 From: Shuxin Yang Date: Tue, 6 Aug 2013 21:51:21 +0000 Subject: [PATCH] Change private functions of LTOCodeGenerator from ret-false-on-succ to ret-true-on-succ. llvm-svn: 187819 --- llvm/tools/lto/LTOCodeGenerator.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/llvm/tools/lto/LTOCodeGenerator.cpp b/llvm/tools/lto/LTOCodeGenerator.cpp index 6139ade9bce0..b2cb22e81c56 100644 --- a/llvm/tools/lto/LTOCodeGenerator.cpp +++ b/llvm/tools/lto/LTOCodeGenerator.cpp @@ -159,7 +159,7 @@ bool LTOCodeGenerator::setCodePICModel(lto_codegen_model model, bool LTOCodeGenerator::writeMergedModules(const char *path, std::string &errMsg) { - if (determineTarget(errMsg)) + if (!determineTarget(errMsg)) return true; // Run the verifier on the merged modules. @@ -213,7 +213,7 @@ bool LTOCodeGenerator::compile_to_file(const char** name, std::string& errMsg) { } objFile.keep(); - if (genResult) { + if (!genResult) { sys::fs::remove(Twine(Filename)); return true; } @@ -252,7 +252,7 @@ const void* LTOCodeGenerator::compile(size_t* length, std::string& errMsg) { bool LTOCodeGenerator::determineTarget(std::string &errMsg) { if (_target != NULL) - return false; + return true; // if options were requested, set them if (!_codegenOptions.empty()) @@ -267,7 +267,7 @@ bool LTOCodeGenerator::determineTarget(std::string &errMsg) { // create target machine from info for merged modules const Target *march = TargetRegistry::lookupTarget(TripleStr, errMsg); if (march == NULL) - return true; + return false; // The relocation model is actually a static member of TargetMachine and // needs to be set before the TargetMachine is instantiated. @@ -300,7 +300,7 @@ bool LTOCodeGenerator::determineTarget(std::string &errMsg) { _target = march->createTargetMachine(TripleStr, _mCpu, FeatureStr, Options, RelocModel, CodeModel::Default, CodeGenOpt::Aggressive); - return false; + return true; } void LTOCodeGenerator:: @@ -391,8 +391,8 @@ void LTOCodeGenerator::applyScopeRestrictions() { /// Optimize merged modules using various IPO passes bool LTOCodeGenerator::generateObjectFile(raw_ostream &out, std::string &errMsg) { - if (this->determineTarget(errMsg)) - return true; + if (!this->determineTarget(errMsg)) + return false; Module* mergedModule = _linker.getModule(); @@ -435,7 +435,7 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out, if (_target->addPassesToEmitFile(codeGenPasses, Out, TargetMachine::CGFT_ObjectFile)) { errMsg = "target file type not supported"; - return true; + return false; } // Run our queue of passes all at once now, efficiently. @@ -444,7 +444,7 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out, // Run the code generator, and write assembly file codeGenPasses.run(*mergedModule); - return false; // success + return true; } /// setCodeGenDebugOptions - Set codegen debugging options to aid in debugging