Skip to content

Commit 638d968

Browse files
authored
mlir/Presburger: guard dump function; fix buildbot (#95218)
Follow up on 76030dc (mlir/Presburger/MPInt: move into llvm/ADT) to guard a function in Fraction.h with !NDEBUG || LLVM_ENABLE_DUMP, since the call to the corresponding function in DynamicAPInt is guarded similarly. This patch fixes the build when mlir is built with this configuration.
1 parent cece0a1 commit 638d968

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

mlir/include/mlir/Analysis/Presburger/Fraction.h

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,24 @@ struct Fraction {
5252
return num / den;
5353
}
5454

55-
llvm::raw_ostream &print(llvm::raw_ostream &os) const {
56-
return os << "(" << num << "/" << den << ")";
57-
}
58-
5955
/// The numerator and denominator, respectively. The denominator is always
6056
/// positive.
6157
DynamicAPInt num{0}, den{1};
58+
59+
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
60+
llvm::raw_ostream &print(llvm::raw_ostream &os) const {
61+
return os << "(" << num << "/" << den << ")";
62+
}
63+
#endif
6264
};
6365

66+
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
67+
inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const Fraction &x) {
68+
x.print(os);
69+
return os;
70+
}
71+
#endif
72+
6473
/// Three-way comparison between two fractions.
6574
/// Returns +1, 0, and -1 if the first fraction is greater than, equal to, or
6675
/// less than the second fraction, respectively.
@@ -156,12 +165,6 @@ inline Fraction &operator*=(Fraction &x, const Fraction &y) {
156165
x = x * y;
157166
return x;
158167
}
159-
160-
inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const Fraction &x) {
161-
x.print(os);
162-
return os;
163-
}
164-
165168
} // namespace presburger
166169
} // namespace mlir
167170

0 commit comments

Comments
 (0)