[PATCH] D53432: Use llvm::arrayRefFromStringRef

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 19 05:16:20 PDT 2018


sbc100 created this revision.
Herald added subscribers: llvm-commits, aheejin, arichardson, emaste.
Herald added a reviewer: espindola.

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D53432

Files:
  ELF/InputFiles.cpp
  include/lld/Common/Strings.h
  wasm/Writer.cpp


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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53432.170186.patch
Type: text/x-patch
Size: 1293 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181019/ac392e68/attachment.bin>


More information about the llvm-commits mailing list