[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
This commit is contained in:
Simon Atanasyan 2015-03-25 13:12:59 +00:00
parent a0e70cd4b6
commit 235838e1b8
1 changed files with 6 additions and 2 deletions

View File

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