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

Sid Manning sidneym at codeaurora.org
Fri Sep 14 18:30:53 PDT 2012


On 09/14/12 17:18, Nick Kledzik wrote:
>
> 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)
>

I updated the variable names in a patch I submitted in my reply to Michael.


>
>> -- 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 ) {

I'm using se to check for the last symbol.

> 	
>
>
>> -- 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


-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation



More information about the llvm-commits mailing list