[llvm] r351128 - [Object] Return a symbol_iterator, rather than a basic_symbol_iterator, from
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 22 13:53:31 PST 2019
On Mon, Jan 14, 2019 at 2:08 PM Lang Hames via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: lhames
> Date: Mon Jan 14 14:05:12 2019
> New Revision: 351128
>
> URL: http://llvm.org/viewvc/llvm-project?rev=351128&view=rev
> Log:
> [Object] Return a symbol_iterator, rather than a basic_symbol_iterator,
> from
> MachOObjectFile::getSymbolByIndex.
>
> ObjectFile derivatives should prefer symbol_iterator/SymbolRef over
> basic_symbol_iterator/BasicSymbolRef where possible, as the former
> retain their link to the ObjectFile (rather than a SymbolicFile) and
> provide
> more functionality.
>
Is there an intent to use that greater functionality somewhere in LLVM? Or
out of tree?
> No test for this: Existing code is working, and we don't have (m)any
> libObject
> unit tests. I'll think about how we can test more systematically going
> forward.
>
If it's out of tree, unit tests would seem appropriate. If it's in-tree,
might be appropriate to include the functional change along with this API
change (or shortly after) to demonstrate the usage/need.
>
> Modified:
> llvm/trunk/include/llvm/Object/MachO.h
> llvm/trunk/lib/Object/MachOObjectFile.cpp
>
> Modified: llvm/trunk/include/llvm/Object/MachO.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/MachO.h?rev=351128&r1=351127&r2=351128&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/Object/MachO.h (original)
> +++ llvm/trunk/include/llvm/Object/MachO.h Mon Jan 14 14:05:12 2019
> @@ -356,7 +356,7 @@ public:
> basic_symbol_iterator symbol_end() const override;
>
> // MachO specific.
> - basic_symbol_iterator getSymbolByIndex(unsigned Index) const;
> + symbol_iterator getSymbolByIndex(unsigned Index) const;
> uint64_t getSymbolIndex(DataRefImpl Symb) const;
>
> section_iterator section_begin() const override;
>
> Modified: llvm/trunk/lib/Object/MachOObjectFile.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/MachOObjectFile.cpp?rev=351128&r1=351127&r2=351128&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Object/MachOObjectFile.cpp (original)
> +++ llvm/trunk/lib/Object/MachOObjectFile.cpp Mon Jan 14 14:05:12 2019
> @@ -2438,7 +2438,7 @@ basic_symbol_iterator MachOObjectFile::s
> return basic_symbol_iterator(SymbolRef(DRI, this));
> }
>
> -basic_symbol_iterator MachOObjectFile::getSymbolByIndex(unsigned Index)
> const {
> +symbol_iterator MachOObjectFile::getSymbolByIndex(unsigned Index) const {
> MachO::symtab_command Symtab = getSymtabLoadCommand();
> if (!SymtabLoadCmd || Index >= Symtab.nsyms)
> report_fatal_error("Requested symbol index is out of range.");
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190122/9584fc07/attachment.html>
More information about the llvm-commits
mailing list