[all-commits] [llvm/llvm-project] c4f95e: Reimplement `__builtin_dump_struct` in Sema.
Richard Smith via All-commits
all-commits at lists.llvm.org
Thu May 5 14:56:03 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c4f95ef86a224fe730d2219aab90e88a0e7b03d2
https://github.com/llvm/llvm-project/commit/c4f95ef86a224fe730d2219aab90e88a0e7b03d2
Author: Richard Smith <richard at metafoo.co.uk>
Date: 2022-05-05 (Thu, 05 May 2022)
Changed paths:
M clang/docs/LanguageExtensions.rst
M clang/docs/ReleaseNotes.rst
M clang/include/clang/Basic/Builtins.def
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/include/clang/Sema/Sema.h
M clang/lib/CodeGen/CGBuiltin.cpp
M clang/lib/Frontend/FrontendActions.cpp
M clang/lib/Sema/SemaChecking.cpp
M clang/lib/Sema/SemaTemplateInstantiate.cpp
A clang/test/CodeGen/builtin-dump-struct.c
R clang/test/CodeGen/dump-struct-builtin.c
A clang/test/CodeGenCXX/builtin-dump-struct.cpp
M clang/test/Sema/builtin-dump-struct.c
A clang/test/SemaCXX/builtin-dump-struct.cpp
Log Message:
-----------
Reimplement `__builtin_dump_struct` in Sema.
Compared to the old implementation:
* In C++, we only recurse into aggregate classes.
* Unnamed bit-fields are not printed.
* Constant evaluation is supported.
* Proper conversion is done when passing arguments through `...`.
* Additional arguments are supported and are injected prior to the
format string; this directly supports use with `fprintf`, for example.
* An arbitrary callable can be passed rather than only a function
pointer. In particular, in C++, a function template or overload set is
acceptable.
* All text generated by Clang is printed via `%s` rather than directly;
this avoids issues where Clang's pretty-printing output might itself
contain a `%` character.
* Fields of types that we don't know how to print are printed with a
`"*%p"` format and passed by address to the print function.
* No return value is produced.
Reviewed By: aaron.ballman, erichkeane, yihanaa
Differential Revision: https://reviews.llvm.org/D124221
More information about the All-commits
mailing list