ELF2: Rename getMostConstrainingVisibility -> getVisibility. NFC.

The previous name was too long.

llvm-svn: 250920
This commit is contained in:
Rui Ueyama 2015-10-21 18:13:47 +00:00
parent 3fd13f0665
commit 8f2c4da65a
3 changed files with 10 additions and 14 deletions

View File

@ -573,7 +573,7 @@ bool lld::elf2::canBePreempted(const SymbolBody *Body, bool NeedsGot) {
} }
if (!Config->Shared) if (!Config->Shared)
return false; return false;
return Body->getMostConstrainingVisibility() == STV_DEFAULT; return Body->getVisibility() == STV_DEFAULT;
} }
template <class ELFT> void OutputSection<ELFT>::writeTo(uint8_t *Buf) { template <class ELFT> void OutputSection<ELFT>::writeTo(uint8_t *Buf) {
@ -645,7 +645,7 @@ template <class ELFT> bool lld::elf2::includeInSymtab(const SymbolBody &B) {
} }
bool lld::elf2::includeInDynamicSymtab(const SymbolBody &B) { bool lld::elf2::includeInDynamicSymtab(const SymbolBody &B) {
uint8_t V = B.getMostConstrainingVisibility(); uint8_t V = B.getVisibility();
if (V != STV_DEFAULT && V != STV_PROTECTED) if (V != STV_DEFAULT && V != STV_PROTECTED)
return false; return false;
@ -803,7 +803,7 @@ void SymbolTableSection<ELFT>::writeGlobalSymbols(uint8_t *Buf) {
ESym->setBindingAndType(getSymbolBinding(Body), Type); ESym->setBindingAndType(getSymbolBinding(Body), Type);
ESym->st_size = Size; ESym->st_size = Size;
ESym->setVisibility(Body->getMostConstrainingVisibility()); ESym->setVisibility(Body->getVisibility());
ESym->st_value = getSymVA<ELFT>(*Body); ESym->st_value = getSymVA<ELFT>(*Body);
if (Section) if (Section)
@ -820,7 +820,7 @@ void SymbolTableSection<ELFT>::writeGlobalSymbols(uint8_t *Buf) {
template <class ELFT> template <class ELFT>
uint8_t SymbolTableSection<ELFT>::getSymbolBinding(SymbolBody *Body) { uint8_t SymbolTableSection<ELFT>::getSymbolBinding(SymbolBody *Body) {
uint8_t Visibility = Body->getMostConstrainingVisibility(); uint8_t Visibility = Body->getVisibility();
if (Visibility != STV_DEFAULT && Visibility != STV_PROTECTED) if (Visibility != STV_DEFAULT && Visibility != STV_PROTECTED)
return STB_LOCAL; return STB_LOCAL;
if (const auto *EBody = dyn_cast<ELFSymbolBody<ELFT>>(Body)) if (const auto *EBody = dyn_cast<ELFSymbolBody<ELFT>>(Body))

View File

@ -40,10 +40,8 @@ template <class ELFT> int SymbolBody::compare(SymbolBody *Other) {
if (L > R) if (L > R)
return -Other->compare<ELFT>(this); return -Other->compare<ELFT>(this);
uint8_t LV = getMostConstrainingVisibility(); Visibility = Other->Visibility =
uint8_t RV = Other->getMostConstrainingVisibility(); getMinVisibility(Visibility, Other->Visibility);
MostConstrainingVisibility = getMinVisibility(LV, RV);
Other->MostConstrainingVisibility = MostConstrainingVisibility;
IsUsedInRegularObj |= Other->IsUsedInRegularObj; IsUsedInRegularObj |= Other->IsUsedInRegularObj;
Other->IsUsedInRegularObj |= IsUsedInRegularObj; Other->IsUsedInRegularObj |= IsUsedInRegularObj;

View File

@ -83,9 +83,7 @@ public:
// Returns the symbol name. // Returns the symbol name.
StringRef getName() const { return Name; } StringRef getName() const { return Name; }
uint8_t getMostConstrainingVisibility() const { uint8_t getVisibility() const { return Visibility; }
return MostConstrainingVisibility;
}
unsigned getDynamicSymbolTableIndex() const { unsigned getDynamicSymbolTableIndex() const {
return DynamicSymbolTableIndex; return DynamicSymbolTableIndex;
@ -116,15 +114,15 @@ public:
protected: protected:
SymbolBody(Kind K, StringRef Name, bool IsWeak, uint8_t Visibility, SymbolBody(Kind K, StringRef Name, bool IsWeak, uint8_t Visibility,
bool IsTLS) bool IsTLS)
: SymbolKind(K), IsWeak(IsWeak), MostConstrainingVisibility(Visibility), : SymbolKind(K), IsWeak(IsWeak), Visibility(Visibility), IsTLS(IsTLS),
IsTLS(IsTLS), Name(Name) { Name(Name) {
IsUsedInRegularObj = K != SharedKind && K != LazyKind; IsUsedInRegularObj = K != SharedKind && K != LazyKind;
IsUsedInDynamicReloc = 0; IsUsedInDynamicReloc = 0;
} }
const unsigned SymbolKind : 8; const unsigned SymbolKind : 8;
unsigned IsWeak : 1; unsigned IsWeak : 1;
unsigned MostConstrainingVisibility : 2; unsigned Visibility : 2;
unsigned IsUsedInRegularObj : 1; unsigned IsUsedInRegularObj : 1;
unsigned IsUsedInDynamicReloc : 1; unsigned IsUsedInDynamicReloc : 1;
unsigned IsTLS : 1; unsigned IsTLS : 1;