[lld] b07ef4d - [ELF] Rename Symbol::compare to shouldReplace. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 28 10:25:28 PST 2022


Author: Fangrui Song
Date: 2022-02-28T18:25:21Z
New Revision: b07ef4d566c702ff5d71a8e6b1274a7b3c47eb4c

URL: https://github.com/llvm/llvm-project/commit/b07ef4d566c702ff5d71a8e6b1274a7b3c47eb4c
DIFF: https://github.com/llvm/llvm-project/commit/b07ef4d566c702ff5d71a8e6b1274a7b3c47eb4c.diff

LOG: [ELF] Rename Symbol::compare to shouldReplace. NFC

The return value is not a boolean instead of a tri-state.
Suggested by Peter Smith in D120640.

Added: 
    

Modified: 
    lld/ELF/Symbols.cpp
    lld/ELF/Symbols.h

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index 484ad8ea27e6d..8b74725c42cff 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -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");
@@ -605,7 +605,7 @@ void Symbol::resolveCommon(const CommonSymbol &other) {
 }
 
 void Symbol::resolveDefined(const Defined &other) {
-  if (compare(other))
+  if (shouldReplace(other))
     replace(other);
 }
 

diff  --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h
index b210659f9a355..661e0cb5cb526 100644
--- a/lld/ELF/Symbols.h
+++ b/lld/ELF/Symbols.h
@@ -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;
 


        


More information about the llvm-commits mailing list