Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don’t lookupOverrides of special names. #25584

Merged
merged 1 commit into from
Jun 19, 2019

Conversation

davidungar
Copy link
Contributor

@davidungar davidungar commented Jun 18, 2019

Per SR-10949 , fixes a compiler crash. When the base name is computed for the debug client and the name is special, the getBaseName function fails. So, don't try to compute an override for a special name.

@davidungar
Copy link
Contributor Author

@swift-ci please smoke test

@jrose-apple
Copy link
Contributor

@jimingham, @adrian-prantl, any idea how to write a test case for this in the Swift repo?

@adrian-prantl
Copy link
Contributor

@jimingham, @adrian-prantl, any idea how to write a test case for this in the Swift repo?

I don't know how to trigger this code path, but to get a special name, all that should be necessary is to compile with -Xfrontend -debugger-support and use a name starting with $.

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Special names can't ever be found at the top level, so the fix looks good... but I don't think we have any way to install a DebugClient without involving LLDB itself, right?

@jrose-apple
Copy link
Contributor

A "special name" is init, subscript, or deinit, not something starting with $.

@jimingham
Copy link
Contributor

The DebuggerClient is a pretty simple interface, maybe you could have a no-op one in the frontend that you activate when passed some obscure option? It should be good enough to return false from all the lookups. Most of lldb's special behavior when parsing expressions happens because we give the LLDBDebuggerFunction attribute to the wrapper functions, and then various things in swift check for that. So just having a trivial DebuggerClient present shouldn't trigger any special compilation. Then you just have to get to this code path.

BTW, the DebuggerClient interface was designed before I started working on lldb's swift expression parser, so I don't know what the original rational for it was, but lookupOverrides has returned false for all inputs for as far back as I can find sources for it. Maybe the intent was to use it to redefine entities in the REPL? But it isn't used for that.

@jimingham
Copy link
Contributor

That's to say: I don't know how to trigger this code because from our perspective it's never done anything we would care about...

@davidungar davidungar merged commit 3aa6a98 into swiftlang:master Jun 19, 2019
@davidungar davidungar deleted the Fix-SR-10949 branch June 19, 2019 03:14
@davidungar
Copy link
Contributor Author

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.

5 participants