[cursor-info] Tweak check to not report parent_loc on locals in body

We were checking only for the specific loc of the declaration of the
param, but that didn't handle references to a local parameter inside the
body.

rdar://problem/32019195
This commit is contained in:
Ben Langmuir
2017-05-05 10:49:44 -07:00
parent 334195c424
commit 651bb4c506
2 changed files with 10 additions and 1 deletions

View File

@@ -621,7 +621,7 @@ getParamParentNameOffset(const ValueDecl *VD, SourceLoc Cursor) {
if (auto PD = dyn_cast<ParamDecl>(VD)) {
// Avoid returning parent loc for internal-only names.
if (PD->getArgumentNameLoc().isValid() && PD->getNameLoc() == Cursor)
if (PD->getArgumentNameLoc().isValid() && PD->getArgumentNameLoc() != Cursor)
return None;
auto *DC = PD->getDeclContext();
switch (DC->getContextKind()) {