1set(LLVM_LINK_COMPONENTS 2 support 3 AllTargetsInfos 4 FrontendOpenMP 5 TargetParser 6 ) 7 8if(CLANG_BUILT_STANDALONE) 9 # LLVMTestingSupport and LLVMTestingAnnotations are needed for clangd tests. 10 if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Annotations 11 AND NOT TARGET LLVMTestingAnnotations) 12 add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Annotations 13 lib/Testing/Annotations) 14 endif() 15 if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support 16 AND NOT TARGET LLVMTestingSupport) 17 add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support 18 lib/Testing/Support) 19 endif() 20endif() 21 22if (CLANGD_ENABLE_REMOTE) 23 include_directories(${CMAKE_CURRENT_BINARY_DIR}/../index/remote) 24 add_definitions(-DGOOGLE_PROTOBUF_NO_RTTI=1) 25 set(REMOTE_TEST_SOURCES remote/MarshallingTests.cpp) 26endif() 27 28include(${CMAKE_CURRENT_SOURCE_DIR}/../quality/CompletionModel.cmake) 29gen_decision_forest(${CMAKE_CURRENT_SOURCE_DIR}/decision_forest_model DecisionForestRuntimeTest ::ns1::ns2::test::Example) 30 31add_custom_target(ClangdUnitTests) 32set_target_properties(ClangdUnitTests PROPERTIES FOLDER "Clang Tools Extra/Tests") 33add_unittest(ClangdUnitTests ClangdTests 34 Annotations.cpp 35 ASTTests.cpp 36 ASTSignalsTests.cpp 37 BackgroundIndexTests.cpp 38 CallHierarchyTests.cpp 39 CanonicalIncludesTests.cpp 40 ClangdTests.cpp 41 ClangdLSPServerTests.cpp 42 CodeCompleteTests.cpp 43 CodeCompletionStringsTests.cpp 44 CollectMacrosTests.cpp 45 CompileCommandsTests.cpp 46 CompilerTests.cpp 47 ConfigCompileTests.cpp 48 ConfigProviderTests.cpp 49 ConfigYAMLTests.cpp 50 DecisionForestTests.cpp 51 DexTests.cpp 52 DiagnosticsTests.cpp 53 DraftStoreTests.cpp 54 DumpASTTests.cpp 55 ExpectedTypeTest.cpp 56 FeatureModulesTests.cpp 57 FileDistanceTests.cpp 58 FileIndexTests.cpp 59 FindSymbolsTests.cpp 60 FindTargetTests.cpp 61 FormatTests.cpp 62 FSTests.cpp 63 FuzzyMatchTests.cpp 64 GlobalCompilationDatabaseTests.cpp 65 HeadersTests.cpp 66 HeaderSourceSwitchTests.cpp 67 HoverTests.cpp 68 IncludeCleanerTests.cpp 69 IndexActionTests.cpp 70 IndexTests.cpp 71 InlayHintTests.cpp 72 InsertionPointTests.cpp 73 JSONTransportTests.cpp 74 LoggerTests.cpp 75 LSPBinderTests.cpp 76 LSPClient.cpp 77 PrerequisiteModulesTest.cpp 78 ModulesTests.cpp 79 ParsedASTTests.cpp 80 PathMappingTests.cpp 81 PreambleTests.cpp 82 PrintASTTests.cpp 83 ProjectAwareIndexTests.cpp 84 QualityTests.cpp 85 RIFFTests.cpp 86 RenameTests.cpp 87 ReplayPeambleTests.cpp 88 SelectionTests.cpp 89 SemanticHighlightingTests.cpp 90 SemanticSelectionTests.cpp 91 SerializationTests.cpp 92 SourceCodeTests.cpp 93 StdLibTests.cpp 94 SymbolCollectorTests.cpp 95 SymbolInfoTests.cpp 96 SyncAPI.cpp 97 TUSchedulerTests.cpp 98 TestFS.cpp 99 TestIndex.cpp 100 TestTU.cpp 101 TestWorkspace.cpp 102 ThreadCrashReporterTests.cpp 103 TidyProviderTests.cpp 104 TypeHierarchyTests.cpp 105 URITests.cpp 106 XRefsTests.cpp 107 ${CMAKE_CURRENT_BINARY_DIR}/DecisionForestRuntimeTest.cpp 108 109 support/CancellationTests.cpp 110 support/ContextTests.cpp 111 support/FileCacheTests.cpp 112 support/FunctionTests.cpp 113 support/MarkupTests.cpp 114 support/MemoryTreeTests.cpp 115 support/PathTests.cpp 116 support/TestTracer.cpp 117 support/ThreadingTests.cpp 118 support/TraceTests.cpp 119 120 tweaks/AddUsingTests.cpp 121 tweaks/AnnotateHighlightingsTests.cpp 122 tweaks/DefineInlineTests.cpp 123 tweaks/DefineOutlineTests.cpp 124 tweaks/DumpASTTests.cpp 125 tweaks/DumpRecordLayoutTests.cpp 126 tweaks/DumpSymbolTests.cpp 127 tweaks/ExpandDeducedTypeTests.cpp 128 tweaks/ExpandMacroTests.cpp 129 tweaks/ExtractFunctionTests.cpp 130 tweaks/ExtractVariableTests.cpp 131 tweaks/MemberwiseConstructorTests.cpp 132 tweaks/ObjCLocalizeStringLiteralTests.cpp 133 tweaks/ObjCMemberwiseInitializerTests.cpp 134 tweaks/PopulateSwitchTests.cpp 135 tweaks/RawStringLiteralTests.cpp 136 tweaks/RemoveUsingNamespaceTests.cpp 137 tweaks/ScopifyEnumTests.cpp 138 tweaks/ShowSelectionTreeTests.cpp 139 tweaks/SpecialMembersTests.cpp 140 tweaks/SwapBinaryOperandsTests.cpp 141 tweaks/SwapIfBranchesTests.cpp 142 tweaks/TweakTesting.cpp 143 tweaks/TweakTests.cpp 144 145 ${REMOTE_TEST_SOURCES} 146 147 $<TARGET_OBJECTS:obj.clangDaemonTweaks> 148 ) 149 150# Include generated ComletionModel headers. 151target_include_directories(ClangdTests PUBLIC 152 $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> 153) 154 155clang_target_link_libraries(ClangdTests 156 PRIVATE 157 clangAST 158 clangASTMatchers 159 clangBasic 160 clangFormat 161 clangFrontend 162 clangIndex 163 clangLex 164 clangSema 165 clangSerialization 166 clangTooling 167 clangToolingCore 168 clangToolingInclusions 169 clangToolingInclusionsStdlib 170 clangToolingRefactoring 171 clangToolingSyntax 172 ) 173target_link_libraries(ClangdTests 174 PRIVATE 175 LLVMTestingAnnotations 176 LLVMTestingSupport 177 178 clangDaemon 179 clangIncludeCleaner 180 clangTesting 181 clangTidy 182 clangTidyUtils 183 clangdSupport 184 ) 185 186if (CLANGD_ENABLE_REMOTE) 187 target_link_libraries(ClangdTests 188 PRIVATE 189 clangdRemoteMarshalling 190 clangdRemoteIndexProto) 191endif() 192 193if (CLANGD_BUILD_XPC) 194 add_subdirectory(xpc) 195endif () 196 197configure_lit_site_cfg( 198 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in 199 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py) 200