[PATCH] D58659: [Sema] Fix assertion when `auto` parameter in lambda has an attribute.

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 11 13:05:29 PDT 2019

vsapsai added inline comments.

Comment at: clang/lib/Sema/SemaType.cpp:261
+    /// necessary.
+    QualType ReplaceAutoType(QualType TypeWithAuto, QualType Replacement) {
+      QualType T = sema.ReplaceAutoType(TypeWithAuto, Replacement);
aaron.ballman wrote:
> I think this work should be done within `SubstituteDeducedTypeTransform` rather than on the side. Any caller to `Sema::ReplaceAutoType()` should get this same behavior.
Doing this work in `SubstituteDeducedTypeTransform` involves teaching `SubstituteDeducedTypeTransform` about `TypeProcessingState` and probably adding `TypeProcessingState` to `Sema::ReplaceAutoType()`. As for me, it exposes `TypeProcessingState` in more places than necessary. And it feels somewhat awkward that `SubstituteDeducedTypeTransform` is used in multiple places but `TypeProcessingState` is required only here.

I've modelled my approach after `TypeProcessingState::getAttributedType` where it forwards the call to Sema and keeps `AttrsForTypes` up to date. Do you still think `SubstituteDeducedTypeTransform` would be a better place for this code?



More information about the cfe-commits mailing list