[PATCH] D16103: Add isa<> support to MachOFile

Pete Cooper via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 11 17:52:25 PST 2016


pete created this revision.
pete added reviewers: lhames, kledzik, ruiu, rafael.
pete added a subscriber: llvm-commits.
pete added a project: lld.

Hi all

I'm in need of something more fine grained that the kind() method on File.  It can only distinguish .o, .so, and .a, but I need to know if, for example, a File* is a MachOFile vs another subclass of SimpleFile like CEntryFile.

This patch is a preliminary implementation which only adds enough to get isa<> to work on MachOFile.  If you are all happy with the direction then i'll add support for all of the subclasses of File so that we can do isa<> on anything in the tree.

Alternatively, if only SimpleFile is expected to have interesting subclasses, then i could instead add a SubKind field to SimpleFile instead of changing kind() in File.  (BTW, I don't intend for kindUnknownObject to be around for long.  If I can do isa<> on all the subclasses then each subclass will have its own entry).

Feedback welcome.

Thanks,
Pete

http://reviews.llvm.org/D16103

Files:
  include/lld/Core/File.h
  include/lld/Core/Simple.h
  lib/Core/Resolver.cpp
  lib/ReaderWriter/MachO/File.h
  lib/ReaderWriter/MachO/SectCreateFile.h
  lib/ReaderWriter/YAML/ReaderWriterYAML.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16103.44593.patch
Type: text/x-patch
Size: 4776 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160112/132ebef1/attachment.bin>


More information about the llvm-commits mailing list