[all-commits] [llvm/llvm-project] c9e462: [clang] retain type sugar in auto / template argum...

Matheus Izvekov via All-commits all-commits at lists.llvm.org
Mon Nov 15 14:08:02 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c9e46219f38da5c3fbfe41012173dc893516826e
      https://github.com/llvm/llvm-project/commit/c9e46219f38da5c3fbfe41012173dc893516826e
  Author: Matheus Izvekov <mizvekov at gmail.com>
  Date:   2021-11-15 (Mon, 15 Nov 2021)

  Changed paths:
    M clang-tools-extra/clang-tidy/cppcoreguidelines/OwningMemoryCheck.cpp
    M clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp
    M clang-tools-extra/clang-tidy/readability/QualifiedAutoCheck.cpp
    M clang-tools-extra/clangd/FindTarget.cpp
    M clang-tools-extra/clangd/InlayHints.cpp
    M clang-tools-extra/clangd/unittests/ASTTests.cpp
    M clang-tools-extra/clangd/unittests/HoverTests.cpp
    M clang-tools-extra/clangd/unittests/InlayHintTests.cpp
    M clang-tools-extra/clangd/unittests/tweaks/ExpandAutoTypeTests.cpp
    M clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-owning-memory.cpp
    M clang/include/clang/AST/ASTContext.h
    M clang/include/clang/AST/Type.h
    M clang/include/clang/ASTMatchers/ASTMatchersInternal.h
    M clang/include/clang/Sema/Sema.h
    M clang/lib/AST/ASTContext.cpp
    M clang/lib/AST/ASTImporter.cpp
    M clang/lib/AST/Type.cpp
    M clang/lib/Sema/SemaCXXScopeSpec.cpp
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaDeclCXX.cpp
    M clang/lib/Sema/SemaExprCXX.cpp
    M clang/lib/Sema/SemaInit.cpp
    M clang/lib/Sema/SemaLambda.cpp
    M clang/lib/Sema/SemaStmt.cpp
    M clang/lib/Sema/SemaTemplate.cpp
    M clang/lib/Sema/SemaTemplateDeduction.cpp
    M clang/lib/Sema/SemaType.cpp
    M clang/lib/Sema/TreeTransform.h
    M clang/test/CXX/over/over.match/over.match.funcs/over.match.class.deduct/p2.cpp
    M clang/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
    M clang/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp
    M clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp
    M clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p4.cpp
    M clang/test/Index/print-type.cpp
    M clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
    M clang/test/SemaCXX/cxx1z-decomposition.cpp
    M clang/test/SemaCXX/deduced-return-type-cxx14.cpp
    M clang/test/SemaCXX/friend.cpp
    M clang/test/SemaCXX/recovery-expr-type.cpp
    M clang/test/SemaCXX/sizeless-1.cpp
    A clang/test/SemaCXX/sugared-auto.cpp
    M clang/test/SemaTemplate/attributes.cpp
    M clang/test/SemaTemplate/deduction.cpp
    M clang/test/SemaTemplate/friend.cpp
    M clang/test/SemaTemplate/operator-template.cpp
    R libcxx/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp
    A libcxx/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.verify.cpp
    R libcxx/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp
    A libcxx/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.verify.cpp
    M lldb/test/Shell/SymbolFile/NativePDB/function-types-builtins.cpp

  Log Message:
  -----------
  [clang] retain type sugar in auto / template argument deduction

This implements the following changes:
* AutoType retains sugared deduced-as-type.
* Template argument deduction machinery analyses the sugared type all the way
down. It would previously lose the sugar on first recursion.
* Undeduced AutoType will be properly canonicalized, including the constraint
template arguments.
* Remove the decltype node created from the decltype(auto) deduction.

As a result, we start seeing sugared types in a lot more test cases,
including some which showed very unfriendly `type-parameter-*-*` types.

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

Reviewed By: rsmith, #libc, ldionne

Differential Revision: https://reviews.llvm.org/D110216




More information about the All-commits mailing list