[PATCH] D44380: [ELF] - Implement INSERT BEFORE.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 12 14:25:57 PDT 2018


George Rimar via Phabricator via llvm-commits
<llvm-commits at lists.llvm.org> writes:

> -  for (std::pair<StringRef, std::vector<BaseCommand *>> &P :
> -       InsertAfterCommands)
> -    if (!P.second.empty())
> -      error("unable to INSERT AFTER " + P.first + ": section not defined");
> +
> +  auto Check = [](llvm::DenseMap<StringRef, std::vector<BaseCommand *>> &Map) {
> +    for (std::pair<StringRef, std::vector<BaseCommand *>> &P : Map)
> +      if (!P.second.empty())
> +        error("unable to INSERT AFTER/BEFORE " + P.first +
> +              ": section not defined");
> +  };
> +  Check(InsertBeforeCommands);
> +  Check(InsertAfterCommands);

It might be simpler to do

for (auto &Cmds : {InsertBeforeCommands, InsertAfterCommands}) {
  ...
}

LGTM with that.

Cheers,
Rafael


More information about the llvm-commits mailing list