[llvm] [llvm] fix mustache template whitespace (PR #153724)
Paul Kirth via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 26 10:48:04 PDT 2025
================
@@ -681,10 +685,59 @@ void ASTNode::renderChild(const json::Value &Contexts, llvm::raw_ostream &OS) {
Child->render(Contexts, OS);
}
+void ASTNode::indentTextNode(std::string &Body, size_t Indentation,
+ bool FinalNode) {
+ std::string spaces(Indentation, ' ');
+ size_t pos = 0;
+ size_t LastChar = std::string::npos;
+
+ if (FinalNode)
+ // body.erase(body.find_last_not_of(" \t\r\f\v") + 1);
+ LastChar = Body.find_last_not_of(" \t\r\f\v");
+
+ while ((pos = Body.find('\n', pos)) != std::string::npos) {
+ if ((!FinalNode) || (pos != LastChar)) {
+ Body.insert(pos + 1, spaces);
+ pos += 1 + Indentation;
+ } else {
+ break;
+ }
+ }
+}
+
+void ASTNode::indentNodes(ASTNode *Node, bool isPartial) {
----------------
ilovepi wrote:
nit: IsPartial
https://github.com/llvm/llvm-project/pull/153724
More information about the llvm-commits
mailing list