This is an archive of the discontinued LLVM Phabricator instance.

[clang][Parse] Fix crash when emitting template diagnostic
ClosedPublic

Authored by tbaeder on Aug 28 2022, 9:52 PM.

Details

Summary

The integer value of the enum here is 6, which wasn't covered by the diagnostic.

This fixes https://github.com/llvm/llvm-project/issues/57415

Diff Detail

Event Timeline

tbaeder created this revision.Aug 28 2022, 9:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 28 2022, 9:52 PM
tbaeder requested review of this revision.Aug 28 2022, 9:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 28 2022, 9:52 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
tbaeder added inline comments.Aug 29 2022, 7:37 AM
clang/test/Parser/cxx-concept-declaration.cpp
3–4

I guess we can drop these two lines now.

cjdb added a subscriber: cjdb.Aug 29 2022, 8:25 AM
cjdb added inline comments.
clang/include/clang/Basic/DiagnosticParseKinds.td
779

Is "concept template" a term of art? I have never heard of that before.

tbaeder added inline comments.Aug 29 2022, 8:32 AM
clang/include/clang/Basic/DiagnosticParseKinds.td
779

The enum member is called clang::TNK_Concept_template, so I made up "concept template" from that. Not sure what to use instead, would just "refers to a concept" be better?

Please be sure to add a release note for the fix as well.

clang/include/clang/Basic/DiagnosticParseKinds.td
776–780

I think the issue is that TNK_Undeclared_template was added but this diagnostic was not updated accordingly. As best I can tell, ParseDeclCXX.cpp:1715-1725 makes that kind unused in this diagnostic as well.

clang/test/Parser/cxx-concept-declaration.cpp
3–4

Agreed (feel free to land as an NFC commit)

6–10
cjdb accepted this revision.Aug 29 2022, 9:29 AM

Thanks for looking into this so quickly. LGTM with Aaron's suggested changes.

This revision is now accepted and ready to land.Aug 29 2022, 9:29 AM
tbaeder updated this revision to Diff 456389.Aug 29 2022, 9:58 AM
tbaeder marked 3 inline comments as done.
aaron.ballman accepted this revision.Aug 29 2022, 10:06 AM

LGTM presuming precommit CI comes back green, but please don't forget the release note.