This is an archive of the discontinued LLVM Phabricator instance.

[clang][C++20] Fix clang/clangd assert/crash after compilation errors
ClosedPublic

Authored by DmitryPolukhin on Sep 15 2022, 8:41 AM.

Details

Summary

After compilation errors, expression a transformation result may not be usable.
It triggers an assert in RemoveNestedImmediateInvocation and SIGSEGV in case of
builds without asserts. This issue significantly affects clangd because source
may not be valid during typing. Tests cases that I attached was reduce from huge
C++ translation unit.

Test Plan: check-clang

Diff Detail

Event Timeline

DmitryPolukhin created this revision.Sep 15 2022, 8:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 15 2022, 8:41 AM
DmitryPolukhin requested review of this revision.Sep 15 2022, 8:41 AM
aaron.ballman accepted this revision.Sep 15 2022, 12:36 PM

LGTM! Please add a release note for the fix when you land the changes.

clang/test/SemaCXX/remove-nested-immediate-invocation-crash.cpp
4

This surely wins an award for "best line noise of the year" or something. :-D

This revision is now accepted and ready to land.Sep 15 2022, 12:36 PM

LGTM! Please add a release note for the fix when you land the changes.

Thank you for prompt review! Release notes update in D134112.
Also I found existing issues about this crash https://github.com/llvm/llvm-project/issues/53628.