[PATCH] clang-format: Add column layout formatting for braced lists

Manuel Klimek klimek at google.com
Thu Aug 22 06:07:30 PDT 2013



================
Comment at: lib/Format/TokenAnnotator.cpp:275
@@ -271,1 +274,3 @@
+        Left->Role.reset(new CommaSeparatedList(Style));
+      Left->getRoleAs<CommaSeparatedList>()->CommaFound(Current);
     } else if (Left->ParameterCount == 0 && Current->isNot(tok::comment)) {
----------------
Daniel Jasper wrote:
> Manuel Klimek wrote:
> > Daniel Jasper wrote:
> > > Manuel Klimek wrote:
> > > > I'd much rather have an interface for Role that contains all the "events" that can happen that are significant to roles, and use virtual methods.
> > > What's the benefit? We already need to know that we are dealing with a CommaSeparatedList in order to create it appropriately..
> > > 
> > > I agree that there might be more generic concepts once we have more Roles and understand them.
> > I think it's pretty predictable how Role will turn out, as it's a common pattern. 
> > 
> > It would help in that we could get rid of all the RTTI code?
> Cool.. Predict away, because I have no clue ..
> 
> Right, we can get rid of the RTTI code (I was unaware that everything else by now is clean .. this has gone through quite a few iterations). However, do you think something like "CommaFound" is good to have as a general method in Role? I am afraid that all the 'events' will be specific to one specific Role each ...
Right - perhaps we can think of something more generic than CommaFound that will put some more code into the role about this specific event. Now, *that* I'm happy to postpone until we have more roles, so we see what the exact abstraction level there is. It might be something like "consumeToken()" or similar.

For now, my main concern is to not introduce RTTI until we really need it.


http://llvm-reviews.chandlerc.com/D1457



More information about the cfe-commits mailing list