[lld] r233442 - ELF: Use llvm::Optional<StringRef> instead of a bool and a StringRef.

Rui Ueyama ruiu at google.com
Fri Mar 27 15:51:50 PDT 2015


Author: ruiu
Date: Fri Mar 27 17:51:50 2015
New Revision: 233442

URL: http://llvm.org/viewvc/llvm-project?rev=233442&view=rev
Log:
ELF: Use llvm::Optional<StringRef> instead of a bool and a StringRef.

Modified:
    lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h

Modified: lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h?rev=233442&r1=233441&r2=233442&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h (original)
+++ lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h Fri Mar 27 17:51:50 2015
@@ -128,8 +128,8 @@ public:
 
   /// \brief The dynamic linker path set by the --dynamic-linker option
   StringRef getInterpreter() const {
-    if (_dynamicLinkerArg)
-      return _dynamicLinkerPath;
+    if (_dynamicLinkerPath.hasValue())
+      return _dynamicLinkerPath.getValue();
     return getDefaultInterpreter();
   }
 
@@ -166,10 +166,7 @@ public:
   void finalizeInputFiles() override;
 
   /// \brief Set the dynamic linker path
-  void setInterpreter(StringRef dynamicLinker) {
-    _dynamicLinkerArg = true;
-    _dynamicLinkerPath = dynamicLinker;
-  }
+  void setInterpreter(StringRef s) { _dynamicLinkerPath = s; }
 
   /// \brief Set NMAGIC output kind when the linker specifies --nmagic
   /// or -n in the command line
@@ -311,7 +308,7 @@ protected:
   OutputMagic _outputMagic;
   StringRefVector _inputSearchPaths;
   std::unique_ptr<Writer> _writer;
-  StringRef _dynamicLinkerPath;
+  llvm::Optional<StringRef> _dynamicLinkerPath;
   StringRef _initFunction = "_init";
   StringRef _finiFunction = "_fini";
   StringRef _sysrootPath = "";





More information about the llvm-commits mailing list