Skip to content

Commit b41769b

Browse files
committed
Use getSemanticsProvidingExpr() and hasName()
1 parent 6670639 commit b41769b

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

lib/AST/UnqualifiedLookup.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -418,18 +418,17 @@ bool implicitSelfReferenceIsUnwrapped(const ValueDecl *selfDecl,
418418
}
419419
}
420420

421-
DeclRefExpr *condDRE = nullptr;
422-
if (auto DRE = dyn_cast<DeclRefExpr>(cond.getInitializer())) {
423-
condDRE = DRE;
424-
}
425-
426-
if (auto LE = dyn_cast<LoadExpr>(cond.getInitializer())) {
427-
if (auto DRE = dyn_cast_or_null<DeclRefExpr>(LE->getSubExpr())) {
428-
condDRE = DRE;
421+
Expr *exprToCheckForDRE = cond.getInitializer();
422+
if (auto LE = dyn_cast<LoadExpr>(exprToCheckForDRE)) {
423+
if (auto subexpr = LE->getSubExpr()) {
424+
exprToCheckForDRE = subexpr;
429425
}
430426
}
431427

432-
if (!condDRE) {
428+
exprToCheckForDRE = exprToCheckForDRE->getSemanticsProvidingExpr();
429+
430+
DeclRefExpr *condDRE = dyn_cast<DeclRefExpr>(exprToCheckForDRE);
431+
if (!condDRE || !condDRE->getDecl()->hasName()) {
433432
return false;
434433
}
435434

0 commit comments

Comments
 (0)