[PATCH] D142632: [clang][TypePrinter] Support expression template arguments when checking defaultedness

Michael Buch via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 26 07:35:16 PST 2023


Michael137 created this revision.
Michael137 added reviewers: erichkeane, aaron.ballman, aprantl, dblaikie.
Herald added a project: All.
Michael137 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch adds support for `TemplateArgument`s of kind
`TemplateArgument::Expression` to `clang::isSubstitutedDefaultArgument`.
We do so by evaluating both the `Pattern` and `Arg` expression to an
`APInt`, if we can, and comparing the results.

This will be useful in an upcoming change where
`clang::isSubstitutedDefaultArgument` gets called from `clang::Sema`
where the `TemplateArgument`s are instantiated as expressions (without
being evaluted to `APInt` beforehand).

**Testing**

- Added unit-tests


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142632

Files:
  clang/lib/AST/TypePrinter.cpp
  clang/unittests/AST/TypePrinterTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142632.492446.patch
Type: text/x-patch
Size: 6838 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230126/46dcdea5/attachment.bin>


More information about the cfe-commits mailing list