[Lldb-commits] [lldb] 4a030f5 - [lldb-vscode][NFC] Access a pointee type in a simpler way

walter erquinigo via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 15 09:26:12 PDT 2023


Author: walter erquinigo
Date: 2023-09-15T12:26:04-04:00
New Revision: 4a030f5b245b63fe09c29686c50d40796c987d96

URL: https://github.com/llvm/llvm-project/commit/4a030f5b245b63fe09c29686c50d40796c987d96
DIFF: https://github.com/llvm/llvm-project/commit/4a030f5b245b63fe09c29686c50d40796c987d96.diff

LOG: [lldb-vscode][NFC] Access a pointee type in a simpler way

The new code is a bit simpler bit achieves the same goal. A small test was added just in case.

Added: 
    

Modified: 
    lldb/test/API/tools/lldb-vscode/evaluate/TestVSCode_evaluate.py
    lldb/tools/lldb-vscode/JSONUtils.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/tools/lldb-vscode/evaluate/TestVSCode_evaluate.py b/lldb/test/API/tools/lldb-vscode/evaluate/TestVSCode_evaluate.py
index d0172ef9160fdd6..3cfe02ef6aa1576 100644
--- a/lldb/test/API/tools/lldb-vscode/evaluate/TestVSCode_evaluate.py
+++ b/lldb/test/API/tools/lldb-vscode/evaluate/TestVSCode_evaluate.py
@@ -62,6 +62,9 @@ def run_test_evaluate_expressions(
         self.assertEvaluate(
             "struct1", "{foo:15}" if enableAutoVariableSummaries else "my_struct @ 0x"
         )
+        self.assertEvaluate(
+            "struct2", "{foo:16}" if enableAutoVariableSummaries else "0x.*"
+        )
         self.assertEvaluate("struct1.foo", "15")
         self.assertEvaluate("struct2->foo", "16")
 

diff  --git a/lldb/tools/lldb-vscode/JSONUtils.cpp b/lldb/tools/lldb-vscode/JSONUtils.cpp
index 0d149ff27fd3d3e..c6b422e4d7a02e6 100644
--- a/lldb/tools/lldb-vscode/JSONUtils.cpp
+++ b/lldb/tools/lldb-vscode/JSONUtils.cpp
@@ -203,10 +203,9 @@ static bool ShouldBeDereferencedForSummary(lldb::SBValue &v) {
   if (!v.GetType().IsPointerType() && !v.GetType().IsReferenceType())
     return false;
 
-  // If it's a pointer to a pointer, we don't dereference to avoid confusing
+  // If we are referencing a pointer, we don't dereference to avoid confusing
   // the user with the addresses that could shown in the summary.
-  if (v.GetType().IsPointerType() &&
-      v.GetType().GetDereferencedType().IsPointerType())
+  if (v.Dereference().GetType().IsPointerType())
     return false;
 
   // If it's synthetic or a pointer to a basic type that provides a summary, we


        


More information about the lldb-commits mailing list