Skip to content

Conversation

@kastiglione
Copy link

SwiftLanguage::GetDeclPrintingHelper is a helper function used for Swift types. This
code contains some very similar logic to the default logic in ValueObjectPrinter.
Specifically:

SwiftLanguage:

else if (!options.m_hide_name)
  stream.Printf(" =");

ValueObjectPrinter:

else if (ShouldShowName())
  m_stream->Printf(" =");

The function ValueObjectPrinter::ShouldShowName is not accessible by SwiftLanguage.

To allow SwiftLanguage to make the right decision, and fit within the existing API
boundary, this change uses a custom print options, which sets calls SetHideName
according to the value of ShouldShowName(). This allows the Swift language decl
printing helper to correctly know whether to print the name, or not.

(cherry-picked from commit e6d9bd6)

`SwiftLanguage::GetDeclPrintingHelper` is a helper function used for Swift types. This 
code contains some very similar logic to the default logic in `ValueObjectPrinter`. 
Specifically:


`SwiftLanguage`:

```c++
else if (!options.m_hide_name)
  stream.Printf(" =");
```

`ValueObjectPrinter`:

```c++
else if (ShouldShowName())
  m_stream->Printf(" =");
```

The function `ValueObjectPrinter::ShouldShowName` is not accessible by `SwiftLanguage`.

To allow `SwiftLanguage` to make the right decision, and fit within the existing API 
boundary, this change uses a custom print options, which sets calls `SetHideName` 
according to the value of `ShouldShowName()`. This allows the Swift language decl 
printing helper to correctly know whether to print the name, or not.

(cherry-picked from commit e6d9bd6)
@kastiglione kastiglione merged commit 8434039 into next May 9, 2023
@kastiglione kastiglione deleted the dl/lldb-Fix-Language-Plugin-decl-printing-6795 branch May 9, 2023 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants