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

Commit
1 year ago
[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
Parents
Loading