[all-commits] [llvm/llvm-project] b15f58: [clang][Sema] Fix false-positive -Wshadow for frie...

ahmed mohamed kamel via All-commits all-commits at lists.llvm.org
Tue Sep 15 06:16:16 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b15f58cd8bcbd29156ff2cc8c6c89effba12c293
      https://github.com/llvm/llvm-project/commit/b15f58cd8bcbd29156ff2cc8c6c89effba12c293
  Author: ahmed mohamed kamel <109012086+AhmedKamel10 at users.noreply.github.com>
  Date:   2026-09-15 (Tue, 15 Sep 2026)

  Changed paths:
    M clang/docs/ReleaseNotes.md
    M clang/lib/Sema/SemaDecl.cpp
    M clang/test/SemaCXX/warn-shadow.cpp

  Log Message:
  -----------
  [clang][Sema] Fix false-positive -Wshadow for friend functions (#221249)

A friend function defined inline in a class body has no implicit `this`,
so a parameter with the same name as a field cannot actually shadow it.
`CheckShadow` only exempted static members and members with an explicit
object parameter, it never handled the case where the enclosing function
isn't a member function at all, which fell through to the generic
diagnostic. In this PR I extend the exemption to cover that case and
added the regression test.

In this PR, I used Claude to help navigate the codebase and explain key
functions.
Fixes #221190



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