summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/lang/cpp/type_lookup/main.cpp
blob: ae44bfa7c7d57156e90fe6c0e9d4d5828b20cbe5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//===-- main.cpp ------------------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// In this test, we define struct that exist might exist at the different
// levels in the code and test that we can properly locate these types with
// a varienty of different expressions.

namespace nsp_a {
  struct namespace_only {
    int a;
  };
  struct namespace_and_file {
    int aa;
  };
  struct contains_type {
    struct in_contains_type {
      int aaa;
    };
  };
};
namespace nsp_b {
  struct namespace_only {
    int b;
  };
  struct namespace_and_file {
    int bb;
  };
  struct contains_type {
    struct in_contains_type {
      int bbb;
    };
  };
};

struct namespace_and_file {
  int ff;
};

struct contains_type {
  struct in_contains_type {
    int fff;
  };
};


int main (int argc, char const *argv[]) {
  nsp_a::namespace_only a_namespace_only = { 1 };
  nsp_a::namespace_and_file a_namespace_and_file = { 2 };
  nsp_a::contains_type::in_contains_type a_in_contains_type = { 3 };
  nsp_b::namespace_only b_namespace_only = { 11 };
  nsp_b::namespace_and_file b_namespace_and_file = { 22 };
  nsp_b::contains_type::in_contains_type b_in_contains_type = { 33 };
  namespace_and_file file_namespace_and_file = { 44 };
  contains_type::in_contains_type file_in_contains_type = { 55 };
  int i = 123; // Provide an integer that can be used for casting
  // Take address of "i" to ensure it is in memory
  if (&i == &argc) {
    i = -1;
  }
  return i == -1; // Set a breakpoint here
}
OpenPOWER on IntegriCloud