[llvm-commits] ELFReader.cpp update - Add support for References.

Nick Kledzik kledzik at apple.com
Fri Sep 14 15:18:59 PDT 2012


On Sep 14, 2012, at 2:15 PM, Sid Manning wrote:

> 
> Update to ReaderELF.cpp, ELF.h and test directory.
> 
> -- Adds a testcase to check relocations are emitted.  Looks like TestingHelpers will need to to be updated in the near future for the many relocation types elf will likely support.
> -- Addresses style issues.

>  public:
>    ELFAbsoluteAtom(const File &F,
>                    llvm::StringRef N,
>                    uint64_t V)
> -    : OwningFile(F)
> -    , Name(N)
> -    , Value(V)
> +    : _owningFile(F)
> +    , _name(N)
> +    , _value(V)
>    {}
> 
One of the advantages of using underscore for ivar names is that the constructor argument names no longer need to be unreadable to not conflict with the ivar name.  That is, the above can now be:
   ELFAbsoluteAtom(const File &owningFile,
                   llvm::StringRef name,
                   uint64_t value)


> -- Adds doxygen comments to Atoms classes and elaborates on some routines.
> -- Changes DefinedAtom's declaration of ELFReference to a reference.
> -- Some loops changed to c++11 style.

>        // i.first is the section the symbol lives in
> -      for (auto si = Symbs.begin(), se = Symbs.end(); si != se; ++si) {
> +      for (auto si = symbols.begin(), se = symbols.end(); si != se; ++si) {
Is there some reason this one was not changed to:
	for (auto si : symbols ) {
	


> -- findAtom uses DenseMap::lookup instead of looping.
> -- Uses the iterator added to ELF.h to step through the SHT_REL/RELA sections.  Thanks, Michael Spencer for the iterator in ELF.h.


-Nick



More information about the llvm-commits mailing list