[PATCH] D111283: [clang] WIP: template / auto deduction deduces common sugar

Matheus Izvekov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 6 18:51:12 PDT 2021


mizvekov created this revision.
mizvekov published this revision for review.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch implements deducing the common sugar between two types,
and uses it to establish the result when checking deduced template arguments.

This carries over to auto return type deduction as well, which is reworked
to update the deduced type.

The common sugar is calculated by stripping of top-level sugar which differs
between types, crossing over and rebuilding non-sugar type nodes if needed.

TODO:

- Handle more types.
- Maybe in another patch: Add this logic to conditional operator.

Depends on D110216 <https://reviews.llvm.org/D110216>

Signed-off-by: Matheus Izvekov <mizvekov at gmail.com>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111283

Files:
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/lib/Sema/SemaTemplateDeduction.cpp
  clang/test/SemaCXX/sugared-auto.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111283.377728.patch
Type: text/x-patch
Size: 38974 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211007/c9bd2f2d/attachment-0001.bin>


More information about the cfe-commits mailing list