[PATCH] D49576: [llvm-objcopy] Add basic support for --rename-section

Alexander Shaposhnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 19 16:58:21 PDT 2018


alexshap requested changes to this revision.
alexshap added inline comments.
This revision now requires changes to proceed.


================
Comment at: tools/llvm-objcopy/Object.cpp:1087
+  for (const SecPtr &Sec : Sections) {
+    const auto &Iter = SectionsToRename.find(Sec->Name);
+    if (Iter != SectionsToRename.end()) {
----------------
nit: for iterators i think it's fine to use simply auto


================
Comment at: tools/llvm-objcopy/llvm-objcopy.cpp:434
 
+  if (!Config.SectionsToRename.empty()) {
+    Obj.renameSections(Config.SectionsToRename);
----------------
nit: for one-line "if" braces are not necessary, for instance, in https://llvm.org/docs/CodingStandards.html  examples they are omitted 


================
Comment at: tools/llvm-objcopy/llvm-objcopy.cpp:597
+    if (!StringRef(Arg->getValue()).contains('='))
+      error("Bad format for --rename-section");
+    auto Old2New = StringRef(Arg->getValue()).split('=');
----------------
these error messages need to be tested (lines 597, 600)


Repository:
  rL LLVM

https://reviews.llvm.org/D49576





More information about the llvm-commits mailing list