This is an archive of the discontinued LLVM Phabricator instance.

Use C++14-style return type deduction in LLVM.
ClosedPublic

Authored by jlebar on Feb 10 2020, 9:42 PM.

Details

Summary

Simplifies the C++11-style "-> decltype(...)" return-type deduction.

Note that you have to be careful about whether the function return type
is auto or decltype(auto). The difference is that bare auto
strips const and reference, just like lambda return type deduction. In
some cases that's what we want (or more likely, we know that the return
type is a value type), but whenever we're wrapping a templated function
which might return a reference, we need to be sure that the return type
is decltype(auto).

No functional change.

Diff Detail

Event Timeline

jlebar created this revision.Feb 10 2020, 9:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 10 2020, 9:42 PM
bkramer accepted this revision.Feb 11 2020, 2:29 AM

good stuff

This revision is now accepted and ready to land.Feb 11 2020, 2:29 AM

Thank you for the review!

This revision was automatically updated to reflect the committed changes.