[Lldb-commits] [lldb] [lldb][NativePDB] Reuse the method decl added while completing the class (PR #227010)

via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 28 07:54:55 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Charles Zablit (charles-zablit)

<details>
<summary>Changes</summary>

`PdbAstBuilderClang::CreateFunctionDecl` returned `nullptr` for a method that `UdtRecordCompleter` had already added to its class. Because of this, the `Function` of any method whose class was completed first had no decl and no decl context. `GetOrCreateDeclContextForUid` then passed that null `DeclContext` to `TypeSystemClang::CreateDeclContext`, which asserts:

```
Assertion failed: Val && "isa<> used on a null pointer"
...
lldb_private::TypeSystemClang::CreateDeclContext
lldb_private::npdb::PdbAstBuilderClang::GetOrCreateDeclContextForUid
lldb_private::npdb::SymbolFileNativePDB::GetDeclContextForUID
lldb_private::Function::GetDeclContext
lldb_private::ClangExpressionDeclMap::LookupFunction
```

Look up the existing `CXXMethodDecl` by name and type and return it instead, and make `ToCompilerDeclContext` return an invalid `CompilerDeclContext` for a null `DeclContext` rather than handing it to `CreateDeclContext`.

With PDB debug info this fixes the crashes in:
- `TestCppOperators`
- `TestCppMultipleInheritance`
- `TestCPPEnumPromotion`
- `TestExprInConstVolatileMethod`
- `TestExprInConstMethodWithFixit`
- `TestDataFormatterCategories`
- `TestDataFormatterSynthVal`

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


1 Files Affected:

- (modified) lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilderClang.cpp (+16-2) 


``````````diff
The server is unavailable at this time. Please wait a few minutes before you try again.
``````````

</details>


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


More information about the lldb-commits mailing list