[llvm] r333496 - MC: Remove redundant substr() call
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Tue May 29 20:37:26 PDT 2018
Author: sbc
Date: Tue May 29 20:37:26 2018
New Revision: 333496
URL: http://llvm.org/viewvc/llvm-project?rev=333496&view=rev
Log:
MC: Remove redundant substr() call
Differential Revision: https://reviews.llvm.org/D47047
Modified:
llvm/trunk/lib/Object/MachOObjectFile.cpp
llvm/trunk/lib/Object/WasmObjectFile.cpp
Modified: llvm/trunk/lib/Object/MachOObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/MachOObjectFile.cpp?rev=333496&r1=333495&r2=333496&view=diff
==============================================================================
--- llvm/trunk/lib/Object/MachOObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/MachOObjectFile.cpp Tue May 29 20:37:26 2018
@@ -107,7 +107,7 @@ getSectionPtr(const MachOObjectFile &O,
}
static const char *getPtr(const MachOObjectFile &O, size_t Offset) {
- return O.getData().substr(Offset, 1).data();
+ return O.getData().data() + Offset;
}
static MachO::nlist_base
Modified: llvm/trunk/lib/Object/WasmObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/WasmObjectFile.cpp?rev=333496&r1=333495&r2=333496&view=diff
==============================================================================
--- llvm/trunk/lib/Object/WasmObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/WasmObjectFile.cpp Tue May 29 20:37:26 2018
@@ -995,7 +995,7 @@ Error WasmObjectFile::parseDataSection(R
}
const uint8_t *WasmObjectFile::getPtr(size_t Offset) const {
- return reinterpret_cast<const uint8_t *>(getData().substr(Offset, 1).data());
+ return reinterpret_cast<const uint8_t *>(getData().data() + Offset);
}
const wasm::WasmObjectHeader &WasmObjectFile::getHeader() const {
More information about the llvm-commits
mailing list