This is an archive of the discontinued LLVM Phabricator instance.

Detemplate SymbolTable
ClosedPublic

Authored by rafael on Jul 25 2017, 4:51 PM.

Details

Reviewers
ruiu
Summary

This should make it possible to access the symbol list from non-templated code.

I wanted something like this to handle start_/end_ symbols in lto.

Diff Detail

Event Timeline

rafael created this revision.Jul 25 2017, 4:51 PM
ruiu edited edge metadata.Jul 25 2017, 5:02 PM

I think we can detemplate this class without creating a class hierarchy. Most part of the class does not use ELFT, so I think we can template member functions and then detemplate the class.

ruiu added a comment.Jul 25 2017, 7:31 PM

Yeah, but I think the reason why we are using a SymbolTable as a bag to store input files is mostly historic. We can store it to global variables, and it shouldn't decrease the quality of code because they are already available globally through Symtab<ELFT>::X.

Detemplate the rest of the class.

rafael retitled this revision from Detemplate part of SymbolTable to Detemplate SymbolTable.Jul 26 2017, 9:25 AM
ruiu added a comment.Jul 26 2017, 10:13 AM

Generally looking good.

ELF/Driver.cpp
952–953

Now you can move this to elf::link as it doesn't require ELFT.

1039

Maybe adding Instances or something to each class is better? I mean, if you do, you can do this without ELFT like this.

for (BinaryFile *F : BinaryFile::Instances)

(This is just an idea, so I'm not really sure if this is a good one, though.)

Address review comments

ruiu accepted this revision.Jul 26 2017, 11:23 AM

LGTM

ELF/Driver.cpp
83–84

Use make for consistency.

This revision is now accepted and ready to land.Jul 26 2017, 11:23 AM
espindola closed this revision.Mar 14 2018, 3:31 PM
espindola added a subscriber: espindola.

309152