diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 20:50:12 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 20:50:12 +0000 |
commit | e6d1592492a3a379186bfb02bd0f4eda0669c0d5 (patch) | |
tree | 599ab169a01f1c86eda9adc774edaedde2f2db5b /lib/MC/MCSymbolELF.cpp | |
parent | 1a56a5ead7a2e84bee8240f5f6b033b5f1707154 (diff) |
Diffstat (limited to 'lib/MC/MCSymbolELF.cpp')
-rw-r--r-- | lib/MC/MCSymbolELF.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/MC/MCSymbolELF.cpp b/lib/MC/MCSymbolELF.cpp index 12c724f6b1ee..a07c56c64f84 100644 --- a/lib/MC/MCSymbolELF.cpp +++ b/lib/MC/MCSymbolELF.cpp @@ -1,9 +1,8 @@ //===- lib/MC/MCSymbolELF.cpp ---------------------------------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -66,7 +65,7 @@ void MCSymbolELF::setBinding(unsigned Binding) const { unsigned MCSymbolELF::getBinding() const { if (isBindingSet()) { - uint32_t Val = (getFlags() & (0x3 << ELF_STB_Shift)) >> ELF_STB_Shift; + uint32_t Val = (Flags >> ELF_STB_Shift) & 3; switch (Val) { default: llvm_unreachable("Invalid value"); @@ -126,7 +125,7 @@ void MCSymbolELF::setType(unsigned Type) const { } unsigned MCSymbolELF::getType() const { - uint32_t Val = (getFlags() & (0x7 << ELF_STT_Shift)) >> ELF_STT_Shift; + uint32_t Val = (Flags >> ELF_STT_Shift) & 7; switch (Val) { default: llvm_unreachable("Invalid value"); @@ -156,9 +155,7 @@ void MCSymbolELF::setVisibility(unsigned Visibility) { } unsigned MCSymbolELF::getVisibility() const { - unsigned Visibility = (getFlags() & (0x3 << ELF_STV_Shift)) >> ELF_STV_Shift; - assert(Visibility == ELF::STV_DEFAULT || Visibility == ELF::STV_INTERNAL || - Visibility == ELF::STV_HIDDEN || Visibility == ELF::STV_PROTECTED); + unsigned Visibility = (Flags >> ELF_STV_Shift) & 3; return Visibility; } @@ -171,7 +168,7 @@ void MCSymbolELF::setOther(unsigned Other) { } unsigned MCSymbolELF::getOther() const { - unsigned Other = (getFlags() & (0x7 << ELF_STO_Shift)) >> ELF_STO_Shift; + unsigned Other = (Flags >> ELF_STO_Shift) & 7; return Other << 5; } |