[cfe-dev] Contributing to C++2a feature implementation!

Richard Smith via cfe-dev cfe-dev at lists.llvm.org
Thu Oct 11 14:10:20 PDT 2018


On Thu, 11 Oct 2018 at 13:55, Kareem Kareem via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Thanks for the suggestions Richard. And thanks for the heads-up Nicolas :).
>
> I am interested to take on the pack expansion in lambda init-capture
> paper. I will come back to this thread with my questions later on. But as a
> start, it would be great if you can point me to the relevant parts in the
> code base so that I can start exploring at the right place.
>

Sure!

lambda-introducers (including init-captures) are parsed in
Parser::ParseLambdaIntroducer (in lib/Parse/ParseExprCXX.cpp). That code is
slightly complicated by the need to disambiguate between a
lambda-expression and an Objective-C message send expression, both of which
begin with a left square bracket followed by similar-looking things, but I
don't think that should introduce any new complications here.

Semantic analysis of init-captures is handled by lib/Sema/SemaLambda.cpp;
you'll need to decide how to represent a parsed and not-yet-expanded
init-capture pack there. (Perhaps modeling the type of the init-capture in
Sema::buildLambdaInitCaptureInitialization as a PackExpansionType in this
case would make sense.)

In TreeTransform::TransformLambdaExpr (in lib/Sema/TreeTransform.h), you'll
need to perform the actual pack expansion, when necessary. You should be
able to find other examples of how to do that elsewhere in that file.


> Best,
> Kareem
>
> ---- On Wed, 10 Oct 2018 22:41:42 +0200 *Richard Smith via cfe-dev
> <cfe-dev at lists.llvm.org <cfe-dev at lists.llvm.org>>* wrote ----
>
> On Wed, 10 Oct 2018 at 12:32, Nicolas Lesser via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
> On Wed, Oct 10, 2018 at 9:24 PM Richard Smith via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
> Hi Kareem!
>
> This sounds great, and we'd be happy to have more people helping out.
>
> On Tue, 9 Oct 2018 at 06:49, Kareem Kareem via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
>
> Hello,
>
> My name is Kareem and I am a C++ software engineer at TomTom. I would like
> to gain more experience in compilers by contributing to the implementation
> of experimental C++2a features as detailed on the Clang website [4].
>
> ===
>
> Here is my relevant background:
>
> 1 - I implemented a library for a research language called Impala. Impala
> is implemented on top of a compiler framework called AnyDSL [1].
> Specifically, I implemented a number of parallel primitives in Impala (e.g.
> map, reduce, radix sort). The library is inspired by Nvidia's CUB library
> [2].
>
> 2 - I participated in a research project to extend LLVM IR to natively
> support fork-join parallelism. In particular, I implemented an OpenMP
> frontend and backend to translate to and from Parallel-IR. The frontend and
> backend supported simple parallel loops.
>
> 3 - I did some tiny bug fixes in LLVM to properly propagate DebugInfo in
> some passes [3]. Nothing so fancy though :).
>
> ===
>
> It would great if an experienced member of the community is able to guide
> me through this by choosing a (somewhat beginner friendly) proposal that I
> can start looking into and probably point me to relevant literature.
>
>
> Here's a selection of smaller C++20 papers you could choose from:
>
>  * template-parameter-list for generic lambdas (http://wg21.link/p04282r2)
> -- this would involve parsing support and a few updates through various
> parts of the compiler to correctly deal with explicit template parameter
> lists (eg, AST pretty-printing)
>
>
> There is already patch for this in review: https://reviews.llvm.org/D36527
> . Might want to check that out before you duplicate work :)
>
>
> Oops, sorry! :)
>
>
>
>
>  * designated initializers (http://wg21.link/p0329r4) -- we already
> support most of this, but we do not have support for some of the syntax
> yet, and we accept things that are not part of the C++20 feature: we should
> add syntactic support for the new parts and produce appropriate "extension"
> warnings based on the current language mode
>  * [[likely]] and [[unlikely]] attributes (http://wg21.link/p0479r5) --
> adding the attributes themselves should be straightforward, but you'll also
> need to figure out how best to express the effects of these attributes in
> LLVM IR (whether by existing intrinsics and metadata or by adding a new
> construct that LLVM can lower at an appropriate moment)
>  * pack expansion in lambda init-capture (http://wg21.iink/p0780r2) --
> this'd be a good choice if you want to learn your way around the way Clang
> represents and instantiates templates
>
>
> I can commit to a GSoC-style partnership if any experienced member would
> be willing to do so.
>
> [1] https://anydsl.github.io/
> [2] https://nvlabs.github.io/cub/
> [3] https://reviews.llvm.org/p/ergawy/
> [4] https://clang.llvm.org/cxx_status.html
> <https://clang.llvm.org/cxx_status.html#ts>
>
> Best,
> Kareem
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181011/3c23d7b6/attachment.html>


More information about the cfe-dev mailing list