[all-commits] [llvm/llvm-project] c27e28: [Clang] Make the SizeType, SignedSizeType and Ptrd...
YexuanXiao via All-commits
all-commits at lists.llvm.org
Thu Jul 17 18:46:19 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c27e283cfbca2bd22f34592430e98ee76ed60ad8
https://github.com/llvm/llvm-project/commit/c27e283cfbca2bd22f34592430e98ee76ed60ad8
Author: YexuanXiao <bizwen at nykz.org>
Date: 2025-07-17 (Thu, 17 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-int-typedefs.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/format-size-spec-nsinteger.m
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:
-----------
[Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (#143653)
Including the results of `sizeof`, `sizeof...`, `__datasizeof`,
`__alignof`, `_Alignof`, `alignof`, `_Countof`, `size_t` literals, and
signed `size_t` literals, the results of pointer-pointer subtraction and
checks for standard library functions (and their calls).
The goal is to enable clang and downstream tools such as clangd and
clang-tidy to provide more portable hints and diagnostics.
The previous discussion can be found at #136542.
This PR implements this feature by introducing a new subtype of `Type`
called `PredefinedSugarType`, which was considered appropriate in
discussions. I tried to keep `PredefinedSugarType` simple enough yet not
limited to `size_t` and `ptrdiff_t` so that it can be used for other
purposes. `PredefinedSugarType` wraps a canonical `Type` and provides a
name, conceptually similar to a compiler internal `TypedefType` but
without depending on a `TypedefDecl` or a source file.
Additionally, checks for the `z` and `t` format specifiers in format
strings for `scanf` and `printf` were added. It will precisely match
expressions using `typedef`s or built-in expressions.
The affected tests indicates that it works very well.
Several code require that `SizeType` is canonical, so I kept `SizeType`
to its canonical form.
The failed tests in CI are allowed to fail. See the
[comment](https://github.com/llvm/llvm-project/pull/135386#issuecomment-3049426611)
in another PR #135386.
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