[all-commits] [llvm/llvm-project] e3bd67: [clang][Sema] check default argument promotions fo...

inclyc via All-commits all-commits at lists.llvm.org
Wed Aug 31 19:11:14 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e3bd67eddf65b20956513e91715b1f997dae2690
      https://github.com/llvm/llvm-project/commit/e3bd67eddf65b20956513e91715b1f997dae2690
  Author: YingChi Long <me at inclyc.cn>
  Date:   2022-09-01 (Thu, 01 Sep 2022)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/AST/FormatString.h
    M clang/lib/AST/FormatString.cpp
    M clang/lib/Sema/SemaChecking.cpp
    M clang/test/Sema/format-strings-freebsd.c
    M clang/test/Sema/format-strings-scanf.c
    M clang/test/Sema/format-strings.c
    M clang/www/c_status.html

  Log Message:
  -----------
  [clang][Sema] check default argument promotions for printf

The main focus of this patch is to make ArgType::matchesType check for
possible default parameter promotions when the argType is not a pointer.
If so, no warning will be given for `int`, `unsigned int` types as
corresponding arguments to %hhd and %hd. However, the usage of %hhd
corresponding to short is relatively rare, and it is more likely to be a
misuse. This patch keeps the original behavior of clang like this as
much as possible, while making it more convenient to consider the
default arguments promotion.

Fixes https://github.com/llvm/llvm-project/issues/57102

Reviewed By: aaron.ballman, nickdesaulniers, #clang-language-wg

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




More information about the All-commits mailing list