This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Fix modernize-loop-convert "multiple diag in flight" crash.
ClosedPublic

Authored by hokein on Apr 23 2020, 7:23 AM.

Diff Detail

Event Timeline

hokein created this revision.Apr 23 2020, 7:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 23 2020, 7:23 AM
sammccall accepted this revision.Apr 23 2020, 7:59 AM

Ah, nice work!
Agree it's a hack (and how many more instances are lurking) but I don't know how better to fix it and it's been reported 3 times...

clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
529

I'm not sure we need to mention clangd here - I'd expect standalone clang-tidy to be able to hit the same condition?
At least logically I think the bug exists either way.

clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
275

Does the bug repro with clang-tidy? If so it'd be nice to make this a clang-tidy test.

This revision is now accepted and ready to land.Apr 23 2020, 7:59 AM
hokein updated this revision to Diff 259832.Apr 24 2020, 1:44 AM
hokein marked 3 inline comments as done.

refine the fix.

Ah, nice work!
Agree it's a hack (and how many more instances are lurking) but I don't know how better to fix it and it's been reported 3 times...

this is the only place in clang-tidy calling getTypeInfo.

clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
529

yeah logically, but it doesn't trigger the assertion somehow (haven't dig into it). removed it.

I realized that the code below may change Descriptor.ElemType, refined the fix (we store the fixits, and emit the diagnostic at the end of the function).

clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
275

unfortunately, not for standalone clang-tidy :(

This revision was automatically updated to reflect the committed changes.