[Mlir-commits] [mlir] [MLIR][Presburger] Make printing aligned to assist in debugging (PR #107648)
Amy Wang
llvmlistbot at llvm.org
Wed Sep 11 16:46:46 PDT 2024
================
@@ -292,6 +294,48 @@ std::vector<Fraction> multiplyPolynomials(ArrayRef<Fraction> a,
bool isRangeZero(ArrayRef<Fraction> arr);
+struct PrintTableMetrics {
+ // If unknown, set to 0 and pass the struct into updatePrintMetrics.
+ unsigned maxPreIndent;
+ unsigned maxPostIndent;
+ // The substring expected prior to alignment.
+ std::string preAlign;
+};
+
+// Updates 'm' given a table entry val. Iterate over each val in the table
+// with .maxPreIndent and .maxPostIndent initialized to 0.
+// class T is any type that can be handled by llvm::raw_string_ostream.
+template <class T>
+void updatePrintMetrics(T val, PrintTableMetrics &m) {
+ std::string str;
+ llvm::raw_string_ostream(str) << val;
+ if (str.length() == 0)
----------------
kaitingwang wrote:
Fixed as suggested.
https://github.com/llvm/llvm-project/pull/107648
More information about the Mlir-commits
mailing list