[PATCH] D32609: Update llvm-readobj -coff-resources to display tree structure.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 3 17:30:47 PDT 2017
ruiu added inline comments.
================
Comment at: llvm/lib/Object/COFFObjectFile.cpp:1600-1601
+ uint16_t Length;
+ std::error_code EC = errorToErrorCode(Reader.readInteger(Length));
+ if (EC)
+ return EC;
----------------
You can define a variable inside an `if`.
if (std::error_code EC = ...)
And this is preferred way if EC's scope is limited inside that `if` as narrower scope = better.
================
Comment at: llvm/lib/Object/COFFObjectFile.cpp:1611
+ for (int i = 0; i < 2 * Length; i += 2) {
+ DirString.push_back(RawDirString.data()[i]);
+ }
----------------
This seems odd. Why can't you do `RawDirString[i]`?
================
Comment at: llvm/lib/Object/COFFObjectFile.cpp:1623
+ResourceSectionRef::getEntrySubDir(const coff_resource_dir_entry *Entry) const {
+ auto Table = reinterpret_cast<const coff_resource_dir_table *>(
+ reinterpret_cast<const uint8_t *>(BBS.data().data()) +
----------------
You can directly return it without the assignment.
https://reviews.llvm.org/D32609
More information about the llvm-commits
mailing list