[LinkingContext] make LinkingContext non-const
llvm-svn: 192183
diff --git a/lld/lib/ReaderWriter/CoreLinkingContext.cpp b/lld/lib/ReaderWriter/CoreLinkingContext.cpp
index bc9a009..db17d57 100644
--- a/lld/lib/ReaderWriter/CoreLinkingContext.cpp
+++ b/lld/lib/ReaderWriter/CoreLinkingContext.cpp
@@ -271,8 +271,9 @@
CoreLinkingContext::CoreLinkingContext() {}
-bool CoreLinkingContext::validateImpl(raw_ostream &diagnostics) {
+bool CoreLinkingContext::validateImpl(raw_ostream &) {
_reader = createReaderYAML(*this);
+ _writer = createWriterYAML(*this);
return true;
}
@@ -289,11 +290,7 @@
}
}
-Writer &CoreLinkingContext::writer() const {
- if (!_writer)
- _writer = createWriterYAML(*this);
- return *_writer;
-}
+Writer &CoreLinkingContext::writer() const { return *_writer; }
ErrorOr<Reference::Kind>
CoreLinkingContext::relocKindFromString(StringRef str) const {
diff --git a/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp b/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
index 6d7f786..bf1a4a7 100644
--- a/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
+++ b/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
@@ -167,7 +167,7 @@
}
}
if (foundFile)
- return StringRef(*new (_alloc) std::string(pathref));
+ return StringRef(*new (_allocator) std::string(pathref));
}
if (!llvm::sys::fs::exists(libName))
return llvm::make_error_code(llvm::errc::no_such_file_or_directory);