-
Notifications
You must be signed in to change notification settings - Fork 0
/
example-1.cc
140 lines (115 loc) · 2.76 KB
/
example-1.cc
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// this is a test input with grammar errors
#include <vector>
#include <map>
#include "example-2.h"
using namespace std;
const int independentVariable = 1;
int independentFunction();
typedef std::vector<int> Int;
/** comment for MyClass */
class MyClass {
int property1;
static void method1();
public:
/** comment for MyClass() */
MyClass();
MyClass(const MyClass &);
MyClass(int a, Int b) : property2(a) {} /*< comment for MyClass(int, Int) */
Int method2();
MyClass(MyClass &&);
MyClass operator+(const MyClass &) noexcept;
operator int();
private:
/** comment for property2 */
Int property2;
/**
* comment for property 3
* still comment for property 3
*/
const float propertye3;
class InnerClass {
double b;
};
virtual void method3() const = 0;
template <typename T>
void fooInClass(T &in);
};
// non-doc comment
int baz();
/* non-doc comment */
template <typename T, typename U=Int, int N=1>
int templateFunc(T *pt, U *pu, int n=N);
/** comment for foo() */
int foo(int a, Int b);
// function bodies are skipped
MyClass::MyClass(int a, Int b) {
int aa = a;
Int bb = b;
}
namespace NS2 {
/* class template */
template <typename T, char C>
class templateClass {
T t_;
char c_ = C;
};
}
enum E : int {
a = 1,
b
};
/** comment for namespace */
namespace customNS {
int foo();
class Class;
}
static int staticGlobal;
class customNS::Class final {
static int staticData;
const int constData;
static const int staticConstData;
int b;
friend class classFriend;
friend int fooFriend();
size_t returnSizeT_int(int a);
bool returnBool_string_myclass_anotherclass(string s, MyClass obj, Another obj2);
std::vector<int> &returnVector_float_vector(float a, std::vector<int> b);
};
class classFriend {};
int fooFriend();
int a1, *a2;
std::map<int, int> m;
int foo() {
int aaa = 0;
return aaa;
}
Another ano;
struct EEClass {
enum class EE : char { ee1, ee2 };
};
typedef enum { eee1, eee2 } EnumTy;
enum { aaaaa, bbbbb };
class BaseClass {};
template <typename T>
struct BaseClass2 {};
template <typename T>
class ClassAgain {};
template <typename T>
class BaseClassWithAVeryUglyName_i_am_really_long_too {};
typedef BaseClassWithAVeryUglyName_i_am_really_long_too<char> TypeDefTemplateBase;
class VClass final
: private BaseClass, BaseClass2<ClassAgain<int>>, public virtual EEClass, protected TypeDefTemplateBase {
public:
VClass();
virtual ~VClass() = 0;
virtual void foo() = 0;
};
template <typename T>
class TemplateInheritanceChild : BaseClass2<T> {};
int *arrIntPtr[5];
char arrChar[] = { 'h', 'e', 'l', 'l', 'o', '\n' };
BaseClass arrVar[];
#define FUNCS(func_name, T) \
void func_name(T &in) noexcept {} \
void func_name(T &&in) throw() {}
FUNCS(returnVoid, char *) // two functions in one line; they'll have the same source location