Skip to content

Commit b2fb9e4

Browse files
committed
Fix name range of wildcard names in walkToDeclPre
1 parent 748f60d commit b2fb9e4

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/IDE/SourceEntityWalker.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,15 @@ bool SemaAnnotator::walkToDeclPre(Decl *D) {
125125
bool IsExtension = false;
126126

127127
if (auto *VD = dyn_cast<ValueDecl>(D)) {
128-
if (VD->hasName() && !VD->isImplicit()) {
128+
if (!VD->isImplicit()) {
129129
SourceManager &SM = VD->getASTContext().SourceMgr;
130-
NameLen = VD->getBaseName().userFacingName().size();
131-
if (Loc.isValid() && SM.extractText({Loc, 1}) == "`")
132-
NameLen += 2;
130+
if (VD->hasName()) {
131+
NameLen = VD->getBaseName().userFacingName().size();
132+
if (Loc.isValid() && SM.extractText({Loc, 1}) == "`")
133+
NameLen += 2;
134+
} else if (Loc.isValid() && SM.extractText({Loc, 1}) == "_") {
135+
NameLen = 1;
136+
}
133137
}
134138

135139
auto ReportParamList = [&](ParameterList *PL) {

0 commit comments

Comments
 (0)