[all-commits] [llvm/llvm-project] 0f7e10: [lldb] Add filter option to AST dump command (#142...

Michael Buch via All-commits all-commits at lists.llvm.org
Mon Jun 2 02:55:25 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0f7e10b0272bb297568075e73cf76abbf10db4f8
      https://github.com/llvm/llvm-project/commit/0f7e10b0272bb297568075e73cf76abbf10db4f8
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2025-06-02 (Mon, 02 Jun 2025)

  Changed paths:
    M lldb/include/lldb/Symbol/SymbolFile.h
    M lldb/include/lldb/Symbol/SymbolFileOnDemand.h
    M lldb/include/lldb/Symbol/TypeSystem.h
    M lldb/source/Commands/CommandObjectTarget.cpp
    M lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    M lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
    M lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
    M lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
    M lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
    M lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h
    M lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
    M lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
    M lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
    M lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
    M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
    M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
    M lldb/source/Symbol/SymbolFileOnDemand.cpp
    A lldb/test/Shell/Commands/command-image-dump-ast.test

  Log Message:
  -----------
  [lldb] Add filter option to AST dump command (#142164)

Depends on https://github.com/llvm/llvm-project/pull/142163

This patch makes the `-ast-dump-filter` Clang option available to the
`target modules dump ast` command. This allows us to selectively dump
parts of the AST by name.

The AST can quickly grow way too large to skim on the console. This will
aid in debugging AST related issues.

Example:
```
(lldb) target modules dump ast --filter func
Dumping clang ast for 48 modules.
Dumping func:
FunctionDecl 0xc4b785008 <<invalid sloc>> <invalid sloc> func 'void (int)' extern
|-ParmVarDecl 0xc4b7853d8 <<invalid sloc>> <invalid sloc> x 'int'
`-AsmLabelAttr 0xc4b785358 <<invalid sloc>> Implicit "_Z4funcIiEvT_"

Dumping func<int>:
FunctionDecl 0xc4b7850b8 <<invalid sloc>> <invalid sloc> func<int> 'void (int)' implicit_instantiation extern
|-TemplateArgument type 'int'
| `-BuiltinType 0xc4b85b110 'int'
`-ParmVarDecl 0xc4b7853d8 <<invalid sloc>> <invalid sloc> x 'int'
```

The majority of this patch is adjust the `Dump` API. The main change in
behaviour is in `TypeSystemClang::Dump`, where we now use the
`ASTPrinter` for dumping the `TranslationUnitDecl`. This is where the
`-ast-dump-filter` functionality lives in Clang.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list