1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // REQUIRES: has-clang-tidy 10 11 // The GCC compiler flags are not always compatible with clang-tidy. 12 // UNSUPPORTED: gcc 13 14 // TODO: run clang-tidy with modules enabled once they are supported 15 // RUN: %{clang-tidy} %s --warnings-as-errors=* -header-filter=.* --checks='-*,libcpp-*' --load=%{test-tools}/clang_tidy_checks/libcxx-tidy.plugin -- %{compile_flags} -fno-modules 16 // RUN: %{clang-tidy} %s --warnings-as-errors=* -header-filter=.* --config-file=%S/../../.clang-tidy -- -Wweak-vtables %{compile_flags} -fno-modules 17 18 // Prevent <ext/hash_map> from generating deprecated warnings for this test. 19 #if defined(__DEPRECATED) 20 # undef __DEPRECATED 21 #endif 22 23 /* 24 BEGIN-SCRIPT 25 26 for header in public_headers: 27 print("{}#{}include <{}>{}".format( 28 '#if ' + header_restrictions[header] + '\n' if header in header_restrictions else '', 29 3 * ' ' if header in header_restrictions else '', 30 header, 31 '\n#endif' if header in header_restrictions else '' 32 )) 33 34 END-SCRIPT 35 */ 36 37 // DO NOT MANUALLY EDIT ANYTHING BETWEEN THE MARKERS BELOW 38 // GENERATED-MARKER 39 #include <algorithm> 40 #include <any> 41 #include <array> 42 #include <atomic> 43 #if !defined(_LIBCPP_HAS_NO_THREADS) 44 # include <barrier> 45 #endif 46 #include <bit> 47 #include <bitset> 48 #include <cassert> 49 #include <ccomplex> 50 #include <cctype> 51 #include <cerrno> 52 #include <cfenv> 53 #include <cfloat> 54 #include <charconv> 55 #include <chrono> 56 #include <cinttypes> 57 #include <ciso646> 58 #include <climits> 59 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 60 # include <clocale> 61 #endif 62 #include <cmath> 63 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 64 # include <codecvt> 65 #endif 66 #include <compare> 67 #include <complex> 68 #include <complex.h> 69 #include <concepts> 70 #include <condition_variable> 71 #if (defined(__cpp_impl_coroutine) && __cpp_impl_coroutine >= 201902L) || (defined(__cpp_coroutines) && __cpp_coroutines >= 201703L) 72 # include <coroutine> 73 #endif 74 #include <csetjmp> 75 #include <csignal> 76 #include <cstdarg> 77 #include <cstdbool> 78 #include <cstddef> 79 #include <cstdint> 80 #include <cstdio> 81 #include <cstdlib> 82 #include <cstring> 83 #include <ctgmath> 84 #include <ctime> 85 #include <ctype.h> 86 #include <cuchar> 87 #if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) 88 # include <cwchar> 89 #endif 90 #if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) 91 # include <cwctype> 92 #endif 93 #include <deque> 94 #include <errno.h> 95 #include <exception> 96 #include <execution> 97 #include <expected> 98 #include <fenv.h> 99 #if !defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) 100 # include <filesystem> 101 #endif 102 #include <float.h> 103 #include <format> 104 #include <forward_list> 105 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && !defined(_LIBCPP_HAS_NO_FSTREAM) 106 # include <fstream> 107 #endif 108 #include <functional> 109 #if !defined(_LIBCPP_HAS_NO_THREADS) 110 # include <future> 111 #endif 112 #include <initializer_list> 113 #include <inttypes.h> 114 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 115 # include <iomanip> 116 #endif 117 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 118 # include <ios> 119 #endif 120 #include <iosfwd> 121 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 122 # include <iostream> 123 #endif 124 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 125 # include <istream> 126 #endif 127 #include <iterator> 128 #if !defined(_LIBCPP_HAS_NO_THREADS) 129 # include <latch> 130 #endif 131 #include <limits> 132 #include <limits.h> 133 #include <list> 134 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 135 # include <locale> 136 #endif 137 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 138 # include <locale.h> 139 #endif 140 #include <map> 141 #include <math.h> 142 #include <memory> 143 #include <memory_resource> 144 #if !defined(_LIBCPP_HAS_NO_THREADS) 145 # include <mutex> 146 #endif 147 #include <new> 148 #include <numbers> 149 #include <numeric> 150 #include <optional> 151 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 152 # include <ostream> 153 #endif 154 #include <queue> 155 #include <random> 156 #include <ranges> 157 #include <ratio> 158 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 159 # include <regex> 160 #endif 161 #include <scoped_allocator> 162 #if !defined(_LIBCPP_HAS_NO_THREADS) 163 # include <semaphore> 164 #endif 165 #include <set> 166 #include <setjmp.h> 167 #if !defined(_LIBCPP_HAS_NO_THREADS) 168 # include <shared_mutex> 169 #endif 170 #include <source_location> 171 #include <span> 172 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 173 # include <sstream> 174 #endif 175 #include <stack> 176 #if __cplusplus > 202002L && !defined(_LIBCPP_HAS_NO_THREADS) 177 # include <stdatomic.h> 178 #endif 179 #include <stdbool.h> 180 #include <stddef.h> 181 #include <stdexcept> 182 #include <stdint.h> 183 #include <stdio.h> 184 #include <stdlib.h> 185 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 186 # include <streambuf> 187 #endif 188 #include <string> 189 #include <string.h> 190 #include <string_view> 191 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 192 # include <strstream> 193 #endif 194 #include <system_error> 195 #include <tgmath.h> 196 #if !defined(_LIBCPP_HAS_NO_THREADS) 197 # include <thread> 198 #endif 199 #include <tuple> 200 #include <type_traits> 201 #include <typeindex> 202 #include <typeinfo> 203 #include <uchar.h> 204 #include <unordered_map> 205 #include <unordered_set> 206 #include <utility> 207 #include <valarray> 208 #include <variant> 209 #include <vector> 210 #include <version> 211 #if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) 212 # include <wchar.h> 213 #endif 214 #if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) 215 # include <wctype.h> 216 #endif 217 #if __cplusplus >= 201103L 218 # include <experimental/deque> 219 #endif 220 #if __cplusplus >= 201103L 221 # include <experimental/forward_list> 222 #endif 223 #if __cplusplus >= 201103L 224 # include <experimental/iterator> 225 #endif 226 #if __cplusplus >= 201103L 227 # include <experimental/list> 228 #endif 229 #if __cplusplus >= 201103L 230 # include <experimental/map> 231 #endif 232 #if __cplusplus >= 201103L 233 # include <experimental/memory_resource> 234 #endif 235 #if __cplusplus >= 201103L 236 # include <experimental/propagate_const> 237 #endif 238 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && __cplusplus >= 201103L 239 # include <experimental/regex> 240 #endif 241 #if __cplusplus >= 201103L 242 # include <experimental/set> 243 #endif 244 #if __cplusplus >= 201103L 245 # include <experimental/simd> 246 #endif 247 #if __cplusplus >= 201103L 248 # include <experimental/string> 249 #endif 250 #if __cplusplus >= 201103L 251 # include <experimental/type_traits> 252 #endif 253 #if __cplusplus >= 201103L 254 # include <experimental/unordered_map> 255 #endif 256 #if __cplusplus >= 201103L 257 # include <experimental/unordered_set> 258 #endif 259 #if __cplusplus >= 201103L 260 # include <experimental/utility> 261 #endif 262 #if __cplusplus >= 201103L 263 # include <experimental/vector> 264 #endif 265 #include <ext/hash_map> 266 #include <ext/hash_set> 267 // GENERATED-MARKER 268