Index: ELF/InputFiles.cpp =================================================================== --- ELF/InputFiles.cpp +++ ELF/InputFiles.cpp @@ -1188,7 +1188,7 @@ } void BinaryFile::parse() { - ArrayRef Data = toArrayRef(MB.getBuffer()); + ArrayRef Data = arrayRefFromStringRef(MB.getBuffer()); auto *Section = make(this, SHF_ALLOC | SHF_WRITE, SHT_PROGBITS, 8, Data, ".data"); Sections.push_back(Section); Index: include/lld/Common/Strings.h =================================================================== --- include/lld/Common/Strings.h +++ include/lld/Common/Strings.h @@ -41,9 +41,6 @@ std::vector Patterns; }; -inline llvm::ArrayRef toArrayRef(llvm::StringRef S) { - return {reinterpret_cast(S.data()), S.size()}; -} } // namespace lld #endif Index: wasm/Writer.cpp =================================================================== --- wasm/Writer.cpp +++ wasm/Writer.cpp @@ -979,7 +979,7 @@ OS << BodyContent; } - ArrayRef Body = toArrayRef(Saver.save(FunctionBody)); + ArrayRef Body = arrayRefFromStringRef(Saver.save(FunctionBody)); cast(WasmSym::CallCtors->Function)->setBody(Body); }