This revision was automatically updated to reflect the committed changes.
Closed by commit rG950f1bf976b3: [lldb] Add SubstTemplateTypeParm to
RemoveWrappingTypes (authored by teemperor).
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
Changed prior to commit:
https://reviews.llvm.org/D85132?vs=282610&id=284677#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85132/new/
https://reviews.llvm.org/D85132
Files:
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/test/API/lang/cpp/subst_template_type_param/TestSubstTemplateTypeParam.py
Index:
lldb/test/API/lang/cpp/subst_template_type_param/TestSubstTemplateTypeParam.py
===================================================================
--- /dev/null
+++
lldb/test/API/lang/cpp/subst_template_type_param/TestSubstTemplateTypeParam.py
@@ -0,0 +1,34 @@
+"""
+Test SubstTemplateTypeParam types which are produced as type sugar
+when template type parameters are used for example as field types.
+"""
+
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import decorators
+
+class TestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def test_typedef(self):
+ target = self.dbg.GetDummyTarget()
+
+ # Declare a template class with a field that uses the template type
+ # parameter.
+ opts = lldb.SBExpressionOptions()
+ opts.SetTopLevel(True)
+ result = target.EvaluateExpression("template <typename T> struct X { T
f; };", opts)
+ # FIXME: This fails with "Couldn't find $__lldb_expr() in the module"
+ # but it should succeed. The fact that this code has nothing to run
+ # shouldn't be an error.
+ # self.assertSuccess(result.GetError())
+
+ # Instantiate and produce a value with that template as the type.
+ # The field in the value will have a SubstTemplateTypeParam that
+ # should behave like a normal field.
+ result = target.EvaluateExpression("X<int> x; x.f = 123; x")
+ self.assertEqual(result.GetNumChildren(), 1)
+ self.assertEqual(result.GetChildAtIndex(0).GetTypeName(), "int")
+ self.assertEqual(result.GetChildAtIndex(0).GetValue(), "123")
Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===================================================================
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -2499,6 +2499,7 @@
case clang::Type::Decltype:
case clang::Type::Elaborated:
case clang::Type::Paren:
+ case clang::Type::SubstTemplateTypeParm:
case clang::Type::TemplateSpecialization:
case clang::Type::Typedef:
case clang::Type::TypeOf:
Index: lldb/test/API/lang/cpp/subst_template_type_param/TestSubstTemplateTypeParam.py
===================================================================
--- /dev/null
+++ lldb/test/API/lang/cpp/subst_template_type_param/TestSubstTemplateTypeParam.py
@@ -0,0 +1,34 @@
+"""
+Test SubstTemplateTypeParam types which are produced as type sugar
+when template type parameters are used for example as field types.
+"""
+
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import decorators
+
+class TestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def test_typedef(self):
+ target = self.dbg.GetDummyTarget()
+
+ # Declare a template class with a field that uses the template type
+ # parameter.
+ opts = lldb.SBExpressionOptions()
+ opts.SetTopLevel(True)
+ result = target.EvaluateExpression("template <typename T> struct X { T f; };", opts)
+ # FIXME: This fails with "Couldn't find $__lldb_expr() in the module"
+ # but it should succeed. The fact that this code has nothing to run
+ # shouldn't be an error.
+ # self.assertSuccess(result.GetError())
+
+ # Instantiate and produce a value with that template as the type.
+ # The field in the value will have a SubstTemplateTypeParam that
+ # should behave like a normal field.
+ result = target.EvaluateExpression("X<int> x; x.f = 123; x")
+ self.assertEqual(result.GetNumChildren(), 1)
+ self.assertEqual(result.GetChildAtIndex(0).GetTypeName(), "int")
+ self.assertEqual(result.GetChildAtIndex(0).GetValue(), "123")
Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===================================================================
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -2499,6 +2499,7 @@
case clang::Type::Decltype:
case clang::Type::Elaborated:
case clang::Type::Paren:
+ case clang::Type::SubstTemplateTypeParm:
case clang::Type::TemplateSpecialization:
case clang::Type::Typedef:
case clang::Type::TypeOf:
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits