Skip to content

Commit

Permalink
[ELF] Rename Symbol::compare to shouldReplace. NFC
Browse files Browse the repository at this point in the history
The return value is not a boolean instead of a tri-state.
Suggested by Peter Smith in D120640.
  • Loading branch information
MaskRay committed Feb 28, 2022
1 parent 3906ebf commit b07ef4d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lld/ELF/Symbols.cpp
Expand Up @@ -508,7 +508,7 @@ void Symbol::resolveUndefined(const Undefined &other) {
}

// Compare two symbols. Return true if the new symbol should win.
bool Symbol::compare(const Defined &other) const {
bool Symbol::shouldReplace(const Defined &other) const {
if (LLVM_UNLIKELY(isCommon())) {
if (config->warnCommon)
warn("common " + getName() + " is overridden");
Expand Down Expand Up @@ -605,7 +605,7 @@ void Symbol::resolveCommon(const CommonSymbol &other) {
}

void Symbol::resolveDefined(const Defined &other) {
if (compare(other))
if (shouldReplace(other))
replace(other);
}

Expand Down
2 changes: 1 addition & 1 deletion lld/ELF/Symbols.h
Expand Up @@ -228,7 +228,7 @@ class Symbol {
void resolveLazy(const LazyObject &other);
void resolveShared(const SharedSymbol &other);

bool compare(const Defined &other) const;
bool shouldReplace(const Defined &other) const;

inline size_t getSymbolSize() const;

Expand Down

0 comments on commit b07ef4d

Please sign in to comment.