[Mlir-commits] [mlir] [mlir] Make the split markers of splitAndProcessBuffer configurable. (PR #84765)

Ingo Müller llvmlistbot at llvm.org
Wed Mar 13 05:14:09 PDT 2024


================
@@ -89,7 +88,7 @@ mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer> originalBuffer,
       hadFailure = true;
   };
   llvm::interleave(sourceBuffers, os, interleaveFn,
-                   insertMarkerInOutput ? "\n// -----\n" : "");
+                   (llvm::Twine(outputSplitMarker) + "\n").str());
----------------
ingomueller-net wrote:

I thought a bit about this. I think the trade-off is between exact preservation of previous behavior or consistency with itself. Indeed, this is a change (as described in the commit message) but the tests in this repo still all pass. I'd argue that the current formulation is consistent in that it adds the output split marker, which might be empty, plus a new line.

It's true that this makes it impossible to specify **no** separation. But if we make a special case for the empty separator, then we still introduce a implicit new line after all other separators. And I don't see a way to change that: not only would it be cumbersome to specify a new line in a command line argument, but it is outright impossible to do so at the end of a command line value because LLVM's parsing library skips over all trailing whitespace.

Anyways, I've added a sentence about the new lines to the doc. If anyone has arguments or strong feelings against the current behavior, I am happy to still change it.

https://github.com/llvm/llvm-project/pull/84765


More information about the Mlir-commits mailing list