File tree 28 files changed +166
-289
lines changed 28 files changed +166
-289
lines changed Original file line number Diff line number Diff line change @@ -2,19 +2,17 @@ add_clang_unittest(InterpTests
2
2
BitcastBuffer.cpp
3
3
Descriptor.cpp
4
4
toAPValue.cpp
5
- )
6
-
7
- clang_target_link_libraries(InterpTests
8
- PRIVATE
5
+ CLANG_LIBS
9
6
clangAST
10
7
clangASTMatchers
11
8
clangBasic
12
9
clangFrontend
13
10
clangSerialization
14
11
clangTooling
15
- )
16
-
17
- target_link_libraries (InterpTests
18
- PRIVATE
12
+ LINK_LIBS
19
13
clangTesting
20
- )
14
+ LLVM_COMPONENTS
15
+ FrontendOpenMP
16
+ Support
17
+ TargetParser
18
+ )
Original file line number Diff line number Diff line change 1
- set (LLVM_LINK_COMPONENTS
2
- FrontendOpenMP
3
- Support
4
- TargetParser
5
- )
6
-
7
-
8
1
add_subdirectory (ByteCode)
9
2
10
3
add_clang_unittest(ASTTests
@@ -43,22 +36,20 @@ add_clang_unittest(ASTTests
43
36
TemplateNameTest.cpp
44
37
TypePrinterTest.cpp
45
38
UnresolvedSetTest.cpp
46
- )
47
-
48
- clang_target_link_libraries(ASTTests
49
- PRIVATE
39
+ CLANG_LIBS
50
40
clangAST
51
41
clangASTMatchers
52
42
clangBasic
53
43
clangFrontend
54
44
clangLex
55
45
clangSerialization
56
46
clangTooling
57
- )
58
-
59
- target_link_libraries (ASTTests
60
- PRIVATE
47
+ LINK_LIBS
61
48
clangTesting
62
49
LLVMTestingAnnotations
63
50
LLVMTestingSupport
64
- )
51
+ LLVM_COMPONENTS
52
+ FrontendOpenMP
53
+ Support
54
+ TargetParser
55
+ )
Original file line number Diff line number Diff line change 1
- set (LLVM_LINK_COMPONENTS
2
- FrontendOpenMP
3
- Support
4
- TargetParser
5
- )
6
-
7
1
add_clang_unittest(ASTMatchersTests
8
2
ASTMatchersInternalTest.cpp
9
3
ASTMatchersNodeTest.cpp
10
4
ASTMatchersNarrowingTest.cpp
11
5
ASTMatchersTraversalTest.cpp
12
6
GtestMatchersTest.cpp
13
- )
14
-
15
- clang_target_link_libraries(ASTMatchersTests
16
- PRIVATE
7
+ CLANG_LIBS
17
8
clangAST
18
9
clangASTMatchers
19
10
clangBasic
20
11
clangFrontend
21
12
clangSerialization
22
13
clangTooling
23
- )
24
-
25
- target_link_libraries (ASTMatchersTests
26
- PRIVATE
14
+ LINK_LIBS
27
15
clangTesting
28
16
LLVMTestingSupport
29
- )
17
+ LLVM_COMPONENTS
18
+ FrontendOpenMP
19
+ Support
20
+ TargetParser
21
+ )
30
22
31
23
add_subdirectory (Dynamic)
Original file line number Diff line number Diff line change 1
- set (LLVM_LINK_COMPONENTS
2
- FrontendOpenMP
3
- Support
4
- )
5
-
6
1
add_clang_unittest(DynamicASTMatchersTests
7
2
VariantValueTest.cpp
8
3
ParserTest.cpp
9
4
RegistryTest.cpp
10
- )
11
-
12
- clang_target_link_libraries(DynamicASTMatchersTests
13
- PRIVATE
5
+ CLANG_LIBS
14
6
clangAST
15
7
clangASTMatchers
16
8
clangBasic
17
9
clangDynamicASTMatchers
18
10
clangFrontend
19
11
clangSerialization
20
12
clangTooling
21
- )
22
-
23
- target_link_libraries (DynamicASTMatchersTests
24
- PRIVATE
13
+ LINK_LIBS
25
14
clangTesting
15
+ LLVM_COMPONENTS
16
+ FrontendOpenMP
17
+ Support
26
18
)
Original file line number Diff line number Diff line change 1
- set (LLVM_LINK_COMPONENTS
2
- FrontendOpenMP
3
- Support
4
- )
5
-
6
1
add_clang_unittest(ClangAnalysisTests
7
2
CFGDominatorTree.cpp
8
3
CFGTest.cpp
@@ -11,10 +6,7 @@ add_clang_unittest(ClangAnalysisTests
11
6
IntervalPartitionTest.cpp
12
7
MacroExpansionContextTest.cpp
13
8
UnsafeBufferUsageTest.cpp
14
- )
15
-
16
- clang_target_link_libraries(ClangAnalysisTests
17
- PRIVATE
9
+ CLANG_LIBS
18
10
clangAST
19
11
clangASTMatchers
20
12
clangAnalysis
@@ -23,12 +15,12 @@ clang_target_link_libraries(ClangAnalysisTests
23
15
clangLex
24
16
clangSerialization
25
17
clangTooling
26
- )
27
-
28
- target_link_libraries (ClangAnalysisTests
29
- PRIVATE
18
+ LINK_LIBS
30
19
clangTesting
31
20
LLVMTestingSupport
21
+ LLVM_COMPONENTS
22
+ FrontendOpenMP
23
+ Support
32
24
)
33
25
34
26
add_subdirectory (FlowSensitive)
Original file line number Diff line number Diff line change 1
- set (LLVM_LINK_COMPONENTS
2
- FrontendOpenMP
3
- Support
4
- )
5
-
6
1
add_clang_unittest(ClangAnalysisFlowSensitiveTests
7
2
ArenaTest.cpp
8
3
ASTOpsTest.cpp
@@ -30,10 +25,7 @@ add_clang_unittest(ClangAnalysisFlowSensitiveTests
30
25
UncheckedOptionalAccessModelTest.cpp
31
26
ValueTest.cpp
32
27
WatchedLiteralsSolverTest.cpp
33
- )
34
-
35
- clang_target_link_libraries(ClangAnalysisFlowSensitiveTests
36
- PRIVATE
28
+ CLANG_LIBS
37
29
clangAST
38
30
clangASTMatchers
39
31
clangAnalysis
@@ -44,11 +36,11 @@ clang_target_link_libraries(ClangAnalysisFlowSensitiveTests
44
36
clangLex
45
37
clangSerialization
46
38
clangTooling
47
- )
48
-
49
- target_link_libraries (ClangAnalysisFlowSensitiveTests
50
- PRIVATE
39
+ LINK_LIBS
51
40
clangTesting
52
41
LLVMTestingAnnotations
53
42
LLVMTestingSupport
43
+ LLVM_COMPONENTS
44
+ FrontendOpenMP
45
+ Support
54
46
)
Original file line number Diff line number Diff line change 1
- set (LLVM_LINK_COMPONENTS
2
- Support
3
- )
4
-
5
1
add_clang_unittest(BasicTests
6
2
CharInfoTest.cpp
7
3
DarwinSDKInfoTest.cpp
@@ -12,15 +8,11 @@ add_clang_unittest(BasicTests
12
8
SanitizersTest.cpp
13
9
SarifTest.cpp
14
10
SourceManagerTest.cpp
15
- )
16
-
17
- clang_target_link_libraries(BasicTests
18
- PRIVATE
11
+ CLANG_LIBS
19
12
clangBasic
20
13
clangLex
21
- )
22
-
23
- target_link_libraries (BasicTests
24
- PRIVATE
14
+ LINK_LIBS
25
15
LLVMTestingSupport
26
- )
16
+ LLVM_COMPONENTS
17
+ Support
18
+ )
Original file line number Diff line number Diff line change @@ -15,12 +15,36 @@ if(CLANG_BUILT_STANDALONE)
15
15
endif ()
16
16
endif ()
17
17
18
- # add_clang_unittest(test_dirname file1.cpp file2.cpp)
18
+ # add_clang_unittest(test_name file1.cpp file2.cpp)
19
19
#
20
20
# Will compile the list of files together and link against the clang
21
- # Produces a binary named 'basename(test_dirname)'.
22
- function (add_clang_unittest test_dirname)
23
- add_unittest(ClangUnitTests ${test_dirname} ${ARGN} )
21
+ # Produces a binary named 'basename(test_name)'.
22
+ function (add_clang_unittest test_name)
23
+ cmake_parse_arguments (ARG
24
+ ""
25
+ ""
26
+ "CLANG_LIBS;LINK_LIBS;LLVM_COMPONENTS"
27
+ ${ARGN} )
28
+
29
+ if (NOT ${test_name} MATCHES "Tests$" )
30
+ message (FATAL_ERROR "Unit test name must end with 'Tests' for lit to find it." )
31
+ endif ()
32
+
33
+ # LLVM_COMPONENTS is for LLVM_LINK_COMPONENTS deps, and must be before
34
+ # add_unittest.
35
+ list (APPEND LLVM_LINK_COMPONENTS ${ARG_LLVM_COMPONENTS} )
36
+
37
+ add_unittest(ClangUnitTests ${test_name} ${ARG_UNPARSED_ARGUMENTS} )
38
+
39
+ # Clang libs either come from the entire dylib, or individual libraries.
40
+ if (CLANG_LINK_CLANG_DYLIB)
41
+ list (APPEND ARG_LINK_LIBS clang-cpp)
42
+ else ()
43
+ list (APPEND ARG_LINK_LIBS ${ARG_CLANG_LIBS} )
44
+ endif ()
45
+
46
+ # LINK_LIBS is for normal library dependencies.
47
+ target_link_libraries (${test_name} PRIVATE ${ARG_LINK_LIBS} )
24
48
endfunction ()
25
49
26
50
add_subdirectory (Basic)
Original file line number Diff line number Diff line change 1
- set (LLVM_LINK_COMPONENTS
2
- Core
3
- Support
4
- TargetParser
5
- )
6
-
7
1
add_clang_unittest(ClangCodeGenTests
8
2
BufferSourceTest.cpp
9
3
CodeGenExternalTest.cpp
10
4
TBAAMetadataTest.cpp
11
5
CheckTargetFeaturesTest.cpp
12
- )
13
-
14
- clang_target_link_libraries(ClangCodeGenTests
15
- PRIVATE
6
+ CLANG_LIBS
16
7
clangAST
17
8
clangBasic
18
9
clangCodeGen
19
10
clangFrontend
20
11
clangLex
21
12
clangParse
22
13
clangSerialization
14
+ LLVM_COMPONENTS
15
+ Core
16
+ Support
17
+ TargetParser
23
18
)
Original file line number Diff line number Diff line change 1
- set (LLVM_LINK_COMPONENTS
2
- ${LLVM_TARGETS_TO_BUILD}
3
- Support
4
- )
5
-
6
1
add_clang_unittest(CrossTUTests
7
2
CrossTranslationUnitTest.cpp
8
- )
9
-
10
- clang_target_link_libraries(CrossTUTests
11
- PRIVATE
3
+ CLANG_LIBS
12
4
clangAST
13
5
clangBasic
14
6
clangCrossTU
15
7
clangFrontend
16
8
clangSerialization
17
9
clangTooling
10
+ LLVM_COMPONENTS
11
+ Support
18
12
)
Original file line number Diff line number Diff line change 1
1
if (APPLE OR CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME STREQUAL Windows)
2
2
3
- set (LLVM_LINK_COMPONENTS
4
- Support
5
- )
6
-
7
3
add_clang_unittest(DirectoryWatcherTests
8
4
DirectoryWatcherTest.cpp
9
- )
10
-
11
- target_link_libraries (DirectoryWatcherTests
12
- PRIVATE
5
+ LINK_LIBS
13
6
LLVMTestingSupport
14
7
clangDirectoryWatcher
8
+ LLVM_COMPONENTS
9
+ Support
15
10
)
16
11
17
12
endif ()
Original file line number Diff line number Diff line change 1
- set (LLVM_LINK_COMPONENTS
2
- ${LLVM_TARGETS_TO_BUILD}
3
- MC
4
- Option
5
- Support
6
- TargetParser
7
- )
8
-
9
1
add_clang_unittest(ClangDriverTests
10
2
DistroTest.cpp
11
3
DXCModeTest.cpp
@@ -15,12 +7,15 @@ add_clang_unittest(ClangDriverTests
15
7
MultilibBuilderTest.cpp
16
8
MultilibTest.cpp
17
9
SanitizerArgsTest.cpp
18
- )
19
-
20
- clang_target_link_libraries(ClangDriverTests
21
- PRIVATE
10
+ CLANG_LIBS
22
11
clangDriver
23
12
clangBasic
24
13
clangFrontend # For TextDiagnosticPrinter.
25
14
clangSerialization
15
+ LLVM_COMPONENTS
16
+ ${LLVM_TARGETS_TO_BUILD}
17
+ MC
18
+ Option
19
+ Support
20
+ TargetParser
26
21
)
You can’t perform that action at this time.
0 commit comments