1# This file is licensed under the Apache License v2.0 with LLVM Exceptions. 2# See https://llvm.org/LICENSE.txt for license information. 3# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 4 5package( 6 default_visibility = ["//visibility:public"], 7) 8 9licenses(["notice"]) 10 11cc_test( 12 name = "ast_tests", 13 size = "medium", 14 srcs = glob( 15 [ 16 "AST/*.cpp", 17 "AST/*.h", 18 ], 19 allow_empty = False, 20 ), 21 shard_count = 20, 22 deps = [ 23 "//clang:ast", 24 "//clang:ast_matchers", 25 "//clang:basic", 26 "//clang:frontend", 27 "//clang:lex", 28 "//clang:testing", 29 "//clang:tooling", 30 "//llvm:Core", 31 "//llvm:Support", 32 "//llvm:TargetParser", 33 "//llvm:TestingAnnotations", 34 "//llvm:TestingSupport", 35 "//third-party/unittest:gmock", 36 "//third-party/unittest:gtest", 37 "//third-party/unittest:gtest_main", 38 ], 39) 40 41cc_library( 42 name = "ast_matchers_tests_hdrs", 43 testonly = 1, 44 hdrs = glob( 45 ["ASTMatchers/*.h"], 46 allow_empty = False, 47 ), 48 deps = [ 49 "//clang:ast_matchers", 50 "//clang:frontend", 51 "//clang:testing", 52 "//clang:tooling", 53 "//third-party/unittest:gtest", 54 ], 55) 56 57cc_test( 58 name = "ast_matchers_tests", 59 size = "medium", 60 srcs = glob( 61 ["ASTMatchers/*.cpp"], 62 allow_empty = False, 63 ), 64 shard_count = 20, 65 deps = [ 66 ":ast_matchers_tests_hdrs", 67 "//clang:ast", 68 "//clang:ast_matchers", 69 "//clang:frontend", 70 "//clang:testing", 71 "//clang:tooling", 72 "//llvm:Support", 73 "//llvm:TargetParser", 74 "//llvm:TestingSupport", 75 "//third-party/unittest:gtest", 76 "//third-party/unittest:gtest_main", 77 ], 78) 79 80cc_test( 81 name = "ast_matchers_dynamic_tests", 82 size = "small", 83 srcs = glob( 84 ["ASTMatchers/Dynamic/*.cpp"], 85 allow_empty = False, 86 ), 87 deps = [ 88 ":ast_matchers_tests_hdrs", 89 "//clang:ast_matchers", 90 "//clang:ast_matchers_dynamic", 91 "//clang:frontend", 92 "//clang:tooling", 93 "//llvm:Support", 94 "//third-party/unittest:gtest", 95 "//third-party/unittest:gtest_main", 96 ], 97) 98 99cc_test( 100 name = "analysis_tests", 101 size = "small", 102 srcs = glob( 103 [ 104 "Analysis/*.cpp", 105 "Analysis/*.h", 106 ], 107 allow_empty = False, 108 ), 109 deps = [ 110 "//clang:analysis", 111 "//clang:ast", 112 "//clang:ast_matchers", 113 "//clang:basic", 114 "//clang:frontend", 115 "//clang:lex", 116 "//clang:parse", 117 "//clang:tooling", 118 "//llvm:Support", 119 "//third-party/unittest:gmock", 120 "//third-party/unittest:gtest", 121 "//third-party/unittest:gtest_main", 122 ], 123) 124 125cc_test( 126 name = "analysis_flow_sensitive_tests", 127 srcs = glob( 128 [ 129 "Analysis/FlowSensitive/*.cpp", 130 "Analysis/FlowSensitive/*.h", 131 ], 132 allow_empty = False, 133 ), 134 deps = [ 135 "//clang:analysis", 136 "//clang:ast", 137 "//clang:ast_matchers", 138 "//clang:basic", 139 "//clang:frontend", 140 "//clang:lex", 141 "//clang:serialization", 142 "//clang:testing", 143 "//clang:tooling", 144 "//llvm:Support", 145 "//llvm:TestingADT", 146 "//llvm:TestingAnnotations", 147 "//llvm:TestingSupport", 148 "//third-party/unittest:gmock", 149 "//third-party/unittest:gtest", 150 "//third-party/unittest:gtest_main", 151 ], 152) 153 154cc_test( 155 name = "basic_tests", 156 size = "small", 157 srcs = glob( 158 ["Basic/*.cpp"], 159 allow_empty = False, 160 ), 161 deps = [ 162 "//clang:basic", 163 "//clang:frontend", 164 "//clang:lex", 165 "//llvm:Support", 166 "//llvm:TestingSupport", 167 "//llvm:config", 168 "//third-party/unittest:gmock", 169 "//third-party/unittest:gtest", 170 "//third-party/unittest:gtest_main", 171 ], 172) 173 174cc_test( 175 name = "codegen_tests", 176 size = "small", 177 srcs = glob( 178 [ 179 "CodeGen/*.cpp", 180 "CodeGen/*.h", 181 ], 182 allow_empty = False, 183 ), 184 deps = [ 185 "//clang:ast", 186 "//clang:basic", 187 "//clang:codegen", 188 "//clang:frontend", 189 "//clang:lex", 190 "//clang:parse", 191 "//clang:sema", 192 "//llvm:Core", 193 "//llvm:Support", 194 "//llvm:TargetParser", 195 "//third-party/unittest:gtest", 196 "//third-party/unittest:gtest_main", 197 ], 198) 199 200cc_test( 201 name = "format_tests", 202 size = "medium", 203 srcs = glob( 204 [ 205 "Format/*.cpp", 206 "Format/*.h", 207 "Tooling/*.h", 208 ], 209 allow_empty = False, 210 ), 211 copts = ["$(STACK_FRAME_UNLIMITED)"], 212 features = ["-layering_check"], # #include "../../lib/Format/TokenAnalyzer.h" 213 shard_count = 20, 214 deps = [ 215 "//clang:basic", 216 "//clang:format", 217 "//clang:frontend", 218 "//clang:rewrite", 219 "//clang:tooling_core", 220 "//llvm:Support", 221 "//third-party/unittest:gmock", 222 "//third-party/unittest:gtest", 223 "//third-party/unittest:gtest_main", 224 ], 225) 226 227cc_test( 228 name = "frontend_tests", 229 size = "small", 230 srcs = glob( 231 ["Frontend/*.cpp"], 232 allow_empty = False, 233 ), 234 deps = [ 235 "//clang:ast", 236 "//clang:basic", 237 "//clang:codegen", 238 "//clang:driver_options_inc_gen", 239 "//clang:frontend", 240 "//clang:frontend_tool", 241 "//clang:lex", 242 "//clang:sema", 243 "//clang:serialization", 244 "//llvm:Support", 245 "//llvm:TargetParser", 246 "//third-party/unittest:gmock", 247 "//third-party/unittest:gtest", 248 "//third-party/unittest:gtest_main", 249 ], 250) 251 252cc_test( 253 name = "lex_tests", 254 size = "small", 255 srcs = glob( 256 [ 257 "Lex/*.cpp", 258 "Lex/*.h", 259 ], 260 allow_empty = False, 261 ), 262 copts = ["$(STACK_FRAME_UNLIMITED)"], 263 deps = [ 264 "//clang:ast", 265 "//clang:basic", 266 "//clang:frontend", 267 "//clang:lex", 268 "//clang:parse", 269 "//clang:sema", 270 "//clang:serialization", 271 "//llvm:Support", 272 "//llvm:TestingAnnotations", 273 "//llvm:TestingSupport", 274 "//third-party/unittest:gmock", 275 "//third-party/unittest:gtest", 276 "//third-party/unittest:gtest_main", 277 ], 278) 279 280# A library to carefully expose the tooling headers using the include prefix 281# expected by the `rename_tests`. 282cc_library( 283 name = "rename_tests_tooling_hdrs", 284 testonly = 1, 285 hdrs = glob( 286 ["Tooling/*.h"], 287 allow_empty = False, 288 ), 289 include_prefix = "unittests", 290 deps = [ 291 "//clang:ast", 292 "//clang:basic", 293 "//clang:frontend", 294 "//clang:rewrite", 295 "//clang:tooling", 296 "//clang:tooling_core", 297 "//llvm:Support", 298 "//third-party/unittest:gtest", 299 ], 300) 301 302cc_test( 303 name = "rewrite_tests", 304 size = "small", 305 srcs = glob( 306 ["Rewrite/*.cpp"], 307 allow_empty = False, 308 ), 309 deps = [ 310 "//clang:rewrite", 311 "//clang:tooling", 312 "//third-party/unittest:gtest", 313 "//third-party/unittest:gtest_main", 314 ], 315) 316 317cc_test( 318 name = "sema_tests", 319 size = "small", 320 srcs = glob( 321 ["Sema/*.cpp"], 322 allow_empty = False, 323 ), 324 deps = [ 325 ":ast_matchers_tests_hdrs", 326 "//clang:ast", 327 "//clang:ast_matchers", 328 "//clang:frontend", 329 "//clang:lex", 330 "//clang:parse", 331 "//clang:sema", 332 "//clang:tooling", 333 "//llvm:TestingAnnotations", 334 "//llvm:TestingSupport", 335 "//third-party/unittest:gmock", 336 "//third-party/unittest:gtest", 337 "//third-party/unittest:gtest_main", 338 ], 339) 340 341cc_library( 342 name = "static_analyzer_test_headers", 343 testonly = 1, 344 hdrs = glob( 345 ["StaticAnalyzer/*.h"], 346 allow_empty = False, 347 ), 348 deps = [ 349 "//clang:ast_matchers", 350 "//clang:crosstu", 351 "//clang:frontend", 352 "//clang:static_analyzer_core", 353 "//clang:static_analyzer_frontend", 354 "//clang:testing", 355 "//clang:tooling", 356 "//third-party/unittest:gtest", 357 ], 358) 359 360cc_test( 361 name = "static_analyzer_tests", 362 size = "small", 363 srcs = glob( 364 ["StaticAnalyzer/*.cpp"], 365 allow_empty = False, 366 exclude = [ 367 # New test has unused-variable warnings. 368 "StaticAnalyzer/ParamRegionTest.cpp", 369 ], 370 ), 371 deps = [ 372 ":static_analyzer_test_headers", 373 "//clang:analysis", 374 "//clang:ast", 375 "//clang:ast_matchers", 376 "//clang:basic", 377 "//clang:frontend", 378 "//clang:static_analyzer_core", 379 "//clang:static_analyzer_frontend", 380 "//clang:testing", 381 "//clang:tooling", 382 "//llvm:Support", 383 "//llvm:config", 384 "//third-party/unittest:gtest", 385 "//third-party/unittest:gtest_main", 386 ], 387) 388 389cc_test( 390 name = "tooling_tests", 391 size = "medium", 392 srcs = glob( 393 [ 394 "Tooling/*.cpp", 395 "Tooling/*.h", 396 ], 397 allow_empty = False, 398 ), 399 shard_count = 20, 400 deps = [ 401 "//clang:ast", 402 "//clang:ast_matchers", 403 "//clang:basic", 404 "//clang:driver", 405 "//clang:format", 406 "//clang:frontend", 407 "//clang:lex", 408 "//clang:rewrite", 409 "//clang:testing", 410 "//clang:tooling", 411 "//clang:tooling_core", 412 "//clang:tooling_dependency_scanning", 413 "//clang:tooling_inclusions", 414 "//clang:tooling_refactoring", 415 "//clang:transformer", 416 "//llvm:MC", 417 "//llvm:Support", 418 "//llvm:TargetParser", 419 "//llvm:TestingAnnotations", 420 "//llvm:TestingSupport", 421 "//third-party/unittest:gmock", 422 "//third-party/unittest:gtest", 423 "//third-party/unittest:gtest_main", 424 ], 425) 426 427# A library to carefully expose the tooling headers using the include prefix 428# expected by the `tooling_recursive_ast_visitor_tests`. 429cc_library( 430 name = "tooling_recursive_ast_visitor_tests_tooling_hdrs", 431 testonly = 1, 432 hdrs = glob( 433 ["Tooling/*.h"], 434 allow_empty = False, 435 ), 436 strip_include_prefix = "Tooling", 437 deps = [ 438 "//clang:ast", 439 "//clang:basic", 440 "//clang:frontend", 441 "//clang:rewrite", 442 "//clang:tooling", 443 "//clang:tooling_core", 444 "//llvm:Support", 445 "//third-party/unittest:gtest", 446 ], 447) 448 449cc_test( 450 name = "tooling_recursive_ast_visitor_tests", 451 size = "medium", 452 srcs = glob( 453 ["Tooling/RecursiveASTVisitorTests/*.cpp"], 454 allow_empty = False, 455 ) + [ 456 "Tooling/RecursiveASTVisitorTests/CallbacksCommon.h", 457 ], 458 deps = [ 459 ":tooling_recursive_ast_visitor_tests_tooling_hdrs", 460 "//clang:ast", 461 "//clang:basic", 462 "//clang:frontend", 463 "//clang:lex", 464 "//clang:tooling", 465 "//clang:tooling_syntax", 466 "//llvm:Support", 467 "//llvm:TargetParser", 468 "//llvm:TestingSupport", 469 "//third-party/unittest:gmock", 470 "//third-party/unittest:gtest", 471 "//third-party/unittest:gtest_main", 472 ], 473) 474 475cc_test( 476 name = "tooling_syntax_tests", 477 size = "medium", 478 srcs = glob( 479 [ 480 "Tooling/Syntax/*.cpp", 481 "Tooling/Syntax/*.h", 482 ], 483 allow_empty = False, 484 ), 485 shard_count = 20, 486 deps = [ 487 "//clang:ast", 488 "//clang:basic", 489 "//clang:frontend", 490 "//clang:lex", 491 "//clang:testing", 492 "//clang:tooling", 493 "//clang:tooling_core", 494 "//clang:tooling_syntax", 495 "//llvm:Support", 496 "//llvm:TestingAnnotations", 497 "//llvm:TestingSupport", 498 "//third-party/unittest:gmock", 499 "//third-party/unittest:gtest", 500 "//third-party/unittest:gtest_main", 501 ], 502) 503 504cc_test( 505 name = "libclang_tests", 506 size = "small", 507 srcs = glob( 508 ["libclang/*.cpp"], 509 allow_empty = False, 510 ) + [ 511 "libclang/TestUtils.h", 512 ], 513 args = select({ 514 "@platforms//os:windows": [ 515 # Need to disable the VFS tests that don't use Windows friendly 516 # paths. These are also disabled on Windows in the CMake build. 517 "--gtest_filter=-*VirtualFileOverlay*", 518 ], 519 "//conditions:default": [], 520 }), 521 deps = [ 522 "//clang:libclang", 523 "//llvm:Support", 524 "//third-party/unittest:gtest", 525 "//third-party/unittest:gtest_main", 526 ], 527) 528