[all-commits] [llvm/llvm-project] 95ed2d: [clang] fix nested tags of the same name not being...

Matheus Izvekov via All-commits all-commits at lists.llvm.org
Thu Aug 28 20:08:39 PDT 2025


  Branch: refs/heads/users/mizvekov/GH155936
  Home:   https://github.com/llvm/llvm-project
  Commit: 95ed2d03e8dad25d4872fdb21f1d56acf136e383
      https://github.com/llvm/llvm-project/commit/95ed2d03e8dad25d4872fdb21f1d56acf136e383
  Author: Matheus Izvekov <mizvekov at gmail.com>
  Date:   2025-08-29 (Fri, 29 Aug 2025)

  Changed paths:
    M clang/lib/Sema/SemaDecl.cpp
    M clang/test/AST/ast-dump-decl.cpp

  Log Message:
  -----------
  [clang] fix nested tags of the same name not being included in their context

Fix an error in the logic meant to handle a redeclaration such as:
```C++
struct A {
  struct __attribute__((foo)) A *ptr;
};
```
In the declaration of ptr, we must introduce a new redeclaration of A
in order for it to carry the new attribute. This is a redeclaration of
the existing A, but it is only lexically contained in A, but still
semantically belonging to the TU. This is the same deal as happens with
friend declarations, and the logic used to handle that is reused here.

But this was going haywire with a class indirectly nested within a class
of the same name.

The fix limits this logic to only apply when the tag use is just a simple
reference.

Fixes #155936



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