[llvm] [llvm][mustache] Avoid extra copy for json strings (PR #159195)

Paul Kirth via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 9 10:51:21 PDT 2025


https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/159195

>From 3289df48b1353f342a6b4518ea19868e6f909cba Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Mon, 15 Sep 2025 19:54:34 -0700
Subject: [PATCH] [llvm][mustache] Avoid extra copy for json strings

---
 llvm/lib/Support/Mustache.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/llvm/lib/Support/Mustache.cpp b/llvm/lib/Support/Mustache.cpp
index 6fe1eaf4ce09a..708e79d39cd21 100644
--- a/llvm/lib/Support/Mustache.cpp
+++ b/llvm/lib/Support/Mustache.cpp
@@ -698,8 +698,7 @@ static void toMustacheString(const json::Value &Data, raw_ostream &OS) {
     return;
   }
   case json::Value::String: {
-    auto Str = *Data.getAsString();
-    OS << Str.str();
+    OS << *Data.getAsString();
     return;
   }
 



More information about the llvm-commits mailing list