summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCSymbolELF.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/MC/MCSymbolELF.cpp')
-rw-r--r--llvm/lib/MC/MCSymbolELF.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/MC/MCSymbolELF.cpp b/llvm/lib/MC/MCSymbolELF.cpp
index 3931f1e5721..a07c56c64f8 100644
--- a/llvm/lib/MC/MCSymbolELF.cpp
+++ b/llvm/lib/MC/MCSymbolELF.cpp
@@ -65,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");
@@ -125,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");
@@ -155,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;
}
@@ -170,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;
}
OpenPOWER on IntegriCloud