Index: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp =================================================================== --- lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp +++ lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp @@ -174,6 +174,99 @@ return ret; } +/// Return true if the given QualType should be desugared to remove any +/// references to complex module declarations that the ClangASTImporter/ +/// ASTImporter might not handle. +static bool shouldDesugarModuleType(clang::ASTContext &ast, const QualType qt) { + const clang::Type *type = qt.getTypePtrOrNull(); + if (!type) + return false; + + // ElaboratedType is just type sugar describing how the type was referred to + // by the user. This should be preserved unless the underlying type has + // references to module declarations. This way expressions like + // `(std::size_t)1` will actually evaluate to `std::size_t` and not `size_t`. + if (const auto *et = dyn_cast(type)) { + QualType underlying(et->getLocallyUnqualifiedSingleStepDesugaredType()); + // It should always be possible to desugar an ElaboratedType. Assert as + // this would otherwise infinitely recurse. + assert(underlying != qt && "Can't desugar ElaboratedType?"); + return shouldDesugarModuleType(ast, underlying); + } + + // If the type is substituting a type template parameter and that parameter + // comes from a module, then desugar it to prevent importing the whole + // template. This is mostly used for FieldDecls in STL templates that often + // have this type (e.g., 'first' in std::pair is a SubstTemplateTypeParmType). + if (const auto *templ_type = dyn_cast(type)) { + if (templ_type->getReplacedParameter()->getDecl()->isFromASTFile()) + return true; + } + + // Typedefs can pull in a lot of complicated declarations as they are + // declared inside them (e.g., the 'value_type' typedefs in STL containers + // will pull in the whole container and all related declarations). Desugar + // them to the underlying type, e.g., 'std::vector::value_type' -> 'int'. + if (const auto *typedef_type = dyn_cast(type)) { + clang::TypedefNameDecl *decl = typedef_type->getDecl(); + clang::DeclContext *decl_context = decl->getDeclContext(); + + // Check for builtin type typedefs like (e.g., size_t) there is no need to + // desugar them if they are just in a namespace/TU (which both can safely + // be imported by the ASTImporter). + if (decl->getUnderlyingType().getDesugaredType(ast)->isBuiltinType() && + decl_context->isFileContext()) + return false; + + // Check if this is typedef is inside a any TagDecl/template that came from + // a C++ module. If yes, then we have to desugar to get rid of the + // reference to that module declaration. + while (!decl_context->isTranslationUnit()) { + if (Decl *d = dyn_cast(decl_context)) { + // Check if the current parent DeclContext is any TagDecl from a C++ + // module. + if (isa(d) && d->isFromASTFile()) + return true; + // If the template was instantiated implicitly in the expression, then + // the ClassTemplateSpecializationDecl isn't marked as coming from a + // module (as it was created in the expression). In this case check + // the specialized template if it came from a module. + if (auto *ct = dyn_cast(d)) { + if (ct->getSpecializedTemplate()->isFromASTFile()) + return true; + } + } + decl_context = decl_context->getParent(); + } + } + + return false; +} + +/// Desugars the QualType until it is either free of references to complicated +/// declarations that the ASTImporter might not be able to handle (or until +/// the type can't be further desugared) +/// +/// For example the type 'std::__1::deque >::size_type' which requires importing +/// a large amount of templates will be desugared to simply 'size_t' (which +/// requires only a few declarations). +static TypeFromParser desugarModuleTypes(TypeFromParser in) { + TypeSystemClang *ts = static_cast(in.GetTypeSystem()); + // Nothing to do if we are not in an AST with enabled modules. + if (!ts->getASTContext().getLangOpts().Modules) + return in; + QualType qt = ClangUtil::GetQualType(in); + // Keep desugaring until we reach a type that is safe to copy. + while (shouldDesugarModuleType(ts->getASTContext(), qt)) { + QualType old_qt = qt; + qt = qt.getSingleStepDesugaredType(ts->getASTContext()); + if (qt == old_qt) + break; + } + return TypeFromParser(ts->GetType(qt)); +} + TypeFromUser ClangExpressionDeclMap::DeportType(TypeSystemClang &target, TypeSystemClang &source, TypeFromParser parser_type) { @@ -181,6 +274,8 @@ assert((TypeSystem *)&source == parser_type.GetTypeSystem()); assert(&source.getASTContext() == m_ast_context); + // Simplify the type before deporting it to the scratch context. + parser_type = desugarModuleTypes(parser_type); return TypeFromUser(m_ast_importer_sp->DeportType(target, parser_type)); } Index: lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py =================================================================== --- lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py +++ lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py @@ -20,18 +20,18 @@ self.runCmd("settings set target.import-std-module true") - self.expect_expr("(size_t)a.size()", result_type="size_t", result_value="3") - self.expect_expr("(int)a.front()", result_type="int", result_value="3") - self.expect_expr("(int)a.back()", result_type="int", result_value="2") + self.expect_expr("a.size()", result_type="size_t", result_value="3") + self.expect_expr("a.front()", result_type="int", result_value="3") + self.expect_expr("a.back()", result_type="int", result_value="2") self.expect("expr std::sort(a.begin(), a.end())") - self.expect_expr("(int)a.front()", result_type="int", result_value="1") - self.expect_expr("(int)a.back()", result_type="int", result_value="3") + self.expect_expr("a.front()", result_type="int", result_value="1") + self.expect_expr("a.back()", result_type="int", result_value="3") self.expect("expr std::reverse(a.begin(), a.end())") - self.expect_expr("(int)a.front()", result_type="int", result_value="3") - self.expect_expr("(int)a.back()", result_type="int", result_value="1") + self.expect_expr("a.front()", result_type="int", result_value="3") + self.expect_expr("a.back()", result_type="int", result_value="1") - self.expect_expr("(int)(*a.begin())", result_type="int", result_value="3") - self.expect_expr("(int)(*a.rbegin())", result_type="int", result_value="1") + self.expect_expr("*a.begin()", result_type="int", result_value="3") + self.expect_expr("*a.rbegin()", result_type="int", result_value="1") Index: lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py =================================================================== --- lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py +++ lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py @@ -20,14 +20,14 @@ self.runCmd("settings set target.import-std-module true") - self.expect("expr (size_t)a.size()", substrs=['(size_t) $0 = 3']) - self.expect("expr (int)a.front().a", substrs=['(int) $1 = 3']) - self.expect("expr (int)a.back().a", substrs=['(int) $2 = 2']) + self.expect("expr a.size()", substrs=['(size_t) $0 = 3']) + self.expect("expr a.front().a", substrs=['(int) $1 = 3']) + self.expect("expr a.back().a", substrs=['(int) $2 = 2']) self.expect("expr std::reverse(a.begin(), a.end())") - self.expect("expr (int)a.front().a", substrs=['(int) $3 = 2']) - self.expect("expr (int)a.back().a", substrs=['(int) $4 = 3']) + self.expect("expr a.front().a", substrs=['(int) $3 = 2']) + self.expect("expr a.back().a", substrs=['(int) $4 = 3']) - self.expect("expr (int)(a.begin()->a)", substrs=['(int) $5 = 2']) - self.expect("expr (int)(a.rbegin()->a)", substrs=['(int) $6 = 3']) + self.expect("expr a.begin()->a", substrs=['(int) $5 = 2']) + self.expect("expr a.rbegin()->a", substrs=['(int) $6 = 3']) Index: lldb/test/API/commands/expression/import-std-module/empty-module/TestEmptyStdModule.py =================================================================== --- lldb/test/API/commands/expression/import-std-module/empty-module/TestEmptyStdModule.py +++ lldb/test/API/commands/expression/import-std-module/empty-module/TestEmptyStdModule.py @@ -36,4 +36,4 @@ self.expect("expr MissingContent var = 3; var", substrs=['$0 = 3']) # Try to access our mock std::vector. This should fail but not crash LLDB as the # std::vector template should be missing from the std module. - self.expect("expr (size_t)v.size()", substrs=["Couldn't lookup symbols"], error=True) + self.expect("expr v.size()", substrs=["Couldn't lookup symbols"], error=True) Index: lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py =================================================================== --- lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py +++ lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py @@ -20,8 +20,8 @@ self.runCmd("settings set target.import-std-module true") - self.expect("expr (size_t)std::distance(a.begin(), a.end())", substrs=['(size_t) $0 = 3']) - self.expect("expr (int)a.front().a", substrs=['(int) $1 = 3']) + self.expect("expr std::distance(a.begin(), a.end())", substrs=['(ptrdiff_t) $0 = 3']) + self.expect("expr a.front().a", substrs=['(int) $1 = 3']) - self.expect("expr (int)(a.begin()->a)", substrs=['(int) $2 = 3']) + self.expect("expr a.begin()->a", substrs=['(int) $2 = 3']) Index: lldb/test/API/commands/expression/import-std-module/forward_list/TestForwardListFromStdModule.py =================================================================== --- lldb/test/API/commands/expression/import-std-module/forward_list/TestForwardListFromStdModule.py +++ lldb/test/API/commands/expression/import-std-module/forward_list/TestForwardListFromStdModule.py @@ -20,11 +20,11 @@ self.runCmd("settings set target.import-std-module true") - self.expect("expr (size_t)std::distance(a.begin(), a.end())", substrs=['(size_t) $0 = 3']) - self.expect("expr (int)a.front()", substrs=['(int) $1 = 3']) + self.expect("expr std::distance(a.begin(), a.end())", substrs=['(ptrdiff_t) $0 = 3']) + self.expect("expr a.front()", substrs=['(int) $1 = 3']) self.expect("expr a.sort()") - self.expect("expr (int)a.front()", substrs=['(int) $2 = 1']) + self.expect("expr a.front()", substrs=['(int) $2 = 1']) - self.expect("expr (int)(*a.begin())", substrs=['(int) $3 = 1']) + self.expect("expr *a.begin()", substrs=['(int) $3 = 1']) Index: lldb/test/API/commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentListFromStdModule.py =================================================================== --- lldb/test/API/commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentListFromStdModule.py +++ lldb/test/API/commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentListFromStdModule.py @@ -21,14 +21,14 @@ self.runCmd("settings set target.import-std-module true") - self.expect("expr (size_t)a.size()", substrs=['(size_t) $0 = 3']) - self.expect("expr (int)a.front().a", substrs=['(int) $1 = 3']) - self.expect("expr (int)a.back().a", substrs=['(int) $2 = 2']) + self.expect("expr a.size()", substrs=['(size_t) $0 = 3']) + self.expect("expr a.front().a", substrs=['(int) $1 = 3']) + self.expect("expr a.back().a", substrs=['(int) $2 = 2']) self.expect("expr std::reverse(a.begin(), a.end())") - self.expect("expr (int)a.front().a", substrs=['(int) $3 = 2']) - self.expect("expr (int)a.back().a", substrs=['(int) $4 = 3']) + self.expect("expr a.front().a", substrs=['(int) $3 = 2']) + self.expect("expr a.back().a", substrs=['(int) $4 = 3']) - self.expect("expr (int)(a.begin()->a)", substrs=['(int) $5 = 2']) - self.expect("expr (int)(a.rbegin()->a)", substrs=['(int) $6 = 3']) + self.expect("expr a.begin()->a", substrs=['(int) $5 = 2']) + self.expect("expr a.rbegin()->a", substrs=['(int) $6 = 3']) Index: lldb/test/API/commands/expression/import-std-module/list/TestListFromStdModule.py =================================================================== --- lldb/test/API/commands/expression/import-std-module/list/TestListFromStdModule.py +++ lldb/test/API/commands/expression/import-std-module/list/TestListFromStdModule.py @@ -20,18 +20,18 @@ self.runCmd("settings set target.import-std-module true") - self.expect("expr (size_t)a.size()", substrs=['(size_t) $0 = 3']) - self.expect("expr (int)a.front()", substrs=['(int) $1 = 3']) - self.expect("expr (int)a.back()", substrs=['(int) $2 = 2']) + self.expect("expr a.size()", substrs=['(size_t) $0 = 3']) + self.expect("expr a.front()", substrs=['(int) $1 = 3']) + self.expect("expr a.back()", substrs=['(int) $2 = 2']) self.expect("expr a.sort()") - self.expect("expr (int)a.front()", substrs=['(int) $3 = 1']) - self.expect("expr (int)a.back()", substrs=['(int) $4 = 3']) + self.expect("expr a.front()", substrs=['(int) $3 = 1']) + self.expect("expr a.back()", substrs=['(int) $4 = 3']) self.expect("expr std::reverse(a.begin(), a.end())") - self.expect("expr (int)a.front()", substrs=['(int) $5 = 3']) - self.expect("expr (int)a.back()", substrs=['(int) $6 = 1']) + self.expect("expr a.front()", substrs=['(int) $5 = 3']) + self.expect("expr a.back()", substrs=['(int) $6 = 1']) - self.expect("expr (int)(*a.begin())", substrs=['(int) $7 = 3']) - self.expect("expr (int)(*a.rbegin())", substrs=['(int) $8 = 1']) + self.expect("expr *a.begin()", substrs=['(int) $7 = 3']) + self.expect("expr *a.rbegin()", substrs=['(int) $8 = 1']) Index: lldb/test/API/commands/expression/import-std-module/queue/TestQueueFromStdModule.py =================================================================== --- lldb/test/API/commands/expression/import-std-module/queue/TestQueueFromStdModule.py +++ lldb/test/API/commands/expression/import-std-module/queue/TestQueueFromStdModule.py @@ -23,21 +23,21 @@ # Test std::queue functionality with a std::deque. self.expect("expr q_deque.pop()") self.expect("expr q_deque.push({4})") - self.expect("expr (size_t)q_deque.size()", substrs=['(size_t) $0 = 1']) - self.expect("expr (int)q_deque.front().i", substrs=['(int) $1 = 4']) - self.expect("expr (int)q_deque.back().i", substrs=['(int) $2 = 4']) + self.expect("expr q_deque.size()", substrs=['(size_t) $0 = 1']) + self.expect("expr q_deque.front().i", substrs=['(int) $1 = 4']) + self.expect("expr q_deque.back().i", substrs=['(int) $2 = 4']) self.expect("expr q_deque.empty()", substrs=['(bool) $3 = false']) self.expect("expr q_deque.pop()") self.expect("expr q_deque.emplace(5)") - self.expect("expr (int)q_deque.front().i", substrs=['(int) $4 = 5']) + self.expect("expr q_deque.front().i", substrs=['(int) $4 = 5']) # Test std::queue functionality with a std::list. self.expect("expr q_list.pop()") self.expect("expr q_list.push({4})") - self.expect("expr (size_t)q_list.size()", substrs=['(size_t) $5 = 1']) - self.expect("expr (int)q_list.front().i", substrs=['(int) $6 = 4']) - self.expect("expr (int)q_list.back().i", substrs=['(int) $7 = 4']) + self.expect("expr q_list.size()", substrs=['(size_t) $5 = 1']) + self.expect("expr q_list.front().i", substrs=['(int) $6 = 4']) + self.expect("expr q_list.back().i", substrs=['(int) $7 = 4']) self.expect("expr q_list.empty()", substrs=['(bool) $8 = false']) self.expect("expr q_list.pop()") self.expect("expr q_list.emplace(5)") - self.expect("expr (int)q_list.front().i", substrs=['(int) $9 = 5']) + self.expect("expr q_list.front().i", substrs=['(int) $9 = 5']) Index: lldb/test/API/commands/expression/import-std-module/shared_ptr-dbg-info-content/TestSharedPtrDbgInfoContentFromStdModule.py =================================================================== --- lldb/test/API/commands/expression/import-std-module/shared_ptr-dbg-info-content/TestSharedPtrDbgInfoContentFromStdModule.py +++ lldb/test/API/commands/expression/import-std-module/shared_ptr-dbg-info-content/TestSharedPtrDbgInfoContentFromStdModule.py @@ -20,9 +20,9 @@ self.runCmd("settings set target.import-std-module true") - self.expect("expr (int)s->a", substrs=['(int) $0 = 3']) - self.expect("expr (int)(s->a = 5)", substrs=['(int) $1 = 5']) - self.expect("expr (int)s->a", substrs=['(int) $2 = 5']) + self.expect("expr s->a", substrs=['(int) $0 = 3']) + self.expect("expr s->a = 5", substrs=['(int) $1 = 5']) + self.expect("expr s->a", substrs=['(int) $2 = 5']) self.expect("expr (bool)s", substrs=['(bool) $3 = true']) self.expect("expr s.reset()") self.expect("expr (bool)s", substrs=['(bool) $4 = false']) Index: lldb/test/API/commands/expression/import-std-module/shared_ptr/TestSharedPtrFromStdModule.py =================================================================== --- lldb/test/API/commands/expression/import-std-module/shared_ptr/TestSharedPtrFromStdModule.py +++ lldb/test/API/commands/expression/import-std-module/shared_ptr/TestSharedPtrFromStdModule.py @@ -20,9 +20,9 @@ self.runCmd("settings set target.import-std-module true") - self.expect("expr (int)*s", substrs=['(int) $0 = 3']) - self.expect("expr (int)(*s = 5)", substrs=['(int) $1 = 5']) - self.expect("expr (int)*s", substrs=['(int) $2 = 5']) + self.expect("expr *s", substrs=['(int) $0 = 3']) + self.expect("expr *s = 5", substrs=['(int) $1 = 5']) + self.expect("expr *s", substrs=['(int) $2 = 5']) self.expect("expr (bool)s", substrs=['(bool) $3 = true']) self.expect("expr s.reset()") self.expect("expr (bool)s", substrs=['(bool) $4 = false']) Index: lldb/test/API/commands/expression/import-std-module/stack/TestStackFromStdModule.py =================================================================== --- lldb/test/API/commands/expression/import-std-module/stack/TestStackFromStdModule.py +++ lldb/test/API/commands/expression/import-std-module/stack/TestStackFromStdModule.py @@ -23,23 +23,23 @@ # Test std::stack functionality with a std::deque. self.expect("expr s_deque.pop()") self.expect("expr s_deque.push({4})") - self.expect("expr (size_t)s_deque.size()", substrs=['(size_t) $0 = 3']) - self.expect("expr (int)s_deque.top().i", substrs=['(int) $1 = 4']) + self.expect("expr s_deque.size()", substrs=['(size_t) $0 = 3']) + self.expect("expr s_deque.top().i", substrs=['(int) $1 = 4']) self.expect("expr s_deque.emplace(5)") - self.expect("expr (int)s_deque.top().i", substrs=['(int) $2 = 5']) + self.expect("expr s_deque.top().i", substrs=['(int) $2 = 5']) # Test std::stack functionality with a std::vector. self.expect("expr s_vector.pop()") self.expect("expr s_vector.push({4})") - self.expect("expr (size_t)s_vector.size()", substrs=['(size_t) $3 = 3']) - self.expect("expr (int)s_vector.top().i", substrs=['(int) $4 = 4']) + self.expect("expr s_vector.size()", substrs=['(size_t) $3 = 3']) + self.expect("expr s_vector.top().i", substrs=['(int) $4 = 4']) self.expect("expr s_vector.emplace(5)") - self.expect("expr (int)s_vector.top().i", substrs=['(int) $5 = 5']) + self.expect("expr s_vector.top().i", substrs=['(int) $5 = 5']) # Test std::stack functionality with a std::list. self.expect("expr s_list.pop()") self.expect("expr s_list.push({4})") - self.expect("expr (size_t)s_list.size()", substrs=['(size_t) $6 = 3']) - self.expect("expr (int)s_list.top().i", substrs=['(int) $7 = 4']) + self.expect("expr s_list.size()", substrs=['(size_t) $6 = 3']) + self.expect("expr s_list.top().i", substrs=['(int) $7 = 4']) self.expect("expr s_list.emplace(5)") - self.expect("expr (int)s_list.top().i", substrs=['(int) $8 = 5']) + self.expect("expr s_list.top().i", substrs=['(int) $8 = 5']) Index: lldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent.py =================================================================== --- lldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent.py +++ lldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent.py @@ -20,9 +20,9 @@ self.runCmd("settings set target.import-std-module true") - self.expect("expr (int)s->a", substrs=['(int) $0 = 3']) - self.expect("expr (int)(s->a = 5)", substrs=['(int) $1 = 5']) - self.expect("expr (int)s->a", substrs=['(int) $2 = 5']) + self.expect("expr s->a", substrs=['(int) $0 = 3']) + self.expect("expr s->a = 5", substrs=['(int) $1 = 5']) + self.expect("expr s->a", substrs=['(int) $2 = 5']) self.expect("expr (bool)s", substrs=['(bool) $3 = true']) self.expect("expr s.reset()") self.expect("expr (bool)s", substrs=['(bool) $4 = false']) Index: lldb/test/API/commands/expression/import-std-module/unique_ptr/TestUniquePtrFromStdModule.py =================================================================== --- lldb/test/API/commands/expression/import-std-module/unique_ptr/TestUniquePtrFromStdModule.py +++ lldb/test/API/commands/expression/import-std-module/unique_ptr/TestUniquePtrFromStdModule.py @@ -20,9 +20,9 @@ self.runCmd("settings set target.import-std-module true") - self.expect("expr (int)*s", substrs=['(int) $0 = 3']) - self.expect("expr (int)(*s = 5)", substrs=['(int) $1 = 5']) - self.expect("expr (int)*s", substrs=['(int) $2 = 5']) + self.expect("expr *s", substrs=['(int) $0 = 3']) + self.expect("expr *s = 5", substrs=['(int) $1 = 5']) + self.expect("expr *s", substrs=['(int) $2 = 5']) self.expect("expr (bool)s", substrs=['(bool) $3 = true']) self.expect("expr s.reset()") self.expect("expr (bool)s", substrs=['(bool) $4 = false']) Index: lldb/test/API/commands/expression/import-std-module/vector-bool/TestVectorBoolFromStdModule.py =================================================================== --- lldb/test/API/commands/expression/import-std-module/vector-bool/TestVectorBoolFromStdModule.py +++ lldb/test/API/commands/expression/import-std-module/vector-bool/TestVectorBoolFromStdModule.py @@ -20,11 +20,11 @@ self.runCmd("settings set target.import-std-module true") - self.expect("expr (size_t)a.size()", substrs=['(size_t) $0 = 4']) + self.expect("expr a.size()", substrs=['(size_t) $0 = 4']) self.expect("expr (bool)a.front()", substrs=['(bool) $1 = false']) self.expect("expr (bool)a[1]", substrs=['(bool) $2 = true']) self.expect("expr (bool)a.back()", substrs=['(bool) $3 = true']) - self.expect("expr (bool)(*a.begin())", substrs=['(bool) $4 = false']) - self.expect("expr (bool)(*a.rbegin())", substrs=['(bool) $5 = true']) + self.expect("expr (bool)*a.begin()", substrs=['(bool) $4 = false']) + self.expect("expr (bool)*a.rbegin()", substrs=['(bool) $5 = true']) Index: lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py =================================================================== --- lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py +++ lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py @@ -21,23 +21,23 @@ self.runCmd("settings set target.import-std-module true") - self.expect("expr (size_t)a.size()", substrs=['(size_t) $0 = 3']) - self.expect("expr (int)a.front().a", substrs=['(int) $1 = 3']) - self.expect("expr (int)a[1].a", substrs=['(int) $2 = 1']) - self.expect("expr (int)a.back().a", substrs=['(int) $3 = 2']) + self.expect("expr a.size()", substrs=['(size_t) $0 = 3']) + self.expect("expr a.front().a", substrs=['(int) $1 = 3']) + self.expect("expr a[1].a", substrs=['(int) $2 = 1']) + self.expect("expr a.back().a", substrs=['(int) $3 = 2']) self.expect("expr std::reverse(a.begin(), a.end())") - self.expect("expr (int)a.front().a", substrs=['(int) $4 = 2']) + self.expect("expr a.front().a", substrs=['(int) $4 = 2']) - self.expect("expr (int)(a.begin()->a)", substrs=['(int) $5 = 2']) - self.expect("expr (int)(a.rbegin()->a)", substrs=['(int) $6 = 3']) + self.expect("expr a.begin()->a", substrs=['(int) $5 = 2']) + self.expect("expr a.rbegin()->a", substrs=['(int) $6 = 3']) self.expect("expr a.pop_back()") - self.expect("expr (int)a.back().a", substrs=['(int) $7 = 1']) - self.expect("expr (size_t)a.size()", substrs=['(size_t) $8 = 2']) + self.expect("expr a.back().a", substrs=['(int) $7 = 1']) + self.expect("expr a.size()", substrs=['(size_t) $8 = 2']) - self.expect("expr (int)a.at(0).a", substrs=['(int) $9 = 2']) + self.expect("expr a.at(0).a", substrs=['(int) $9 = 2']) self.expect("expr a.push_back({4})") - self.expect("expr (int)a.back().a", substrs=['(int) $10 = 4']) - self.expect("expr (size_t)a.size()", substrs=['(size_t) $11 = 3']) + self.expect("expr a.back().a", substrs=['(int) $10 = 4']) + self.expect("expr a.size()", substrs=['(size_t) $11 = 3']) Index: lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py =================================================================== --- lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py +++ lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py @@ -20,7 +20,7 @@ self.runCmd("settings set target.import-std-module true") - self.expect("expr (size_t)a.size()", substrs=['(size_t) $0 = 2']) - self.expect("expr (int)a.front().front()", substrs=['(int) $1 = 1']) - self.expect("expr (int)a[1][1]", substrs=['(int) $2 = 2']) - self.expect("expr (int)a.back().at(0)", substrs=['(int) $3 = 3']) + self.expect("expr a.size()", substrs=['(size_t) $0 = 2']) + self.expect("expr a.front().front()", substrs=['(int) $1 = 1']) + self.expect("expr a[1][1]", substrs=['(int) $2 = 2']) + self.expect("expr a.back().at(0)", substrs=['(int) $3 = 3']) Index: lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py =================================================================== --- lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py +++ lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py @@ -20,34 +20,34 @@ self.runCmd("settings set target.import-std-module true") - self.expect("expr (size_t)a.size()", substrs=['(size_t) $0 = 3']) - self.expect("expr (int)a.front()", substrs=['(int) $1 = 3']) - self.expect("expr (int)a[1]", substrs=['(int) $2 = 1']) - self.expect("expr (int)a.back()", substrs=['(int) $3 = 2']) + self.expect("expr a.size()", substrs=['(size_t) $0 = 3']) + self.expect("expr a.front()", substrs=['(int) $1 = 3']) + self.expect("expr a[1]", substrs=['(int) $2 = 1']) + self.expect("expr a.back()", substrs=['(int) $3 = 2']) self.expect("expr std::sort(a.begin(), a.end())") - self.expect("expr (int)a.front()", substrs=['(int) $4 = 1']) - self.expect("expr (int)a[1]", substrs=['(int) $5 = 2']) - self.expect("expr (int)a.back()", substrs=['(int) $6 = 3']) + self.expect("expr a.front()", substrs=['(int) $4 = 1']) + self.expect("expr a[1]", substrs=['(int) $5 = 2']) + self.expect("expr a.back()", substrs=['(int) $6 = 3']) self.expect("expr std::reverse(a.begin(), a.end())") - self.expect("expr (int)a.front()", substrs=['(int) $7 = 3']) - self.expect("expr (int)a[1]", substrs=['(int) $8 = 2']) - self.expect("expr (int)a.back()", substrs=['(int) $9 = 1']) + self.expect("expr a.front()", substrs=['(int) $7 = 3']) + self.expect("expr a[1]", substrs=['(int) $8 = 2']) + self.expect("expr a.back()", substrs=['(int) $9 = 1']) - self.expect("expr (int)(*a.begin())", substrs=['(int) $10 = 3']) - self.expect("expr (int)(*a.rbegin())", substrs=['(int) $11 = 1']) + self.expect("expr *a.begin()", substrs=['(int) $10 = 3']) + self.expect("expr *a.rbegin()", substrs=['(int) $11 = 1']) self.expect("expr a.pop_back()") - self.expect("expr (int)a.back()", substrs=['(int) $12 = 2']) - self.expect("expr (size_t)a.size()", substrs=['(size_t) $13 = 2']) + self.expect("expr a.back()", substrs=['(int) $12 = 2']) + self.expect("expr a.size()", substrs=['(size_t) $13 = 2']) - self.expect("expr (int)a.at(0)", substrs=['(int) $14 = 3']) + self.expect("expr a.at(0)", substrs=['(int) $14 = 3']) self.expect("expr a.push_back(4)") - self.expect("expr (int)a.back()", substrs=['(int) $15 = 4']) - self.expect("expr (size_t)a.size()", substrs=['(size_t) $16 = 3']) + self.expect("expr a.back()", substrs=['(int) $15 = 4']) + self.expect("expr a.size()", substrs=['(size_t) $16 = 3']) self.expect("expr a.emplace_back(5)") - self.expect("expr (int)a.back()", substrs=['(int) $17 = 5']) - self.expect("expr (size_t)a.size()", substrs=['(size_t) $18 = 4']) + self.expect("expr a.back()", substrs=['(int) $17 = 5']) + self.expect("expr a.size()", substrs=['(size_t) $18 = 4']) Index: lldb/test/API/commands/expression/import-std-module/weak_ptr-dbg-info-content/TestDbgInfoContentWeakPtrFromStdModule.py =================================================================== --- lldb/test/API/commands/expression/import-std-module/weak_ptr-dbg-info-content/TestDbgInfoContentWeakPtrFromStdModule.py +++ lldb/test/API/commands/expression/import-std-module/weak_ptr-dbg-info-content/TestDbgInfoContentWeakPtrFromStdModule.py @@ -20,9 +20,9 @@ self.runCmd("settings set target.import-std-module true") - self.expect("expr (int)w.lock()->a", substrs=['(int) $0 = 3']) - self.expect("expr (int)(w.lock()->a = 5)", substrs=['(int) $1 = 5']) - self.expect("expr (int)w.lock()->a", substrs=['(int) $2 = 5']) + self.expect("expr w.lock()->a", substrs=['(int) $0 = 3']) + self.expect("expr w.lock()->a = 5", substrs=['(int) $1 = 5']) + self.expect("expr w.lock()->a", substrs=['(int) $2 = 5']) self.expect("expr w.use_count()", substrs=['(long) $3 = 1']) self.expect("expr w.reset()") self.expect("expr w.use_count()", substrs=['(long) $4 = 0']) Index: lldb/test/API/commands/expression/import-std-module/weak_ptr/TestWeakPtrFromStdModule.py =================================================================== --- lldb/test/API/commands/expression/import-std-module/weak_ptr/TestWeakPtrFromStdModule.py +++ lldb/test/API/commands/expression/import-std-module/weak_ptr/TestWeakPtrFromStdModule.py @@ -20,9 +20,9 @@ self.runCmd("settings set target.import-std-module true") - self.expect("expr (int)*w.lock()", substrs=['(int) $0 = 3']) - self.expect("expr (int)(*w.lock() = 5)", substrs=['(int) $1 = 5']) - self.expect("expr (int)*w.lock()", substrs=['(int) $2 = 5']) + self.expect("expr *w.lock()", substrs=['(int) $0 = 3']) + self.expect("expr *w.lock() = 5", substrs=['(int) $1 = 5']) + self.expect("expr *w.lock()", substrs=['(int) $2 = 5']) self.expect("expr w.use_count()", substrs=['(long) $3 = 1']) self.expect("expr w.reset()") self.expect("expr w.use_count()", substrs=['(long) $4 = 0'])