> -----Original Message----- > From: Aldy Hernandez [mailto:al...@redhat.com] > Sent: Wednesday, June 12, 2013 1:40 PM > To: Iyer, Balaji V > Cc: gcc-patches@gcc.gnu.org; Jason Merrill (ja...@redhat.com); > r...@redhat.com > Subject: Re: [PATCH] Cilk Plus Array Notation for C++ > > > >> Overall, a lot of the stuff in cp-array-notation.c looks familiar > >> from the C front- end changes. Can't you reuse a lot of it? > > > > I looked into trying to combine many functionality. The issue that > > prohibited me was templates and extra trees. For example, IF_STMT, > > FOR_STMT, MODOP_EXPR, etc are not available in C but are in C++. So, I > > had to add this additional check for those. Also, if we are processing > > templates we have to create different kind of trees (e.g MODOP_EXPR > > intead of MODIFY_EXPR). > > I see. > > > > > One way to do it is to break up the places where I am using C++ > > specific code and add a language hook to handle those. I tried doing > > that a while back and the whole thing looked a lot messy and I would > > imagine it would be hard to debug them in future (...atleast for me). > > This looked organized for me, even though a few code looks repeated. > > That's what I had in mind, but if you tried it and it looks worse, I guess I > can live > with it. > > >> You do all this type checking here, but aren't you doing the same > >> type checking in build_array_notation_ref() which you're going to > >> call anyway? It looks like there is some code duplication going on. > > > > The reason why we do this second type checking here is because we > > don't know what they could be when we are parsing it. For example, > > in: > > Couldn't you abstract the type checking out into a helper function shared by > both routines?
Yes, that I could do. I will fix it in the new upcoming Array Notation for C++ patch. Thanks, Balaji V. Iyer.