[cfe-dev] Attempt at CXX Namespaces
    Chris Lattner 
    clattner at apple.com
       
    Mon Feb 25 13:33:06 PST 2008
    
    
  
On Feb 25, 2008, at 11:32 AM, Kevin Tew wrote:
> I've gotten serious and have written some code.
>
> Following the clang web page's advice, I've tried to start  
> implementing c++ namespaces.
> Currently, I'm trying to figure out how to add namespace members to  
> my NamespaceDecl.
>
> I'm very new to clang and learning as I go.   Comments/Suggestions  
> welcome.
Great!  First comments: please make sure your code fits into 80  
columns.  Second, make sure
comments are up to date: this is not a recorddecl :)
> +/// RecordDecl - Represents a cxx namespace .  For example:
> +//.   namespace X { };
> +/// This decl will be marked invalid if *any* members are invalid.
> +///
> +class NamespaceDecl : public RecordDecl {
Why is this class deriving from RecordDecl?  Namespaces "are not"  
records, so there shouldn't be an inheritance relation here.
> +
> +public:
> +  NamespaceDecl(Kind DK, SourceLocation L, IdentifierInfo *Id,  
> ScopedDecl*PrevDecl)
In this ctor, I don't think there is any reason to pass in a 'Kind'.   
The kind of NamespaceDecl is always Namespace.
Finally, please send patches as an attachment with .patch suffix. This  
avoids problems with some mailers.
Thanks for working on this!
-Chris
    
    
More information about the cfe-dev
mailing list