[all-commits] [llvm/llvm-project] 877210: [Sema] Do not emit -Wunused-variable for variables...

Nathan Chancellor via All-commits all-commits at lists.llvm.org
Mon Jun 5 10:55:14 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 877210faa447f4cc7db87812f8ed80e398fedd61
      https://github.com/llvm/llvm-project/commit/877210faa447f4cc7db87812f8ed80e398fedd61
  Author: Nathan Chancellor <nathan at kernel.org>
  Date:   2023-06-05 (Mon, 05 Jun 2023)

  Changed paths:
    M clang/lib/Sema/SemaDecl.cpp
    M clang/test/Sema/warn-unused-variables.c

  Log Message:
  -----------
  [Sema] Do not emit -Wunused-variable for variables declared with cleanup attribute

A variable declared with __attribute__((cleanup)) cannot be unused, as
its address is passed to the clean up function. Do not emit
-Wunused-variable for variables declared with the cleanup attribute,
which matches GCC's behavior: https://godbolt.org/z/dz5YfTsan

Reviewed By: erichkeane, nickdesaulniers

Differential Revision: https://reviews.llvm.org/D152180




More information about the All-commits mailing list