Sema: Don't diagnose forward references to debugger variables in pre-checking

This commit is contained in:
Slava Pestov
2020-11-16 22:39:14 -05:00
parent 9e4bdb65be
commit 641a257f73

View File

@@ -380,6 +380,10 @@ Expr *TypeChecker::resolveDeclRefExpr(UnresolvedDeclRefExpr *UDRE,
ValueDecl *localDeclAfterUse = nullptr;
auto isValid = [&](ValueDecl *D) {
// References to variables injected by lldb are always valid.
if (isa<VarDecl>(D) && cast<VarDecl>(D)->isDebuggerVar())
return true;
// If we find something in the current context, it must be a forward
// reference, because otherwise if it was in scope, it would have
// been returned by the call to ASTScope::lookupLocalDecls() above.