This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Implement INSERT BEFORE.
ClosedPublic

Authored by grimar on Mar 12 2018, 6:38 AM.

Details

Summary

This finishes PR35877.

INSERT BEFORE used similar to INSERT AFTER,
it inserts sections before the given target section.

Diff Detail

Repository
rL LLVM

Event Timeline

grimar created this revision.Mar 12 2018, 6:38 AM

George Rimar via Phabricator via llvm-commits
<llvm-commits@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

This revision was not accepted when it landed; it landed in state Needs Review.Mar 13 2018, 2:20 AM
This revision was automatically updated to reflect the committed changes.