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

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 9 23:20:16 PST 2026


Timm =?utf-8?q?B=C3=A4der?= <tbaeder at redhat.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/239672 at github.com>


================
@@ -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();
----------------
tbaederr wrote:

Not sure about that, does anyone else have an opinion? @AaronBallman?

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


More information about the cfe-commits mailing list