[all-commits] [llvm/llvm-project] e3750f: [Clang] Add diagnostic about "%P" specifier with O...

Jared Grubb via All-commits all-commits at lists.llvm.org
Mon Apr 29 09:16:22 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e3750fb65acf0f7447f6a49a0ba5d3197f4d9766
      https://github.com/llvm/llvm-project/commit/e3750fb65acf0f7447f6a49a0ba5d3197f4d9766
  Author: Jared Grubb <jaredgrubb at gmail.com>
  Date:   2024-04-29 (Mon, 29 Apr 2024)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Sema/SemaChecking.cpp
    M clang/test/SemaObjC/format-strings-oslog.m

  Log Message:
  -----------
  [Clang] Add diagnostic about "%P" specifier with Objective-C pointers (#89977)

A Darwin extension '%P' combined with an Objective-C pointer seems to
always be a bug.

'%P' will dump bytes at the pointed-to address (in contrast to '%p'
which dumps the pointer itself). This extension is only allowed in "OS
Log" contexts and is intended to be used like `%{uuid_t}.*16P` or
`%{timeval}.*P`. If an ObjC pointer is used, then the internal runtime
structure (aka, the is-a pointer and other runtime metadata) will be
dumped, which (IMO) is never the expectation.

A simple diagnostic can help flag these scenarios.

Resolves https://github.com/llvm/llvm-project/issues/89968

Co-authored-by: Jared Grubb <jgrubb at apple.com>



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