[all-commits] [llvm/llvm-project] 6dca33: Check for mutability better (#127843)

Devon Loehr via All-commits all-commits at lists.llvm.org
Fri Feb 21 07:41:26 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6dca33ce20693381beab9817c12d512dfdac0b02
      https://github.com/llvm/llvm-project/commit/6dca33ce20693381beab9817c12d512dfdac0b02
  Author: Devon Loehr <DKLoehr at users.noreply.github.com>
  Date:   2025-02-21 (Fri, 21 Feb 2025)

  Changed paths:
    M clang/lib/Sema/SemaDecl.cpp
    M clang/test/SemaCXX/unique_object_duplication.h

  Log Message:
  -----------
  Check for mutability better (#127843)

This PR adds a function to determine if a type "looks" mutable. Since
it's impossible to be totally sure if something can or can't be modified
in C++, this makes a best-effort attempt to determine if variables of
that type can be modified or not.

The motivation for this change is the -Wunique-object-duplication
warning, which had a false positive due to a missed case while checking
for mutability. Pulling the logic into a separate function allows it to
be written much more cleanly. There should be no behavior change, except
that we no longer report function references to be mutable.



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