This is an archive of the discontinued LLVM Phabricator instance.

Bitcode: Simplify how we enumerate summaries in the index. NFCI.
ClosedPublic

Authored by pcc on Apr 24 2017, 9:50 PM.

Details

Summary

Instead of defining a custom iterator class, just use a function with a
callback, which is much easier to understand and less error prone.

Diff Detail

Repository
rL LLVM

Event Timeline

tejohnson edited edge metadata.May 2 2017, 7:42 AM

Nice cleanup! One question below.

llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
359 ↗(On Diff #96499)

To be NFC this should be "else if !ModuleToSummariesForIndex" (see the constructor of the old iterator), to handle empty partial indexes the same as before. I guess this could happen for a module with no global defs, otherwise there should be at least one summary from the module whose index is being written even if it doesn't import anything, although I would think that the linker would not select it for inclusion. If we think this case shouldn't happen, then change the earlier if to not check for an empty ModuleToSummariesForIndex and make it an assert instead.

pcc updated this revision to Diff 97472.May 2 2017, 10:48 AM
  • Address review comment
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
359 ↗(On Diff #96499)

An object without symbol definitions may be part of the link if it is specified directly on the command line (i.e. not in an archive). Such an object may be semantically significant if it contains module inline asm.

I made this NFC by changing the first if condition.

This revision is now accepted and ready to land.May 2 2017, 10:52 AM
This revision was automatically updated to reflect the committed changes.