[all-commits] [llvm/llvm-project] 0b07b0: [Sema] Use underlying type of scoped enum for -Wfo...

Shoaib Meenai via All-commits all-commits at lists.llvm.org
Mon Oct 2 11:33:08 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0b07b06effe5fdf779b75bb5ac6cf15e477cb0be
      https://github.com/llvm/llvm-project/commit/0b07b06effe5fdf779b75bb5ac6cf15e477cb0be
  Author: Shoaib Meenai <smeenai at fb.com>
  Date:   2023-10-02 (Mon, 02 Oct 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Sema/SemaChecking.cpp
    A clang/test/FixIt/format-darwin-enum-class.cpp
    M clang/test/FixIt/format.cpp

  Log Message:
  -----------
  [Sema] Use underlying type of scoped enum for -Wformat diagnostics (#67378)

Right now, `-Wformat` for a scoped enum will suggest a cast based on the
format specifier being used. This can lead to incorrect results, e.g.
attempting to format a scoped enum with `%s` would suggest casting to
`char *` instead of fixing the specifier. Change the logic to treat the
scoped enum's underlying type as the intended type to be printed, and
suggest format specifier changes and casts based on that.




More information about the All-commits mailing list