[Lldb-commits] [lldb] 831ba95 - Revert "[lldb] Fix `FindDirectNestedType` not working with class templates (#81666)"

Shubham Sandeep Rastogi via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 16 11:00:52 PST 2024


Author: Shubham Sandeep Rastogi
Date: 2024-02-16T11:00:35-08:00
New Revision: 831ba9540089350b740c5db61159fe23ab6872d3

URL: https://github.com/llvm/llvm-project/commit/831ba9540089350b740c5db61159fe23ab6872d3
DIFF: https://github.com/llvm/llvm-project/commit/831ba9540089350b740c5db61159fe23ab6872d3.diff

LOG: Revert "[lldb] Fix `FindDirectNestedType` not working with class templates (#81666)"

This reverts commit 7b7d411de9f731d2bcf6b093f6cee2cf57a5196e.

Added: 
    

Modified: 
    lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
    lldb/test/API/python_api/type/TestTypeList.py
    lldb/test/API/python_api/type/main.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 0652ac0e134f53..a41e2c690853d2 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -2165,7 +2165,6 @@ PrintingPolicy TypeSystemClang::GetTypePrintingPolicy() {
   // (and we then would have suppressed them from the type name) and also setups
   // where LLDB wasn't able to reconstruct the default arguments.
   printing_policy.SuppressDefaultTemplateArgs = false;
-  printing_policy.AlwaysIncludeTypeForTemplateArgument = true;
   return printing_policy;
 }
 
@@ -9266,13 +9265,8 @@ ConstString TypeSystemClang::DeclContextGetName(void *opaque_decl_ctx) {
   if (opaque_decl_ctx) {
     clang::NamedDecl *named_decl =
         llvm::dyn_cast<clang::NamedDecl>((clang::DeclContext *)opaque_decl_ctx);
-    if (named_decl) {
-      std::string name;
-      llvm::raw_string_ostream stream{name};
-      named_decl->getNameForDiagnostic(stream, GetTypePrintingPolicy(),
-                                       /*qualified=*/false);
-      return ConstString(name);
-    }
+    if (named_decl)
+      return ConstString(named_decl->getName());
   }
   return ConstString();
 }

diff  --git a/lldb/test/API/python_api/type/TestTypeList.py b/lldb/test/API/python_api/type/TestTypeList.py
index 63ab958193574b..c267defb58edf9 100644
--- a/lldb/test/API/python_api/type/TestTypeList.py
+++ b/lldb/test/API/python_api/type/TestTypeList.py
@@ -150,23 +150,6 @@ def test(self):
         invalid_type = task_type.FindDirectNestedType(None)
         self.assertFalse(invalid_type)
 
-        # Check that FindDirectNestedType works with types from AST
-        pointer = frame0.FindVariable("pointer")
-        pointer_type = pointer.GetType()
-        self.assertTrue(pointer_type)
-        self.DebugSBType(pointer_type)
-        pointer_info_type = pointer_type.template_args[1]
-        self.assertTrue(pointer_info_type)
-        self.DebugSBType(pointer_info_type)
-
-        pointer_masks1_type = pointer_info_type.FindDirectNestedType("Masks1")
-        self.assertTrue(pointer_masks1_type)
-        self.DebugSBType(pointer_masks1_type)
-
-        pointer_masks2_type = pointer_info_type.FindDirectNestedType("Masks2")
-        self.assertTrue(pointer_masks2_type)
-        self.DebugSBType(pointer_masks2_type)
-
         # We'll now get the child member 'id' from 'task_head'.
         id = task_head.GetChildMemberWithName("id")
         self.DebugSBValue(id)

diff  --git a/lldb/test/API/python_api/type/main.cpp b/lldb/test/API/python_api/type/main.cpp
index 391f58e3e5871c..98de9707d88654 100644
--- a/lldb/test/API/python_api/type/main.cpp
+++ b/lldb/test/API/python_api/type/main.cpp
@@ -34,14 +34,6 @@ class Task {
     {}
 };
 
-template <unsigned Value> struct PointerInfo {
-  enum Masks1 { pointer_mask };
-  enum class Masks2 { pointer_mask };
-};
-
-template <unsigned Value, typename InfoType = PointerInfo<Value>>
-struct Pointer {};
-
 enum EnumType {};
 enum class ScopedEnumType {};
 enum class EnumUChar : unsigned char {};
@@ -79,9 +71,5 @@ int main (int argc, char const *argv[])
     ScopedEnumType scoped_enum_type;
     EnumUChar scoped_enum_type_uchar;
 
-    Pointer<3> pointer;
-    PointerInfo<3>::Masks1 mask1 = PointerInfo<3>::Masks1::pointer_mask;
-    PointerInfo<3>::Masks2 mask2 = PointerInfo<3>::Masks2::pointer_mask;
-
     return 0; // Break at this line
 }


        


More information about the lldb-commits mailing list