diff options
author | Richard Smith <richard@metafoo.co.uk> | 2022-05-05 14:52:57 -0700 |
---|---|---|
committer | Richard Smith <richard@metafoo.co.uk> | 2022-05-05 14:55:47 -0700 |
commit | c4f95ef86a224fe730d2219aab90e88a0e7b03d2 (patch) | |
tree | a2d3e42aebff3f74deb2d3bc527a345313f0bc46 /clang/lib/Frontend/FrontendActions.cpp | |
parent | 8b626a2caa672a174829105ff7749d8d9a080f2a (diff) | |
download | llvm-c4f95ef86a224fe730d2219aab90e88a0e7b03d2.zip llvm-c4f95ef86a224fe730d2219aab90e88a0e7b03d2.tar.gz llvm-c4f95ef86a224fe730d2219aab90e88a0e7b03d2.tar.bz2 |
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
Diffstat (limited to 'clang/lib/Frontend/FrontendActions.cpp')
-rw-r--r-- | clang/lib/Frontend/FrontendActions.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp index e219be3..10d6e1f 100644 --- a/clang/lib/Frontend/FrontendActions.cpp +++ b/clang/lib/Frontend/FrontendActions.cpp @@ -480,6 +480,8 @@ private: return "InitializingStructuredBinding"; case CodeSynthesisContext::MarkingClassDllexported: return "MarkingClassDllexported"; + case CodeSynthesisContext::BuildingBuiltinDumpStructCall: + return "BuildingBuiltinDumpStructCall"; } return ""; } |