This is an archive of the discontinued LLVM Phabricator instance.

[Expression parser] Return both types and variables
ClosedPublic

Authored by spyffe on Apr 14 2017, 3:56 PM.

Details

Reviewers
jingham
lhames
Summary

Many times a user wants to access a type when there's a variable of the same name, or a variable when there's a type of the same name. Depending on the precise context, currently the expression parser can fail to resolve one or the other.

This is because ClangExpressionDeclMap has logic to limit the amount of information it searches, and that logic sometimes cuts down the search prematurely. This patch removes some of those early exits.

In that sense, this patch trades performance (early exit is faster) for correctness.

I've also included two new test cases showing examples of this behavior – as well as modifying an existing test case that gets it wrong.

Diff Detail

Event Timeline

spyffe created this revision.Apr 14 2017, 3:56 PM
jingham accepted this revision.Apr 19 2017, 5:12 PM

This looks okay on the lldb side. Thanks for adding the test cases. I do worry that we're going to end up looking too far afield for types when the local variable. But we can make it correct first and see what we can do about performance if that becomes an issue.

This revision is now accepted and ready to land.Apr 19 2017, 5:12 PM
spyffe closed this revision.Apr 24 2017, 4:27 PM

Closed by r301273