File tree Expand file tree Collapse file tree 3 files changed +26
-2
lines changed
test/API/commands/dwim-print/swift Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -300,9 +300,14 @@ void ValueObjectPrinter::PrintDecl() {
300
300
ConstString type_name_cstr (typeName.GetString ());
301
301
ConstString var_name_cstr (varName.GetString ());
302
302
303
+ DumpValueObjectOptions decl_print_options;
304
+ // Pass printing helpers an option object that indicates whether the name
305
+ // should be shown or hidden.
306
+ decl_print_options.SetHideName (!ShouldShowName ());
307
+
303
308
StreamString dest_stream;
304
309
if (m_options.m_decl_printing_helper (type_name_cstr, var_name_cstr,
305
- m_options , dest_stream)) {
310
+ decl_print_options , dest_stream)) {
306
311
decl_printed = true ;
307
312
m_stream->PutCString (dest_stream.GetString ());
308
313
}
Original file line number Diff line number Diff line change @@ -28,3 +28,14 @@ def test_swift_po_non_address_hex(self):
28
28
self , "// break here" , lldb .SBFileSpec ("main.swift" )
29
29
)
30
30
self .expect (f"dwim-print -O -- 0x1000" , substrs = ["4096" ])
31
+
32
+ @swiftTest
33
+ def test_print_swift_object_does_not_show_name (self ):
34
+ """Ensure that objects are printed without a name, and without the '='
35
+ that would follow the name."""
36
+ self .build ()
37
+ lldbutil .run_to_source_breakpoint (
38
+ self , "// break here" , lldb .SBFileSpec ("main.swift" )
39
+ )
40
+
41
+ self .expect (f"dwim-print user" , patterns = [r"^\(a\.User\) 0x[0-9a-f]{7,} \{" ])
Original file line number Diff line number Diff line change @@ -6,9 +6,17 @@ class Object: CustomStringConvertible {
6
6
}
7
7
}
8
8
9
+ class User {
10
+ var id : Int = 314159265358979322
11
+ var name : String = " Gwendolyn "
12
+ var groups : ( admin: Bool , staff: Bool ) = ( false , true )
13
+ }
14
+
9
15
func main( ) {
10
16
let object = Object ( )
11
- _ = object // break here
17
+ let user = User ( )
18
+ // break here
19
+ print ( object, user)
12
20
}
13
21
14
22
main ( )
You can’t perform that action at this time.
0 commit comments