[lld] r182031 - [lld] Fix inconsistent style and do cleanup.

Rui Ueyama ruiu at google.com
Thu May 16 10:53:34 PDT 2013


Author: ruiu
Date: Thu May 16 12:53:34 2013
New Revision: 182031

URL: http://llvm.org/viewvc/llvm-project?rev=182031&view=rev
Log:
[lld] Fix inconsistent style and do cleanup.

Modified:
    lld/trunk/lib/ReaderWriter/ELF/ELFTargetInfo.cpp

Modified: lld/trunk/lib/ReaderWriter/ELF/ELFTargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFTargetInfo.cpp?rev=182031&r1=182030&r2=182031&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ELFTargetInfo.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ELFTargetInfo.cpp Thu May 16 12:53:34 2013
@@ -25,14 +25,14 @@ namespace lld {
 ELFTargetInfo::ELFTargetInfo(llvm::Triple triple, std::unique_ptr<TargetHandlerBase> targetHandler)
     : _outputFileType(elf::ET_EXEC),
       _triple(triple),
-      _targetHandler(std::move(targetHandler))
-    , _baseAddress(0)
-    , _isStaticExecutable(false)
-    , _outputYAML(false)
-    , _noInhibitExec(false)
-    , _mergeCommonStrings(false)
-    , _runLayoutPass(true)
-    , _useShlibUndefines(false) {}
+      _targetHandler(std::move(targetHandler)),
+      _baseAddress(0),
+      _isStaticExecutable(false),
+      _outputYAML(false),
+      _noInhibitExec(false),
+      _mergeCommonStrings(false),
+      _runLayoutPass(true),
+      _useShlibUndefines(false) {}
 
 bool ELFTargetInfo::is64Bits() const {
   return getTriple().isArch64Bit();
@@ -64,10 +64,9 @@ uint16_t ELFTargetInfo::getOutputMachine
 }
 
 bool ELFTargetInfo::validate(raw_ostream &diagnostics) {
-  if (_outputFileType == elf::ET_EXEC) {
-    if (_entrySymbolName.empty()) {
-      _entrySymbolName = "_start";
-    }
+  if (_outputFileType == elf::ET_EXEC &&
+      _entrySymbolName.empty()) {
+    _entrySymbolName = "_start";
   }
 
   if (_inputFiles.empty()) {
@@ -79,17 +78,13 @@ bool ELFTargetInfo::validate(raw_ostream
   _yamlReader = createReaderYAML(*this);
   _linkerScriptReader.reset(new ReaderLinkerScript(*this));
   _writer = _outputYAML ? createWriterYAML(*this) : createWriterELF(*this);
-
   return false;
 }
 
 bool ELFTargetInfo::isDynamic() const {
   switch (_outputFileType) {
   case llvm::ELF::ET_EXEC:
-    if (_isStaticExecutable)
-      return false;
-    else
-      return true;
+    return !_isStaticExecutable;
   case llvm::ELF::ET_DYN:
     return true;
   }
@@ -129,7 +124,7 @@ std::unique_ptr<ELFTargetInfo> ELFTarget
   case llvm::Triple::ppc:
     return std::unique_ptr<ELFTargetInfo>(new lld::elf::PPCTargetInfo(triple));
   default:
-    return std::unique_ptr<ELFTargetInfo>();
+    return nullptr;
   }
 }
 
@@ -161,7 +156,7 @@ bool ELFTargetInfo::appendLibrary(String
       unsigned pathlen = pathref.size();
       char *x = _extraStrings.Allocate<char>(pathlen);
       memcpy(x, pathref.data(), pathlen);
-      appendInputFile(StringRef(x,pathlen));
+      appendInputFile(StringRef(x, pathlen));
       return false;
     }
   }





More information about the llvm-commits mailing list