[llvm] [DebugInfo] Add macro tracking support to DebugInfoFinder (PR #179931)

Manuel Carrasco via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 5 06:30:12 PST 2026


================
@@ -275,6 +278,36 @@ void DebugInfoFinder::processImportedEntity(const DIImportedEntity *Import) {
     processScope(M->getScope());
 }
 
+// Process a macro debug info node (DIMacroNode).
+//
+// A DIMacroNode is one of two types:
+//   - DIMacro: A single macro definition. Add it to the Macros list along with
+//     its containing DIMacroFile.
+//   - DIMacroFile: A file containing macros. Recursively process all nested
+//     macro nodes within it (avoiding duplicates by tracking visited nodes).
+void DebugInfoFinder::processMacroNode(DIMacroNode *Macro,
+                                       DIMacroFile *CurrentMacroFile) {
+  if (!Macro)
+    return;
+
+  if (auto *M = dyn_cast<DIMacro>(Macro)) {
+    addMacro(M, CurrentMacroFile);
+    return;
+  }
+
+  if (auto *MF = dyn_cast<DIMacroFile>(Macro)) {
----------------
mgcarrasco wrote:

Thanks, solved in addition to the comments suggestion.

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


More information about the llvm-commits mailing list