Skip to content

Commit d5c60d0

Browse files
committed
ELF: Use llvm::Optional<StringRef> instead of a bool and a StringRef.
llvm-svn: 233442
1 parent a57f619 commit d5c60d0

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

lld/include/lld/ReaderWriter/ELFLinkingContext.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ class ELFLinkingContext : public LinkingContext {
128128

129129
/// \brief The dynamic linker path set by the --dynamic-linker option
130130
StringRef getInterpreter() const {
131-
if (_dynamicLinkerArg)
132-
return _dynamicLinkerPath;
131+
if (_dynamicLinkerPath.hasValue())
132+
return _dynamicLinkerPath.getValue();
133133
return getDefaultInterpreter();
134134
}
135135

@@ -166,10 +166,7 @@ class ELFLinkingContext : public LinkingContext {
166166
void finalizeInputFiles() override;
167167

168168
/// \brief Set the dynamic linker path
169-
void setInterpreter(StringRef dynamicLinker) {
170-
_dynamicLinkerArg = true;
171-
_dynamicLinkerPath = dynamicLinker;
172-
}
169+
void setInterpreter(StringRef s) { _dynamicLinkerPath = s; }
173170

174171
/// \brief Set NMAGIC output kind when the linker specifies --nmagic
175172
/// or -n in the command line
@@ -311,7 +308,7 @@ class ELFLinkingContext : public LinkingContext {
311308
OutputMagic _outputMagic;
312309
StringRefVector _inputSearchPaths;
313310
std::unique_ptr<Writer> _writer;
314-
StringRef _dynamicLinkerPath;
311+
llvm::Optional<StringRef> _dynamicLinkerPath;
315312
StringRef _initFunction = "_init";
316313
StringRef _finiFunction = "_fini";
317314
StringRef _sysrootPath = "";

0 commit comments

Comments
 (0)