[PATCH] D47047: MC: Remove redundant substr() call

Francis Visoiu Mistrih via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 30 08:50:51 PDT 2018


thegameg added inline comments.


================
Comment at: llvm/trunk/lib/Object/MachOObjectFile.cpp:110
 static const char *getPtr(const MachOObjectFile &O, size_t Offset) {
-  return O.getData().substr(Offset, 1).data();
 }
----------------
`.substr` never goes past end if `Offset` > `getData().size()`. Maybe add an assert to make sure no callers rely on this?


Repository:
  rL LLVM

https://reviews.llvm.org/D47047





More information about the llvm-commits mailing list