[cfe-dev] Iterating redeclared DeclContexts

Richard Smith richard at metafoo.co.uk
Sun Feb 9 10:36:01 PST 2014


None of the other Redeclarable DeclContexts we currently have want this
behaviour. (And in the presence of C++ modules, it wouldn't be correct - in
that case, we only want to perform lookups into the class definition, not
into any other class definition we've merged with it).

I suggest you just special-case the two forms of namespace. (Or use
Objective-C++ ;).)
On 9 Feb 2014 02:48, "Kyle Sluder" <kyle at ksluder.com> wrote:

> Hi folks,
>
> I'm hacking on an implementation of namespaces for Objective-C, which
> you can follow here:
> https://github.com/kylesluder/objc-namespaces/tree/develop
>
> While extending DeclContext to cover ObjC namespaces, I noticed that
> DeclContext::collectAllContexts() specifically only works on
> NamespaceDecls.
>
> The log attached to that commit explicitly calls out
> Redeclarable<NamespaceDecl>, so I'm curious why the code checks for
> NamespaceDecl rather than working for all Redeclarable<> subtypes.
>
> This is relevant to me, as I would like my namespaces to be redeclarable
> as well. :) And presumably, if another kind of redeclarable DeclContext
> comes along, it too would want to participate. (In fact, I'm surprised
> this doesn't already cause problems with ObjCInterfaceDecl.)
>
> Would the project be interested in a patch that made this work with all
> classes that derive from Redeclarable<>?
>
> --Kyle Sluder
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140209/d01238ab/attachment.html>


More information about the cfe-dev mailing list