[PATCH] D42375: Add --print-icf flag

Owen Reynolds via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 09:38:01 PST 2018


gbreynoo updated this revision to Diff 131987.
gbreynoo added a comment.

Changes following Rafael's comment:

> +  auto PrintICF = [&](const Twine &prefix, size_t I) {

prefix -> Prefix

> +    const auto *F = Sections[I]->File;
>  +    Twine S = prefix + " section '" + Sections[I]->Name + "' from file '" +
>  +              (F ? Twine(F->getName()) : "<internal>") + "'";

It is in general dangerous to use a Twine Value. I would suggest
writting this as:

if (!Config->Verbose && !Config->PrintIcfSections)

  return;

std::string S = ....;
if (Config->PrintIcfSections)

  message(S);

else

  log(S);

}


https://reviews.llvm.org/D42375

Files:
  ELF/Config.h
  ELF/Driver.cpp
  ELF/ICF.cpp
  ELF/Options.td
  test/ELF/Inputs/print-icf.s
  test/ELF/icf-absolute.s
  test/ELF/icf-comdat.s
  test/ELF/icf-i386.s
  test/ELF/icf-merge-sec.s
  test/ELF/icf-merge.s
  test/ELF/icf-non-mergeable.s
  test/ELF/icf-none.s
  test/ELF/icf1.s
  test/ELF/icf2.s
  test/ELF/icf3.s
  test/ELF/icf4.s
  test/ELF/icf5.s
  test/ELF/icf6.s
  test/ELF/icf7.s
  test/ELF/icf9.s
  test/ELF/print-icf.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42375.131987.patch
Type: text/x-patch
Size: 12903 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180130/1695cedd/attachment.bin>


More information about the llvm-commits mailing list