[clang] Extend life of variables in `DiagComparison` in `ExprConstant` (PR #79522)

Vitaly Buka via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 26 11:27:21 PST 2024


================
@@ -13288,9 +13288,23 @@ EvaluateComparisonBinaryOperator(EvalInfo &Info, const BinaryOperator *E,
     // Reject differing bases from the normal codepath; we special-case
     // comparisons to null.
     if (!HasSameBase(LHSValue, RHSValue)) {
-      auto DiagComparison = [&] (unsigned DiagID, bool Reversed = false) {
-        std::string LHS = LHSValue.toString(Info.Ctx, E->getLHS()->getType());
-        std::string RHS = RHSValue.toString(Info.Ctx, E->getRHS()->getType());
+      auto DiagComparison = [&](unsigned DiagID, bool Reversed = false) {
+        static std::string LHS, RHS;
----------------
vitalybuka wrote:

They are not const, how can we make them static?

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


More information about the cfe-commits mailing list