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

via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 25 06:10:00 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: André Brand (thebrandre)

<details>
<summary>Changes</summary>

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

---
Full diff: https://github.com/llvm/llvm-project/pull/124409.diff


1 Files Affected:

- (modified) clang/lib/AST/TextNodeDumper.cpp (+5) 


``````````diff
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) {

``````````

</details>


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


More information about the cfe-commits mailing list