[all-commits] [llvm/llvm-project] 7c402b: Reland [Clang] Make the SizeType, SignedSizeType a...

YexuanXiao via All-commits all-commits at lists.llvm.org
Fri Jul 18 23:44:35 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7c402b8b81d2b69b55eb5bac39830fbc631f8cde
      https://github.com/llvm/llvm-project/commit/7c402b8b81d2b69b55eb5bac39830fbc631f8cde
  Author: YexuanXiao <bizwen at nykz.org>
  Date:   2025-07-19 (Sat, 19 Jul 2025)

  Changed paths:
    M clang-tools-extra/clangd/unittests/FindTargetTests.cpp
    M clang-tools-extra/clangd/unittests/HoverTests.cpp
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/AST/ASTContext.h
    M clang/include/clang/AST/FormatString.h
    M clang/include/clang/AST/RecursiveASTVisitor.h
    M clang/include/clang/AST/Type.h
    M clang/include/clang/AST/TypeLoc.h
    M clang/include/clang/AST/TypeProperties.td
    M clang/include/clang/Basic/TypeNodes.td
    M clang/include/clang/Serialization/TypeBitCodes.def
    M clang/lib/AST/ASTContext.cpp
    M clang/lib/AST/ASTImporter.cpp
    M clang/lib/AST/ASTStructuralEquivalence.cpp
    M clang/lib/AST/FormatString.cpp
    M clang/lib/AST/ItaniumMangle.cpp
    M clang/lib/AST/PrintfFormatString.cpp
    M clang/lib/AST/ScanfFormatString.cpp
    M clang/lib/AST/Type.cpp
    M clang/lib/AST/TypePrinter.cpp
    M clang/lib/CodeGen/CGCall.cpp
    M clang/lib/CodeGen/CGCoroutine.cpp
    M clang/lib/CodeGen/CGDebugInfo.cpp
    M clang/lib/CodeGen/CGObjCMac.cpp
    M clang/lib/CodeGen/CodeGenFunction.cpp
    M clang/lib/Sema/SemaChecking.cpp
    M clang/lib/Sema/SemaExpr.cpp
    M clang/lib/Sema/SemaExprCXX.cpp
    M clang/lib/Sema/TreeTransform.h
    M clang/lib/Serialization/ASTReader.cpp
    M clang/lib/Serialization/ASTWriter.cpp
    M clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp
    M clang/test/AST/HLSL/is_structured_resource_element_compatible_concept.hlsl
    M clang/test/AST/ast-dump-array.cpp
    M clang/test/AST/ast-dump-expr-json.c
    M clang/test/AST/ast-dump-expr-json.cpp
    M clang/test/AST/ast-dump-expr.c
    M clang/test/AST/ast-dump-expr.cpp
    M clang/test/AST/ast-dump-openmp-distribute-parallel-for-simd.c
    M clang/test/AST/ast-dump-openmp-distribute-parallel-for.c
    M clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for-simd.c
    M clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for.c
    M clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for-simd.c
    M clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for.c
    M clang/test/AST/ast-dump-stmt-json.cpp
    M clang/test/AST/ast-dump-stmt.cpp
    M clang/test/AST/ast-dump-traits.cpp
    M clang/test/AST/ast-dump-types-errors-json.cpp
    M clang/test/Analysis/cfg.cpp
    M clang/test/Analysis/explain-svals.cpp
    M clang/test/Analysis/std-c-library-functions-arg-weakdeps.c
    M clang/test/Analysis/std-c-library-functions-lookup.c
    M clang/test/Analysis/std-c-library-functions-vs-stream-checker.c
    M clang/test/Analysis/std-c-library-functions.c
    M clang/test/CXX/drs/cwg2xx.cpp
    M clang/test/CXX/lex/lex.literal/lex.ext/p2.cpp
    M clang/test/CXX/lex/lex.literal/lex.ext/p5.cpp
    M clang/test/CXX/lex/lex.literal/lex.ext/p7.cpp
    M clang/test/FixIt/fixit-format-ios-nopedantic.m
    M clang/test/FixIt/format.m
    M clang/test/Sema/format-strings-fixit-ssize_t.c
    M clang/test/Sema/format-strings-scanf.c
    M clang/test/Sema/format-strings-size_t.c
    M clang/test/Sema/matrix-type-builtins.c
    M clang/test/Sema/ptrauth-atomic-ops.c
    M clang/test/Sema/ptrauth.c
    M clang/test/SemaCXX/cxx2c-trivially-relocatable.cpp
    M clang/test/SemaCXX/enum-scoped.cpp
    M clang/test/SemaCXX/microsoft-varargs-diagnostics.cpp
    M clang/test/SemaCXX/new-delete.cpp
    M clang/test/SemaCXX/static-assert-cxx26.cpp
    M clang/test/SemaCXX/type-aware-new-delete-basic-free-declarations.cpp
    M clang/test/SemaCXX/unavailable_aligned_allocation.cpp
    M clang/test/SemaHLSL/Language/AssignArray.hlsl
    M clang/test/SemaHLSL/Language/InitListAST.hlsl
    M clang/test/SemaObjC/matrix-type-builtins.m
    M clang/test/SemaOpenCL/cl20-device-side-enqueue.cl
    M clang/test/SemaTemplate/type_pack_element.cpp
    M clang/tools/libclang/CIndex.cpp
    M libcxx/test/libcxx/containers/sequences/deque/spare_block_handling.pass.cpp
    M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

  Log Message:
  -----------
  Reland [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types (#149613)

The checks for the 'z' and 't' format specifiers added in the original
PR #143653 had some issues and were overly strict, causing some build
failures and were consequently reverted at
https://github.com/llvm/llvm-project/commit/4c85bf2fe8042c855c9dd5be4b02191e9d071ffd.

In the latest commit
https://github.com/llvm/llvm-project/pull/149613/commits/27c58629ec76a703fde9c0b99b170573170b4a7a,
I relaxed the checks for the 'z' and 't' format specifiers, so warnings
are now only issued when they are used with mismatched types.

The original intent of these checks was to diagnose code that assumes
the underlying type of `size_t` is `unsigned` or `unsigned long`, for
example:

```c
printf("%zu", 1ul); // Not portable, but not an error when size_t is unsigned long
```  

However, it produced a significant number of false positives. This was
partly because Clang does not treat the `typedef` `size_t` and
`__size_t` as having a common "sugar" type, and partly because a large
amount of existing code either assumes `unsigned` (or `unsigned long`)
is `size_t`, or they define the equivalent of size_t in their own way
(such as
sanitizer_internal_defs.h).https://github.com/llvm/llvm-project/blob/2e67dcfdcd023df2f06e0823eeea23990ce41534/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h#L203



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