Skip to content

Commit 5fe40b9

Browse files
committed
MCExpr: Make print private
Printing an expression is error-prone without a MCAsmInfo argument. Make print private.
1 parent 8d09927 commit 5fe40b9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

llvm/include/llvm/MC/MCExpr.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ class MCSymbolRefExpr;
3333
/// needed for parsing.
3434
class MCExpr {
3535
public:
36+
// Allow MC classes to access the private `print` function.
37+
friend class MCAsmInfo;
38+
friend class MCFragment;
39+
friend class MCOperand;
3640
enum ExprKind : uint8_t {
3741
Binary, ///< Binary expressions.
3842
Constant, ///< Constant expressions.
@@ -53,6 +57,8 @@ class MCExpr {
5357
unsigned SubclassData : NumSubclassDataBits;
5458
SMLoc Loc;
5559

60+
void print(raw_ostream &OS, const MCAsmInfo *MAI,
61+
int SurroundingPrec = 0) const;
5662
bool evaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm,
5763
bool InSet) const;
5864

@@ -83,9 +89,6 @@ class MCExpr {
8389
/// \name Utility Methods
8490
/// @{
8591

86-
// TODO: Make this private. Users should call MCAsmInfo::printExpr instead.
87-
LLVM_ABI void print(raw_ostream &OS, const MCAsmInfo *MAI,
88-
int SurroundingPrec = 0) const;
8992
LLVM_ABI void dump() const;
9093

9194
/// @}

0 commit comments

Comments
 (0)