SemaOverload: Complete candidates before emitting the error, to ensure diagnostics...
authorDavid Blaikie <dblaikie@gmail.com>
Fri, 3 May 2019 00:44:50 +0000 (00:44 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Fri, 3 May 2019 00:44:50 +0000 (00:44 +0000)
commit5e328050503c52aff41f96c8c7ca538e3cab85d5
treea33472a5c50006cf417fb5e8fa4d0e1b454c33da
parentd45df094353b8b0b5f1f76d9f5f828c34595fe11
SemaOverload: Complete candidates before emitting the error, to ensure diagnostics emitted (or suppressed) during completion don't interfere with the overload notes

Because diagnostics and their notes are not connected at the API level,
if the error message for an overload is emitted, then the overload
candidates are completed - if a diagnostic is emitted during that work,
the notes related to overload candidates would be attached to the latter
diagnostic, not the original error. Sort of worse, if the latter
diagnostic was disabled, the notes are disabled.

Reviewers: rsmith

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

llvm-svn: 359854
clang/include/clang/AST/TemplateName.h
clang/include/clang/Basic/PartialDiagnostic.h
clang/include/clang/Sema/Overload.h
clang/lib/AST/TemplateName.cpp
clang/lib/Sema/SemaCast.cpp
clang/lib/Sema/SemaExprCXX.cpp
clang/lib/Sema/SemaInit.cpp
clang/lib/Sema/SemaOverload.cpp
clang/lib/Sema/SemaStmt.cpp
clang/test/SemaCXX/overload-template.cpp [new file with mode: 0644]