[all-commits] [llvm/llvm-project] ea5788: [AST] Ensure getRawCommentsForAnyRedecl() does not...

Nathan Ridge via All-commits all-commits at lists.llvm.org
Thu Sep 19 23:24:20 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ea578804c81bbad1f31a0c940c8f4378d6893ede
      https://github.com/llvm/llvm-project/commit/ea578804c81bbad1f31a0c940c8f4378d6893ede
  Author: Nathan Ridge <zeratul976 at hotmail.com>
  Date:   2024-09-20 (Fri, 20 Sep 2024)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/AST/ASTContext.cpp
    M clang/unittests/AST/CMakeLists.txt
    A clang/unittests/AST/RawCommentForDeclTest.cpp

  Log Message:
  -----------
  [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



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