[clang] [clang] Add 'instantiated_from' for enums to the output of TextNodeDumper (PR #124409)

André Brand via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 25 06:09:28 PST 2025


https://github.com/thebrandre created https://github.com/llvm/llvm-project/pull/124409

This enhances consistency with CXXRecordDecl and FunctionDecl, which also provide this information in the AST dump.

>From cf9c5e1593b1a46a4a29925ff4543e7565dcab7f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Brand?= <andre.brand at mailbox.org>
Date: Wed, 22 Jan 2025 19:23:06 +0100
Subject: [PATCH] [clang] Add 'instantiated_from' for enums to the output of
 TextNodeDumper

This enhances consistency with CXXRecordDecl and FunctionDecl, which also provide this information
---
 clang/lib/AST/TextNodeDumper.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index 670641242cae2f..7ce8e3ae95743e 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -2123,6 +2123,11 @@ void TextNodeDumper::VisitEnumDecl(const EnumDecl *D) {
     OS << " __module_private__";
   if (D->isFixed())
     dumpType(D->getIntegerType());
+
+  if (const auto *Instance = D->getInstantiatedFromMemberEnum()) {
+    OS << " instantiated_from";
+    dumpPointer(Instance);
+  }
 }
 
 void TextNodeDumper::VisitRecordDecl(const RecordDecl *D) {



More information about the cfe-commits mailing list