[PATCH] D32609: Update llvm-readobj -coff-resources to display tree structure.

NAKAMURA Takumi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 7 19:21:13 PDT 2017


chapuni added inline comments.


================
Comment at: llvm/tools/llvm-readobj/COFFDumper.cpp:1571
+                          makeArrayRef(ResourceTypeNames));
+        IDStr = IDStr.slice(0, IDStr.find_first_of(")", 0) + 1);
+      } else {
----------------
ecbeckmann wrote:
> chapuni wrote:
> > It writes back part of SmallString via StringRef.
> > Could you rewrite not to modify (SmallString)IDStr?
> Is it necessarily incorrect to modify IDStr in this case?  The StringRef points to something we own within this scope.
It is doing overlapping memcpy. I think it'd not be dangerous since memcpy is done toward upper address.

That said, please be careful to write back string via StringRef.


https://reviews.llvm.org/D32609





More information about the llvm-commits mailing list