This is an archive of the discontinued LLVM Phabricator instance.

[clangd] TargetFinder: Fix assert-crash on TemplateExpansion args.
ClosedPublic

Authored by adamcz on Oct 12 2021, 7:57 AM.

Details

Summary

Previously we would call getAsTemplate() when kind == TemplateExpansion,
which triggers an assertion. The call is now replaced with
getAsTemplateOrTemplatePattern(), which is exactly the same as
getAsTemplate(), except it allows calls when kind == TemplateExpansion.

No change in behavior for no-assert builds.

Diff Detail

Event Timeline

adamcz created this revision.Oct 12 2021, 7:57 AM
adamcz requested review of this revision.Oct 12 2021, 7:57 AM

Hi Nathan

Would you mind reviewing this change? It's related to your https://reviews.llvm.org/D85503

Thanks!

nridge accepted this revision.Oct 13 2021, 12:25 AM

Thanks for fixing this!

clang-tools-extra/clangd/unittests/FindTargetTests.cpp
351

The Flags.clear() in the previous cases is a leftover from when we used to do Flags = {"-fno-delayed-template-parsing"}; to get the test to pass on Windows. That has since been removed (it's set directly by TestTU), so the Flags.clear() is no longer necessary.

This revision is now accepted and ready to land.Oct 13 2021, 12:25 AM
adamcz updated this revision to Diff 379335.Oct 13 2021, 3:54 AM
adamcz marked an inline comment as done.

removed unnecessary Flags.clear()