================
@@ -1123,11 +1120,10 @@ Block
*SymbolFileNativePDB::GetOrCreateBlock(PdbCompilandSymId block_id) {
void SymbolFileNativePDB::ParseDeclsForContext(
lldb_private::CompilerDeclContext decl_ctx) {
- TypeSystem* ts_or_err = decl_ctx.GetTypeSystem();
- if (!ts_or_err)
+ TypeSystem *ts = decl_ctx.GetTypeSystem();
+ if (!ts || !ts->GetNativePDBParser())
return;
- PdbAstBuilder* ast_builder = ts_or_err->GetNativePDBParser();
- ast_builder->ParseDeclsForContext(decl_ctx);
+ ts->GetNativePDBParser()->ParseDeclsForContext(decl_ctx);
----------------
JDevlieghere wrote:
I'm assuming the call to `GetNativePDBParser` is cheap and even if it's not,
that the compiler can optimize away the duplication, but for maintainability
and consistency I think it's better to have a temporary:
```suggestion
TypeSystem *ts = decl_ctx.GetTypeSystem();
if (!ts || !ts->GetNativePDBParser())
return;
PdbAstBuilder* ast_builder = ts->GetNativePDBParser();
if (!ast_builder)
return;
ast_builder->ParseDeclsForContext(decl_ctx);
```
https://github.com/llvm/llvm-project/pull/176065
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits