avogelsgesang created this revision. avogelsgesang added reviewers: labath, aprantl. Herald added a subscriber: ChuanqiXu. Herald added a project: All. avogelsgesang requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits.
The pretty printer for `std::coroutine_handle` was running into > Assertion failed: (target_ctx != source_ctx && "Can't import into itself") from ClangASTImporter.h, line 270. This commit fixes the issue by removing the `CopyType` call from the pretty printer. While this call was necessary in the past, it seems to be no longer required, at least all test cases are still passing. Maybe something changed in the meantime around the handling of `TypesystemClang` instances. I don't quite understand why `CopyType` was necessary earlier. I am not sure how to add a regression test for this, though. It seems the issue is already triggered by the exising `TestCoroutineHandle.py`, but API tests seem to ignore all violations of `lldbassert` and still report the test as "passed", even if assertions were triggered Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D143127 Files: lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp lldb/source/Plugins/Language/CPlusPlus/Coroutines.h Index: lldb/source/Plugins/Language/CPlusPlus/Coroutines.h =================================================================== --- lldb/source/Plugins/Language/CPlusPlus/Coroutines.h +++ lldb/source/Plugins/Language/CPlusPlus/Coroutines.h @@ -16,8 +16,6 @@ namespace lldb_private { -class ClangASTImporter; - namespace formatters { /// Summary provider for `std::coroutine_handle<T>` from libc++, libstdc++ and @@ -50,7 +48,6 @@ lldb::ValueObjectSP m_resume_ptr_sp; lldb::ValueObjectSP m_destroy_ptr_sp; lldb::ValueObjectSP m_promise_ptr_sp; - std::unique_ptr<lldb_private::ClangASTImporter> m_ast_importer; }; SyntheticChildrenFrontEnd * Index: lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp =================================================================== --- lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp +++ lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp @@ -8,7 +8,6 @@ #include "Coroutines.h" -#include "Plugins/ExpressionParser/Clang/ClangASTImporter.h" #include "Plugins/TypeSystem/Clang/TypeSystemClang.h" #include "lldb/Symbol/Function.h" #include "lldb/Symbol/VariableList.h" @@ -97,8 +96,7 @@ lldb_private::formatters::StdlibCoroutineHandleSyntheticFrontEnd:: StdlibCoroutineHandleSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp) - : SyntheticChildrenFrontEnd(*valobj_sp), - m_ast_importer(std::make_unique<ClangASTImporter>()) { + : SyntheticChildrenFrontEnd(*valobj_sp) { if (valobj_sp) Update(); } @@ -174,8 +172,7 @@ if (Function *destroy_func = ExtractDestroyFunction(target_sp, frame_ptr_addr)) { if (CompilerType inferred_type = InferPromiseType(*destroy_func)) { - // Copy the type over to the correct `TypeSystemClang` instance - promise_type = m_ast_importer->CopyType(*ast_ctx, inferred_type); + promise_type = inferred_type; } } }
Index: lldb/source/Plugins/Language/CPlusPlus/Coroutines.h =================================================================== --- lldb/source/Plugins/Language/CPlusPlus/Coroutines.h +++ lldb/source/Plugins/Language/CPlusPlus/Coroutines.h @@ -16,8 +16,6 @@ namespace lldb_private { -class ClangASTImporter; - namespace formatters { /// Summary provider for `std::coroutine_handle<T>` from libc++, libstdc++ and @@ -50,7 +48,6 @@ lldb::ValueObjectSP m_resume_ptr_sp; lldb::ValueObjectSP m_destroy_ptr_sp; lldb::ValueObjectSP m_promise_ptr_sp; - std::unique_ptr<lldb_private::ClangASTImporter> m_ast_importer; }; SyntheticChildrenFrontEnd * Index: lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp =================================================================== --- lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp +++ lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp @@ -8,7 +8,6 @@ #include "Coroutines.h" -#include "Plugins/ExpressionParser/Clang/ClangASTImporter.h" #include "Plugins/TypeSystem/Clang/TypeSystemClang.h" #include "lldb/Symbol/Function.h" #include "lldb/Symbol/VariableList.h" @@ -97,8 +96,7 @@ lldb_private::formatters::StdlibCoroutineHandleSyntheticFrontEnd:: StdlibCoroutineHandleSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp) - : SyntheticChildrenFrontEnd(*valobj_sp), - m_ast_importer(std::make_unique<ClangASTImporter>()) { + : SyntheticChildrenFrontEnd(*valobj_sp) { if (valobj_sp) Update(); } @@ -174,8 +172,7 @@ if (Function *destroy_func = ExtractDestroyFunction(target_sp, frame_ptr_addr)) { if (CompilerType inferred_type = InferPromiseType(*destroy_func)) { - // Copy the type over to the correct `TypeSystemClang` instance - promise_type = m_ast_importer->CopyType(*ast_ctx, inferred_type); + promise_type = inferred_type; } } }
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits