[Lldb-commits] [lldb] [WIP] [lldb][Progress] Report progress when completing types from DWARF (PR #91452)
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Wed May 8 14:35:40 PDT 2024
================
@@ -1411,3 +1414,35 @@ clang::Decl *
ClangASTImporter::ASTImporterDelegate::GetOriginalDecl(clang::Decl *To) {
return m_main.GetDeclOrigin(To).decl;
}
+
+void ClangASTImporter::ASTImporterDelegate::UpdateImportProgress(
+ clang::Decl const *From) {
+ assert(From &&
+ "Trying to report import progress using an invalid clang::Decl.");
+
+ // If we can't determine the decl's name, we don't know what to
+ // update the progress bar with. So bail out.
+ auto const *ND = dyn_cast<NamedDecl>(From);
+ if (!ND)
+ return;
+
+ if (!m_import_progress_up) {
+ auto const *from_ast =
+ TypeSystemClang::GetASTContext(&From->getASTContext());
+ auto const *to_ast = TypeSystemClang::GetASTContext(&getToContext());
+
+ assert(from_ast && to_ast);
+
+ llvm::SmallVector<llvm::StringRef> from_name_parts;
+ llvm::SplitString(from_ast->getDisplayName(), from_name_parts, "/");
+ auto from_name = from_name_parts.back();
+
+ llvm::SmallVector<llvm::StringRef> to_name_parts;
+ llvm::SplitString(to_ast->getDisplayName(), to_name_parts, "/");
----------------
Michael137 wrote:
> What does an ast's DisplayName look like?
It's one of three:
* `Expression ASTContext for '" + m_filename + "'` (expression AST)
* `scratch ASTContext`
* a module name
https://github.com/llvm/llvm-project/pull/91452
More information about the lldb-commits
mailing list