Home | History | Annotate | Download | only in namespace
      1 //===-- main.cpp ------------------------------------------------*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 namespace {
     11     typedef unsigned int my_uint_t;
     12     int i; // Find the line number for anonymous namespace variable i.
     13 
     14     int myanonfunc (int a)
     15     {
     16         return a + a;
     17     }
     18 }
     19 
     20 namespace A {
     21     typedef unsigned int uint_t;
     22     namespace B {
     23         typedef unsigned int uint_t;
     24         int j; // Find the line number for named namespace variable j.
     25         int myfunc (int a);
     26         int myfunc2(int a)
     27         {
     28              return a + 2;
     29         }
     30         float myfunc (float f)
     31         {
     32             return f - 2.0;
     33         }
     34     }
     35 }
     36 
     37 namespace Y
     38 {
     39     typedef unsigned int uint_t;
     40     using A::B::j;
     41     int foo;
     42 }
     43 
     44 using A::B::j;          // using declaration
     45 
     46 namespace Foo = A::B;   // namespace alias
     47 
     48 using Foo::myfunc;      // using declaration
     49 
     50 using namespace Foo;    // using directive
     51 
     52 namespace A {
     53     namespace B {
     54         using namespace Y;
     55         int k;
     56     }
     57 }
     58 
     59 #include <stdio.h>
     60 int Foo::myfunc(int a)
     61 {
     62     ::my_uint_t anon_uint = 0;
     63     A::uint_t a_uint = 1;
     64     B::uint_t b_uint = 2;
     65     Y::uint_t y_uint = 3;
     66     i = 3;
     67     j = 4;
     68     printf("::i=%d\n", ::i);
     69     printf("A::B::j=%d\n", A::B::j);
     70     myanonfunc(3);
     71     return myfunc2(3) + j + i + a + 2 + anon_uint + a_uint + b_uint + y_uint; // Set break point at this line.
     72 }
     73 
     74 int
     75 main (int argc, char const *argv[])
     76 {
     77     return Foo::myfunc(12);
     78 }
     79