brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.7 KiB · a7bf1ce Raw
184 lines · cpp
1#include "../ctu-hdr.h"2 3int callback_to_main(int x);4int f(int x) {5  return x - 1;6}7 8int g(int x) {9  return callback_to_main(x) + 1;10}11 12int h_chain(int);13 14int h(int x) {15  return 2 * h_chain(x);16}17 18namespace myns {19int fns(int x) {20  return x + 7;21}22 23namespace embed_ns {24int fens(int x) {25  return x - 3;26}27} // namespace embed_ns28 29class embed_cls {30public:31  int fecl(int x);32};33int embed_cls::fecl(int x) {34  return x - 7;35}36} // namespace myns37 38class mycls {39public:40  int fcl(int x);41  virtual int fvcl(int x);42  static int fscl(int x);43 44  class embed_cls2 {45  public:46    int fecl2(int x);47  };48};49 50int mycls::fcl(int x) {51  return x + 5;52}53int mycls::fvcl(int x) {54  return x + 7;55}56int mycls::fscl(int x) {57  return x + 6;58}59int mycls::embed_cls2::fecl2(int x) {60  return x - 11;61}62 63class derived : public mycls {64public:65  virtual int fvcl(int x) override;66};67 68int derived::fvcl(int x) {69  return x + 8;70}71 72namespace chns {73int chf2(int x);74 75class chcls {76public:77  int chf4(int x);78};79 80int chf3(int x) {81  return chcls().chf4(x);82}83 84int chf1(int x) {85  return chf2(x);86}87}88 89typedef struct { int n; } Anonymous;90int fun_using_anon_struct(int n) { Anonymous anon; anon.n = n; return anon.n; }91 92int other_macro_diag(int x) {93  MACRODIAG();94  return x;95}96 97extern const int extInt = 2;98namespace intns {99extern const int extInt = 3;100}101struct S {102  int a;103};104extern const S extS = {.a = 4};105extern S extNonConstS = {.a = 4};106struct NonTrivialS {107  int a;108  ~NonTrivialS();109};110extern const NonTrivialS extNTS = {.a = 4};111struct A {112  static const int a;113};114const int A::a = 3;115struct SC {116  const int a;117};118extern const SC extSC = {.a = 8};119struct ST {120  static const struct SC sc;121};122const struct SC ST::sc = {.a = 2};123struct SCNest {124  struct SCN {125    const int a;126  } scn;127};128SCNest extSCN = {.scn = {.a = 9}};129extern SCNest::SCN const extSubSCN = {.a = 1};130struct SCC {131  SCC(int c) : a(c) {}132  const int a;133};134SCC extSCC{7};135union U {136  const int a;137  const unsigned int b;138};139extern const U extU = {.a = 4};140 141class TestAnonUnionUSR {142public:143  inline float f(int value) {144    union {145      float f;146      int i;147    };148    i = value;149    return f;150  }151  static const int Test;152};153const int TestAnonUnionUSR::Test = 5;154 155struct DefaultParmContext {156  static const int I;157  int f();158};159 160int fDefaultParm(int I = DefaultParmContext::I) {161  return I;162}163 164int testImportOfIncompleteDefaultParmDuringImport(int I) {165  return fDefaultParm(I);166}167 168const int DefaultParmContext::I = 0;169 170int DefaultParmContext::f() {171  return fDefaultParm();172}173 174class TestDelegateConstructor {175public:176  TestDelegateConstructor() : TestDelegateConstructor(2) {}177  TestDelegateConstructor(int) {}178};179 180int testImportOfDelegateConstructor(int i) {181  TestDelegateConstructor TDC;182  return i;183}184