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

Rafael Ávila de Espíndola via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 12 14:26:12 PDT 2018


rafael added a comment.

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


https://reviews.llvm.org/D44380





More information about the llvm-commits mailing list