[clang-tools-extra] [clang-cl] Fix value of __FUNCTION__ in MSVC mode. (PR #67592)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 2 08:58:39 PDT 2023
================
@@ -291,6 +291,10 @@ struct PrintingPolicy {
/// parameters.
unsigned AlwaysIncludeTypeForTemplateArgument : 1;
+ // Prints "class" keyword before type template arguments. This is used when
+ // printing a function via the _FUNCTION__ or __func__ macro in MSVC mode.
+ unsigned UseClassForTemplateArgument : 1;
----------------
AaronBallman wrote:
This comment really threw me off because I thought this was about `template <typename Ty>` vs `template <class Ty>` and it's actually about whether we print an elaborated type specifier or not.
It would be nice if we could reuse `SuppressElaboration` for this purpose instead of adding a new policy field for it, but do we not have an `ElaboratedType` for the template argument and so we would never try to print the elaboration. So we really need the opposite, which is `ForcePrintingAsElaboratedType` (or similar) as a more general type printing feature. So that code like `S` will force writing `struct S` or `class S` even though an elaborated type was not used in source. WDYT?
https://github.com/llvm/llvm-project/pull/67592
More information about the cfe-commits
mailing list