[llvm] e7dc05e - MCValue: Make print private

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 6 00:09:34 PDT 2025


Author: Fangrui Song
Date: 2025-04-06T00:09:30-07:00
New Revision: e7dc05ebcf50a620bc2307207bfd27620c6ca648

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

LOG: MCValue: Make print private

This is a debug-only feature (the relocation specifier is
target-specific and cannot be printed without backend support) and not
supposed to be used externally. PowerPC imappropriated used it
(removed by 7cb66ff4648a15741a1908658dfef5cb3d4a9199).

Added: 
    

Modified: 
    llvm/include/llvm/MC/MCValue.h
    llvm/lib/MC/MCValue.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/MC/MCValue.h b/llvm/include/llvm/MC/MCValue.h
index 67793a1759e60..fd6da9955e3e2 100644
--- a/llvm/include/llvm/MC/MCValue.h
+++ b/llvm/include/llvm/MC/MCValue.h
@@ -32,6 +32,11 @@ class MCValue {
   int64_t Cst = 0;
   uint32_t Specifier = 0;
 
+  void print(raw_ostream &OS) const;
+
+  /// Print the value to stderr.
+  void dump() const;
+
 public:
   friend class MCAssembler;
   friend class MCExpr;
@@ -47,12 +52,6 @@ class MCValue {
   /// Is this an absolute (as opposed to relocatable) value.
   bool isAbsolute() const { return !SymA && !SymB; }
 
-  /// Print the value to the stream \p OS.
-  void print(raw_ostream &OS) const;
-
-  /// Print the value to stderr.
-  void dump() const;
-
   static MCValue get(const MCSymbol *SymA, const MCSymbol *SymB = nullptr,
                      int64_t Val = 0, uint32_t Specifier = 0) {
     MCValue R;

diff  --git a/llvm/lib/MC/MCValue.cpp b/llvm/lib/MC/MCValue.cpp
index 77deb0b4ab671..04bd65b8aefed 100644
--- a/llvm/lib/MC/MCValue.cpp
+++ b/llvm/lib/MC/MCValue.cpp
@@ -24,8 +24,8 @@ void MCValue::print(raw_ostream &OS) const {
 
   // FIXME: prints as a number, which isn't ideal. But the meaning will be
   // target-specific anyway.
-  if (getRefKind())
-    OS << ':' << getRefKind() <<  ':';
+  if (getSpecifier())
+    OS << ':' << getSpecifier() << ':';
 
   SymA->print(OS, nullptr);
 


        


More information about the llvm-commits mailing list