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

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 29 09:39:02 PST 2018


Owen Reynolds via Phabricator <reviews at reviews.llvm.org> writes:

> +  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);
}

Cheers,
Rafael


More information about the llvm-commits mailing list