[all-commits] [llvm/llvm-project] 0c1dcd: [clangd] [HeuristicResolver] Protect against infin...
Nathan Ridge via All-commits
all-commits at lists.llvm.org
Sat Mar 16 15:27:11 PDT 2024
Branch: refs/heads/release/18.x
Home: https://github.com/llvm/llvm-project
Commit: 0c1dcd675291f058d530078f9304162ea9d27cd1
https://github.com/llvm/llvm-project/commit/0c1dcd675291f058d530078f9304162ea9d27cd1
Author: Nathan Ridge <zeratul976 at hotmail.com>
Date: 2024-03-16 (Sat, 16 Mar 2024)
Changed paths:
M clang-tools-extra/clangd/HeuristicResolver.cpp
M clang-tools-extra/clangd/HeuristicResolver.h
M clang-tools-extra/clangd/unittests/FindTargetTests.cpp
Log Message:
-----------
[clangd] [HeuristicResolver] Protect against infinite recursion on DependentNameTypes (#83542)
When resolving names inside templates that implement recursive
compile-time functions (e.g. waldo<N>::type is defined in terms
of waldo<N-1>::type), HeuristicResolver could get into an infinite
recursion, specifically one where resolveDependentNameType() can
be called recursively with the same DependentNameType*.
To guard against this, HeuristicResolver tracks, for each external
call into a HeuristicResolver function, the set of DependentNameTypes
that it has seen, and bails if it sees the same DependentNameType again.
To implement this, a helper class HeuristicResolverImpl is introduced
to store state that persists for the duration of an external call into
HeuristicResolver (but does not persist between such calls).
Fixes https://github.com/clangd/clangd/issues/1951
(cherry picked from commit e6e53ca8470d719882539359ebe3ad8b442a8cb0)
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list