Sema: Fix MissingCallFailure::diagnoseAsError() crash with special base names

This commit is contained in:
Slava Pestov
2025-06-16 15:41:38 -04:00
parent 0d6470345b
commit b79f2817f9
3 changed files with 6 additions and 6 deletions

View File

@@ -3940,14 +3940,14 @@ bool MissingCallFailure::diagnoseAsError() {
if (auto *DRE = getAsExpr<DeclRefExpr>(anchor)) {
emitDiagnostic(diag::did_not_call_function,
DRE->getDecl()->getBaseIdentifier())
DRE->getDecl()->getBaseName())
.fixItInsertAfter(insertLoc, "()");
return true;
}
if (auto *UDE = getAsExpr<UnresolvedDotExpr>(anchor)) {
emitDiagnostic(diag::did_not_call_method,
UDE->getName().getBaseIdentifier())
UDE->getName().getBaseName())
.fixItInsertAfter(insertLoc, "()");
return true;
}
@@ -3955,7 +3955,7 @@ bool MissingCallFailure::diagnoseAsError() {
if (auto *DSCE = getAsExpr<DotSyntaxCallExpr>(anchor)) {
if (auto *DRE = dyn_cast<DeclRefExpr>(DSCE->getFn())) {
emitDiagnostic(diag::did_not_call_method,
DRE->getDecl()->getBaseIdentifier())
DRE->getDecl()->getBaseName())
.fixItInsertAfter(insertLoc, "()");
return true;
}