[cfe-dev] Iterating redeclared DeclContexts

Kyle Sluder kyle at ksluder.com
Sun Feb 9 02:45:23 PST 2014


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



More information about the cfe-dev mailing list