[cfe-dev] Attempt 2 at CXX Namespaces

Kevin Tew tewk at cs.utah.edu
Mon Feb 25 14:52:32 PST 2008

I've tried to incorporate both Chris and your suggestions.

Eli Friedman wrote:
> On Mon, Feb 25, 2008 at 11:32 AM, Kevin Tew <tewk at cs.utah.edu> 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.
> Hmm, not a bad start.  A couple of comments from reading your patch.
> First, make sure you don't go over 80 characters per line.  Second, I
> don't think that making NamespaceDecl a subclass of RecordDecl really
> makes sense: a namespace doesn't have members in the same sense that a
> class or struct does.  Maybe make it a direct subclass of ScopedDecl?
> Also, a few more tests might be appropriate.
> Doesn't necessarily need to be done in this patch, but it would be
> nice if the places that print out namespaced identifiers (like dump()
> and related) would print out the associated namespace, so that things
> don't get so confusing.
> Also, here's a testcase which I'm not sure your patch handles:
> namespace a { double i; }
> int i;
> namespace a {double* j = &i;}
> should not print a warning with -pedantic.
> I can't really come up with any other tests that have to do with
> namespaces in particular... namespaces are pretty simple without
> "using" and the :: operator.
> -Eli

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cxxnamespaces_try2.patch
Type: text/x-diff
Size: 7698 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080225/20426a21/attachment.patch>

More information about the cfe-dev mailing list