[cfe-dev] C++ namespaces support

Argiris Kirtzidis akyrtzi at gmail.com
Mon Mar 24 18:20:21 PDT 2008


Hi,

The attached patch adds support for parsing C++ namespaces and resolving 
name lookups based on them.

This test indicates what is possible (added in the patch):

--------------------------------------------------------------
// RUN: clang -fsyntax-only -pedantic-errors -verify %s

namespace A {
  int a;

  namespace B {
    void fb();
  }
}

char *tu;

namespace A {
  namespace B {
    void fb() {
      a = 0;
    }
    namespace C {
      void fc1() {
        tu = a; // expected-error {{error: incompatible integer to 
pointer conversion assigning 'int', expected 'char *'}}
      }
    }
    int tu;
  }
}

namespace A {
  namespace B {
    namespace C {
      void fc2() {
        tu = a;
      }
    }
  }
}
---------------------------------------------------------------------------------

I've commented most of the changes, if something is not clear and you 
have any questions or suggestions,
please let me know.


-Argiris
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: namespaces.patch
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080324/08263272/attachment.ksh>


More information about the cfe-dev mailing list