[LLDB][NativePDB] Improve ParseDeclsForContext time.
authorZequan Wu <zequanwu@google.com>
Sat, 15 Oct 2022 00:15:02 +0000 (17:15 -0700)
committerZequan Wu <zequanwu@google.com>
Fri, 21 Oct 2022 17:33:16 +0000 (10:33 -0700)
commit9b809cc5b69a45601910bf4c60a2ece2f5462a18
tree0c60dfc1a26503374013ea1cd8d08cdc02a7d22c
parent307307456277f62f963e494de85b2b24f9c4afe2
[LLDB][NativePDB] Improve ParseDeclsForContext time.

1. When we evaluating an expression multiple times and the searching scope is translation unit, ParseDeclsForContext iterates the type info and symbol info multiple times, though only the debug info is parsed once. Using llvm::call_once to make it only iterating and parsing once.

2. When evaluating an expression with identifier whose parent scope is a namespace, ParseDeclsForContext needs to search the entire type info to complete those records whose name is prefixed with the namespace's name and the entire symbol info to to parse functions and non-local variables. Caching parsed namespaces to avoid unnecessary searching.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D136006
lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h