[all-commits] [llvm/llvm-project] 0442d0: [clang][Sema] Improve diagnostics for auto return ...

Yaxun (Sam) Liu via All-commits all-commits at lists.llvm.org
Tue May 30 20:36:48 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0442d08fdb173d89b0779d32eb929957a344f5e6
  Author: Yaxun (Sam) Liu <yaxun.liu at amd.com>
  Date:   2023-05-30 (Tue, 30 May 2023)

  Changed paths:
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Sema/SemaOverload.cpp
    M clang/lib/Sema/SemaStmt.cpp
    M clang/lib/Sema/SemaTemplateDeduction.cpp
    M clang/test/SemaCXX/auto-type-from-cxx.cpp

  Log Message:
  [clang][Sema] Improve diagnostics for auto return type

Currently when clang fails to deduce auto return type of a function,
it does not emit any notes about why it fails. This causes difficulty
for users to fix such errors.

Actually, clang already generates the information for emitting notes
about the failed deduction. There is a TODO for actually emitting

This patch tries to implement the TODO. Basically it passes the
failed template specialization candidate set from the point of
specialization failure back to the point where the deduction starts.

It is not comprehensive but would be a start for further improvement.

Reviewed by: Richard Smith, Matheus Izvekov

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

Fixes: SWDEV-354278

More information about the All-commits mailing list