diff options
| author | Simon Atanasyan <simon@atanasyan.com> | 2015-03-25 13:12:59 +0000 |
|---|---|---|
| committer | Simon Atanasyan <simon@atanasyan.com> | 2015-03-25 13:12:59 +0000 |
| commit | 235838e1b8ab36e139b190780c2ac5f3e2f86101 (patch) | |
| tree | 8e3777e96a7815b7c9104e99c8e09ad751249d04 | |
| parent | a0e70cd4b616060f36b98bb047a828463da944e0 (diff) | |
| download | bcm5719-llvm-235838e1b8ab36e139b190780c2ac5f3e2f86101.tar.gz bcm5719-llvm-235838e1b8ab36e139b190780c2ac5f3e2f86101.zip | |
[Mips] Factor out the code that extracts a relocation 'tag' into
the separate function
That keeps "extracting" logic into the single place and removes a VC++
compilation warning.
llvm-svn: 233186
| -rw-r--r-- | lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h b/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h index 7381c7e977b..0b8df1cc965 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h @@ -101,19 +101,23 @@ public: : ELFReference<ELFT>( &rel, rel.r_offset - symValue, Reference::KindArch::Mips, rel.getType(_isMips64EL) & 0xff, rel.getSymbol(_isMips64EL)), - _tag(uint32_t(rel.getType(_isMips64EL)) >> 8) {} + _tag(extractTag(rel)) {} MipsELFReference(uint64_t symValue, const Elf_Rel &rel) : ELFReference<ELFT>(rel.r_offset - symValue, Reference::KindArch::Mips, rel.getType(_isMips64EL) & 0xff, rel.getSymbol(_isMips64EL)), - _tag(uint32_t(rel.getType(_isMips64EL)) >> 8) {} + _tag(extractTag(rel)) {} uint32_t tag() const override { return _tag; } void setTag(uint32_t tag) { _tag = tag; } private: uint32_t _tag; + + template <class R> static uint32_t extractTag(const R &rel) { + return (rel.getType(_isMips64EL) & 0xffffff00) >> 8; + } }; template <class ELFT> class MipsELFFile : public ELFFile<ELFT> { |

