forked from standardese/cppast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintegration.cpp
More file actions
132 lines (107 loc) · 3.07 KB
/
Copy pathintegration.cpp
File metadata and controls
132 lines (107 loc) · 3.07 KB
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
// Copyright (C) 2017-2018 Jonathan Müller <[email protected]>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
#include "test_parser.hpp"
#include <cppast/cpp_preprocessor.hpp>
using namespace cppast;
TEST_CASE("stdlib", "[!hide][integration]")
{
auto code = R"(
// list of headers from: http://en.cppreference.com/w/cpp/header
//#include <cstdlib> -- problem with compiler built-in stuff on OSX
#include <csignal>
//#include <csetjmp> -- same as above
#include <bitset>
#include <chrono>
#include <cstdarg>
#include <cstddef>
#include <ctime>
#include <functional>
#include <initializer_list>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <typeinfo>
#include <utility>
#include <memory>
#include <new>
#include <scoped_allocator>
#include <cfloat>
#include <climits>
#include <cstdint>
//#include <cinttypes> -- missing types from C header (for some reason)
#include <limits>
//#include <exception> -- weird issue with compiler built-in stuff
#include <cassert>
#include <cerrno>
#include <stdexcept>
#include <system_error>
#include <cctype>
#include <cstring>
#include <cwchar>
#include <cwctype>
//#include <cuchar> -- not supported on CI
#include <string>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <algorithm>
#include <iterator>
//#include <cmath> -- non-conforming GCC extension with regards to constexpr
//#include <complex> -- weird double include issue under MSVC
#include <numeric>
#include <random>
#include <ratio>
#include <valarray>
//#include <cfenv> -- same issue with cinttypes
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <ostream>
#include <sstream>
#include <streambuf>
#include <locale>
//#include <clocale> -- issue on OSX
#include <regex>
//#include <atomic> -- issue on MSVC
#include <condition_variable>
#include <future>
#include <mutex>
#include <thread>
)";
write_file("stdlib.cpp", code);
cpp_entity_index idx;
simple_file_parser<libclang_parser> parser(type_safe::ref(idx), default_logger());
libclang_compile_config config;
config.set_flags(cpp_standard::cpp_latest);
auto file = parser.parse("stdlib.cpp", config);
REQUIRE(!parser.error());
REQUIRE(file);
REQUIRE(resolve_includes(parser, file.value(), config) == 62);
REQUIRE(!parser.error());
}
TEST_CASE("cppast", "[!hide][integration]")
{
const char* files[] = {
#include <cppast_files.hpp>
};
cpp_entity_index idx;
simple_file_parser<libclang_parser> parser(type_safe::ref(idx), default_logger());
libclang_compilation_database database(CPPAST_COMPILE_COMMANDS);
libclang_compile_config config(database, CPPAST_INTEGRATION_FILE);
config.fast_preprocessing(true);
parse_files(parser, files, config);
REQUIRE(!parser.error());
}