[cfe-commits] r76297 - in /cfe/trunk: include/clang/AST/Decl.h include/clang/AST/Redeclarable.h lib/AST/Decl.cpp
kyrtzidis at apple.com
Sat Jul 18 12:19:13 PDT 2009
On Jul 18, 2009, at 11:40 AM, Chris Lattner wrote:
> On Jul 18, 2009, at 1:50 AM, Argiris Kirtzidis wrote:
>> Author: akirtzidis
>> Date: Sat Jul 18 03:50:13 2009
>> New Revision: 76297
>> URL: http://llvm.org/viewvc/llvm-project?rev=76297&view=rev
>> Introduce the Redeclarable template class, which serves as a base
>> type defining the common interface for Decls that can be redeclared.
>> Make FunctionDecl and VarDecl use it.
> This is nice Argiris, but is there a way to do with with containment
> instead of multiple inheritance?
I don't quite see the problem in this case, it only adds a
PointerIntPair and a public interface to the derived subclass that
will get used through
the subclass (e.g. through FunctionDecl), Redeclarable is not actually
supposed to get used anywhere else by client code and the rest of the
is not supposed to be aware of it (you can cast to it but what's the
Can you elaborate on what do you think the problem is ?
> Alternatively, maybe there should be
> a new class between "RedeclarableDecl" that inherits from ValueDecl
> that VarDecl and FunctionDecl inherit from.
Injecting a whole new Decl subclass into the Decl hierarchy just for
this doesn't seem like a good idea.
And there are other classes that may use Redeclarable, like
FunctionTemplateDecl and ClassTemplateDecl, which also can be redeclared
but derive from TemplateDecl (which derive from NamedDecl).
More information about the cfe-commits