[cfe-dev] Moving named cast helpers out of Sema
Chris Lattner
clattner at apple.com
Thu Nov 6 00:36:22 PST 2008
On Nov 5, 2008, at 11:02 AM, Sebastian Redl wrote:
> Hi,
>
> Attached patch moves the C++ named cast helper functions out of Sema
> and makes them static functions local to their own file., as
> requested by Chris. (The patch also moves all named cast stuff to
> its own file.)
This looks great to me, thanks Sebastian!
> Unfortunately, this requires making a few helper functions that are
> private in Sema public, so I'm not sure if this patch is a good
> idea. What do you think?
I think it's the right thing to do. The entire Sema class is private
to the sema module. C++ doesn't have very fine grained access
control. For example, in Java, we'd make a bunch of these things
public within the sema package but private outside it. In this case,
it doesn't really matter, since all of Sema is private to the sema
library (not even in include/clang) so access control is not critical
here.
Quoeth Daniel:
> If the methods require the Sema object, I don't really think that
> moving them out of Sema makes sense or makes the code better.
To me, the real issue is that the Sema *class* is really about the
implementation of the actions module. Given the shear size of the
actions interface (which sema must implement) it is a huge class and
lacks any good modular breakdown. I'd much rather have complex/
involved subsystems split out as static functions where it makes
sense, just to reduce the size of the sema interfaces and make it more
clear what is part of the sema interface and part of the sema internal
implementation details.
Does this seem reasonable?
-Chris
More information about the cfe-dev
mailing list