[clang] [clang][AST] Dump saved APValue of all `VarDecl`s (PR #239672)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 6 10:53:02 PST 2026


================
@@ -2651,13 +2651,13 @@ void TextNodeDumper::VisitVarDecl(const VarDecl *D) {
 
   if (D->hasInit()) {
     const Expr *E = D->getInit();
-    // Only dump the value of constexpr VarDecls for now.
+    // Only evaluate the value of constexpr VarDecls.
     if (E && !E->isValueDependent() && D->isConstexpr() &&
-        !D->getType()->isDependentType()) {
-      const APValue *Value = D->evaluateValue();
-      if (Value)
-        AddChild("value", [=] { Visit(*Value, E->getType()); });
-    }
+        !D->getType()->isDependentType())
+      D->evaluateValue();
----------------
efriedma-quic wrote:

I don't think we want to force evaluation here at all.

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


More information about the cfe-commits mailing list