blob: faca0b41aa6ef20b98c70e0ecb1150b1490f2243 [file] [log] [blame]
Jordan Roseb54cfa32013-02-01 19:50:01 +00001// Like the compiler, the static analyzer treats some functions differently if
2// they come from a system header -- for example, it is assumed that system
3// functions do not arbitrarily free() their parameters, and that some bugs
4// found in system headers cannot be fixed by the user and should be
5// suppressed.
Jordan Rose1e0e4002012-09-10 21:27:35 +00006#pragma clang system_header
7
8namespace std {
9 template <class T1, class T2>
10 struct pair {
11 T1 first;
12 T2 second;
13
14 pair() : first(), second() {}
15 pair(const T1 &a, const T2 &b) : first(a), second(b) {}
16
17 template<class U1, class U2>
18 pair(const pair<U1, U2> &other) : first(other.first), second(other.second) {}
19 };
20
21 typedef __typeof__(sizeof(int)) size_t;
22
23 template<typename T>
24 class vector {
25 T *_start;
26 T *_finish;
27 T *_end_of_storage;
28 public:
29 vector() : _start(0), _finish(0), _end_of_storage(0) {}
30 ~vector();
31
32 size_t size() const {
33 return size_t(_finish - _start);
34 }
35
36 void push_back();
37 T pop_back();
38
39 T &operator[](size_t n) {
40 return _start[n];
41 }
42
43 const T &operator[](size_t n) const {
44 return _start[n];
45 }
46
47 T *begin() { return _start; }
48 const T *begin() const { return _start; }
49
50 T *end() { return _finish; }
51 const T *end() const { return _finish; }
52 };
53
54 class exception {
55 public:
56 exception() throw();
57 virtual ~exception() throw();
58 virtual const char *what() const throw() {
59 return 0;
60 }
61 };
62}