[clang-tools-extra] [clangd] Check for valid location in ExtractionContext::exprIsValidOutside (PR #71162)
Nathan Ridge via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 10 00:34:35 PST 2023
================
@@ -176,7 +176,8 @@ bool ExtractionContext::exprIsValidOutside(const clang::Stmt *Scope) const {
SourceLocation ScopeBegin = Scope->getBeginLoc();
SourceLocation ScopeEnd = Scope->getEndLoc();
for (const Decl *ReferencedDecl : ReferencedDecls) {
- if (SM.isPointWithin(ReferencedDecl->getBeginLoc(), ScopeBegin, ScopeEnd) &&
+ if (ReferencedDecl->getBeginLoc().isValid() &&
----------------
HighCommander4 wrote:
(I wondered whether there might be other cases where a `Decl` has an invalid location where we'd want this function to return `false`, but I couldn't think of a specific case, so I think this is fine for the time being.)
https://github.com/llvm/llvm-project/pull/71162
More information about the cfe-commits
mailing list