This is an archive of the discontinued LLVM Phabricator instance.

[clang] Construct ExprRequirement with SubstitutionDiagnostic on SubstFailure
ClosedPublic

Authored by zyounan on Aug 16 2023, 2:43 AM.

Details

Summary

We're expecting a SubstitutionDiagnostic in diagnoseUnsatisfiedRequirement
if the status of ExprRequirement is SubstFailure. Previously, the Requirement
was created with Expr on SubstFailure by mistake, which could lead to the
assertion failure in the subsequent diagnosis.

Fixes https://github.com/clangd/clangd/issues/1726
Fixes https://github.com/llvm/llvm-project/issues/64723
Fixes https://github.com/llvm/llvm-project/issues/64172

In addition, this patch also fixes an invalid test from D129499.

Diff Detail

Event Timeline

zyounan created this revision.Aug 16 2023, 2:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 16 2023, 2:43 AM
Herald added a subscriber: kadircet. · View Herald Transcript
zyounan published this revision for review.Aug 16 2023, 2:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 16 2023, 2:49 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
zyounan updated this revision to Diff 550683.Aug 16 2023, 2:53 AM

Rebase and format

zyounan added inline comments.Aug 16 2023, 6:00 AM
clang/lib/Sema/SemaExprCXX.cpp
9085

I'm adding another assertion here following up on D157554: If IDC is nullptr somehow, we will fall into the cast statement in the else block and crash anyway.

zyounan updated this revision to Diff 551726.Aug 19 2023, 2:34 AM

Add release note

zyounan updated this revision to Diff 551728.Aug 19 2023, 2:42 AM

Rebase and Remove the stray status

Gently ping~

Hi, sorry for the delay in reviewing, I'm just coming back from an extended vacation. This looks alright, except for the test.

clang/test/SemaCXX/concept-crash-on-diagnostic.cpp
27

Please don't do this, actually write out the remaining diagnostics. Same with the notes above.

Additionally, please use the 'bookmark' feature of verify-consumer to make sure the diagnostics/notes are in proper order (which makes it easier to figure out when reviewing).

zyounan updated this revision to Diff 554914.Aug 31 2023, 12:09 AM
zyounan marked an inline comment as done.

Expand diagnostics in the test.

Thanks for the review!

clang/test/SemaCXX/concept-crash-on-diagnostic.cpp
27

Thanks for reminding me. Will do that.

zyounan updated this revision to Diff 554919.Aug 31 2023, 12:22 AM

Rebase to main

erichkeane accepted this revision.Aug 31 2023, 10:02 AM

Clean up the test layout a little as a part of the commit, otherwise, LGTM!

clang/test/SemaCXX/concept-crash-on-diagnostic.cpp
29

So I typically don't do the 'error' with a bookmark, just put the 'error' next to the line that causes the error, and bookmark the note. It makes it easier to read.

This revision is now accepted and ready to land.Aug 31 2023, 10:02 AM
zyounan marked an inline comment as done.Aug 31 2023, 11:42 PM

Thanks again for the review!

clang/test/SemaCXX/concept-crash-on-diagnostic.cpp
29

Good suggestion!

zyounan updated this revision to Diff 555277.Aug 31 2023, 11:42 PM
zyounan marked an inline comment as done.

Address one last nit comment.