[PATCH] D107273: [llvm-objcopy] IHexELFBuilder::addDataSections - fix evaluation ordering static analyzer warning

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 2 22:58:41 PDT 2021


ikudrin accepted this revision.
ikudrin added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/tools/llvm-objcopy/ELF/Object.cpp:1348
+        // instead of keeping track of real offset in IHEX file, just set to
+        // zero.
         Section = &Obj->addSection<OwnedDataSection>(
----------------
Please add a note that passing a constant is allowed because sections are sorted with `stable_sort()`.


================
Comment at: llvm/tools/llvm-objcopy/ELF/Object.cpp:1352
+            ELF::SHF_ALLOC | ELF::SHF_WRITE, 0);
+        SecNo++;
+      }
----------------
It looks like there is no more need to extract the increment as a separate statement because `SecNo` is now used only once in the expression. But if you find it more readable (and I do), please keep it as is.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107273/new/

https://reviews.llvm.org/D107273



More information about the llvm-commits mailing list