History log of /llvm-project/clang/unittests/AST/RawCommentForDeclTest.cpp (Results 1 – 1 of 1)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1
# ea578804 20-Sep-2024 Nathan Ridge <zeratul976@hotmail.com>

[AST] Ensure getRawCommentsForAnyRedecl() does not miss any redecl with a comment (#108475)

The previous implementation had a bug where, if it was called on a Decl
later in the redecl chain than `L

[AST] Ensure getRawCommentsForAnyRedecl() does not miss any redecl with a comment (#108475)

The previous implementation had a bug where, if it was called on a Decl
later in the redecl chain than `LastCheckedDecl`, it could incorrectly
skip and overlook a Decl with a comment.

The patch addresses this by only using `LastCheckedDecl` if the input
Decl `D` is on the path from the first (canonical) Decl to
`LastCheckedDecl`.

An alternative that was considered was to start the iteration from the
(canonical) Decl, however this ran into problems with the modelling of
explicit template specializations in the AST where the canonical Decl
can be unusual. With the current solution, if no Decls were checked yet,
we prefer to check the input Decl over the canonical one.

Fixes https://github.com/llvm/llvm-project/issues/108145

show more ...