This is an archive of the discontinued LLVM Phabricator instance.

[Clang] Fix Unevaluated LambdasBackport to Clang 14.0.1
AbandonedPublic

Authored by cor3ntin on Apr 15 2022, 3:02 AM.

Details

Summary

Unlike other types, when lambdas are instanciated,
they are recreated from scratch.
When an unevaluated lambdas appear in the type of a function,
parameter it is instanciated in the wrong declaration context,
as parameters are transformed before the function.

To support lambda in function parameters, we try to
compute whether they are dependant without looking at the
declaration context.

This is a short term stopgap solution to avoid clang
iceing. A better fix might be to inject some kind of
transparent declaration with correctly computed dependency
for function parameters, variable templates, etc.

Fixes https://github.com/llvm/llvm-project/issues/50376
Fixes https://github.com/llvm/llvm-project/issues/51414
Fixes https://github.com/llvm/llvm-project/issues/51416
Fixes https://github.com/llvm/llvm-project/issues/51641
Fixes https://github.com/llvm/llvm-project/issues/54296

Diff Detail

Event Timeline

cor3ntin created this revision.Apr 15 2022, 3:02 AM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: martong. · View Herald Transcript
cor3ntin requested review of this revision.Apr 15 2022, 3:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 15 2022, 3:02 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
cor3ntin retitled this revision from [Clang] Fix Unevaluated Lambdas Backport to Clang 14.0.1 to [Clang] Fix Unevaluated LambdasBackport to Clang 14.0.1.Apr 15 2022, 3:03 AM
cor3ntin edited reviewers, added: tstellar, aaron.ballman; removed: shafik.

@tstellar I wasn't sure what the procedure was for backporting fixes, so I made a PR. I think your suggestion of keeping the old signature works well.
This also modifies the serialized AST, is that an issue for backports? (If it is, I'm not sure i see a way to move forward with this!)

Thanks

@tstellar I wasn't sure what the procedure was for backporting fixes, so I made a PR. I think your suggestion of keeping the old signature works well.
This also modifies the serialized AST, is that an issue for backports? (If it is, I'm not sure i see a way to move forward with this!)

I don' t think we have a written policy about the serialized AST format like we do API/ABI. What are the use cases where maintaining the AST format is important? @rsmith Do you have any opinion about changing the serialized AST in a bugfix release?

cor3ntin abandoned this revision.Aug 17 2022, 8:09 AM

No longer pursuing that as llvm 14 seems EOL