[all-commits] [llvm/llvm-project] 5bd0f0: [clangd] Check for valid location in ExtractionCon...
Björn Pettersson via All-commits
all-commits at lists.llvm.org
Fri Nov 10 22:53:31 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 5bd0f0d9d635617b335dd0b259e971a605ad6776
https://github.com/llvm/llvm-project/commit/5bd0f0d9d635617b335dd0b259e971a605ad6776
Author: Björn Pettersson <bjorn.a.pettersson at ericsson.com>
Date: 2023-11-11 (Sat, 11 Nov 2023)
Changed paths:
M clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp
M clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp
Log Message:
-----------
[clangd] Check for valid location in ExtractionContext::exprIsValidOutside (#71162)
If the code has a call to an implicitly declared function, an expression
could end up referencing declarations without valid source locations. So
when doing the exprIsValidOutside check we could end up calling
SourceManager::isPointWithin using invalid source locations, and then a
debug build would crash with an assertion failure in
SourceManager::isBeforeInTranslationUnit.
This patch make sure that we deal with the invalid locations (by
considering a ReferencedDecl with invalid location as not being inside
the Scope).
More information about the All-commits
mailing list