This is an archive of the discontinued LLVM Phabricator instance.

[coroutines] Include "this" type when looking up coroutine_traits
AbandonedPublic

Authored by toby-allsopp on Jul 6 2017, 3:04 AM.

Details

Summary

In N4663, section [dcl.fct.def.coroutine] states that, in a coroutine
that is a non-static member function, the type of the implicit object
parameter is included immediately before the types of the function
parameters.

Event Timeline

toby-allsopp created this revision.Jul 6 2017, 3:04 AM
EricWF requested changes to this revision.Jul 7 2017, 10:49 PM

I think the test could be improved. First could you add the test within test/SemaCXX/coroutines.cpp? Second could you add some negative tests that check the diagnostics generated when you don't provide a specialization of coroutine traits (ie that the old behaviour of not including the class type now produces diagnostics). Could you also add tests for const/volatile and lvalue/rvalue qualified member functions?

lib/Sema/SemaCoroutine.cpp
85

This seems wrong to me.

getThisType returns the type of the this parameter as specified under [class.this] but according to the coroutines spec the type of the parameter should be the type of the implicit object parameter, which is specified under (over.match.funcs) p4.

441

Huh, I've never seen lambdas used like this before but I really like it.

This revision now requires changes to proceed.Jul 7 2017, 10:49 PM

I think the test could be improved. First could you add the test within test/SemaCXX/coroutines.cpp? Second could you add some negative tests that check the diagnostics generated when you don't provide a specialization of coroutine traits (ie that the old behaviour of not including the class type now produces diagnostics). Could you also add tests for const/volatile and lvalue/rvalue qualified member functions?

Will do, thanks for the suggestions.

lib/Sema/SemaCoroutine.cpp
85

Oh wow, that's a howler. I will check my tests against MSVC here. Thanks.

441

It's a sometimes controversial style called immediately-invoked lambda/function expression (IILE or IIFE). I saw other instances of it in this file (or possibly some other file in clang) so I'm assuming it's acceptable style.

GorNishanov edited edge metadata.Oct 3 2017, 8:53 AM

@toby-allsopp: You mentioned that @EricWF already got this in. Can you close ("abandon") this patch if it is no longer needed.

toby-allsopp abandoned this revision.Oct 4 2017, 3:56 PM

Yes, @EricWF made a much more comprehensive change that has been in for a while now. Abandoning.