[llvm-commits] [llvm] r161530 - /llvm/trunk/tools/lto/LTOCodeGenerator.cpp

Bill Wendling isanbard at gmail.com
Wed Aug 8 15:03:50 PDT 2012


Author: void
Date: Wed Aug  8 17:03:50 2012
New Revision: 161530

URL: http://llvm.org/viewvc/llvm-project?rev=161530&view=rev
Log:
Remove some coding violations. No functionality change.

Modified:
    llvm/trunk/tools/lto/LTOCodeGenerator.cpp

Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=161530&r1=161529&r2=161530&view=diff
==============================================================================
--- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original)
+++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Wed Aug  8 17:03:50 2012
@@ -154,7 +154,7 @@
 bool LTOCodeGenerator::compile_to_file(const char** name, std::string& errMsg) {
   // make unique temp .o file to put generated object file
   sys::PathWithStatus uniqueObjPath("lto-llvm.o");
-  if ( uniqueObjPath.createTemporaryFileOnDisk(false, &errMsg) ) {
+  if (uniqueObjPath.createTemporaryFileOnDisk(false, &errMsg)) {
     uniqueObjPath.eraseFromDisk();
     return true;
   }
@@ -174,7 +174,7 @@
   }
 
   objFile.keep();
-  if ( genResult ) {
+  if (genResult) {
     uniqueObjPath.eraseFromDisk();
     return true;
   }
@@ -204,14 +204,15 @@
   sys::Path(_nativeObjectPath).eraseFromDisk();
 
   // return buffer, unless error
-  if ( _nativeObjectFile == NULL )
+  if (_nativeObjectFile == NULL)
     return NULL;
   *length = _nativeObjectFile->getBufferSize();
   return _nativeObjectFile->getBufferStart();
 }
 
 bool LTOCodeGenerator::determineTarget(std::string& errMsg) {
-  if ( _target != NULL ) return false;
+  if (_target != NULL)
+    return false;
 
   std::string Triple = _linker.getModule()->getTargetTriple();
   if (Triple.empty())
@@ -219,13 +220,13 @@
 
   // create target machine from info for merged modules
   const Target *march = TargetRegistry::lookupTarget(Triple, errMsg);
-  if ( march == NULL )
+  if (march == NULL)
     return true;
 
   // The relocation model is actually a static member of TargetMachine and
   // needs to be set before the TargetMachine is instantiated.
   Reloc::Model RelocModel = Reloc::Default;
-  switch( _codeModel ) {
+  switch (_codeModel) {
   case LTO_CODEGEN_PIC_MODEL_STATIC:
     RelocModel = Reloc::Static;
     break;
@@ -337,13 +338,13 @@
 /// Optimize merged modules using various IPO passes
 bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
                                           std::string &errMsg) {
-  if ( this->determineTarget(errMsg) )
+  if (this->determineTarget(errMsg))
     return true;
 
   Module* mergedModule = _linker.getModule();
 
   // if options were requested, set them
-  if ( !_codegenOptions.empty() )
+  if (!_codegenOptions.empty())
     cl::ParseCommandLineOptions(_codegenOptions.size(),
                                 const_cast<char **>(&_codegenOptions[0]));
 
@@ -405,7 +406,7 @@
        !o.first.empty(); o = getToken(o.second)) {
     // ParseCommandLineOptions() expects argv[0] to be program name. Lazily add
     // that.
-    if ( _codegenOptions.empty() )
+    if (_codegenOptions.empty())
       _codegenOptions.push_back(strdup("libLTO"));
     _codegenOptions.push_back(strdup(o.first.str().c_str()));
   }





More information about the llvm-commits mailing list