llvm-project/clang/test/CMakeLists.txt

119 lines
3.5 KiB
CMake
Raw Normal View History

set(CLANG_TEST_DIRECTORIES
"Analysis"
"CodeCompletion"
"CodeGen"
"CodeGenCUDA"
"CodeGenCXX"
"CodeGenObjC"
"CodeGenOpenCL"
"Coverage"
"CXX"
"Driver"
"FixIt"
"Frontend"
"Headers"
Add support for retrieving the Doxygen comment associated with a given declaration in the AST. The new ASTContext::getCommentForDecl function searches for a comment that is attached to the given declaration, and returns that comment, which may be composed of several comment blocks. Comments are always available in an AST. However, to avoid harming performance, we don't actually parse the comments. Rather, we keep the source ranges of all of the comments within a large, sorted vector, then lazily extract comments via a binary search in that vector only when needed (which never occurs in a "normal" compile). Comments are written to a precompiled header/AST file as a blob of source ranges. That blob is only lazily loaded when one requests a comment for a declaration (this never occurs in a "normal" compile). The indexer testbed now supports comment extraction. When the -point-at location points to a declaration with a Doxygen-style comment, the indexer testbed prints the associated comment block(s). See test/Index/comments.c for an example. Some notes: - We don't actually attempt to parse the comment blocks themselves, beyond identifying them as Doxygen comment blocks to associate them with a declaration. - We won't find comment blocks that aren't adjacent to the declaration, because we start our search based on the location of the declaration. - We don't go through the necessary hops to find, for example, whether some redeclaration of a declaration has comments when our current declaration does not. Similarly, we don't attempt to associate a \param Foo marker in a function body comment with the parameter named Foo (although that is certainly possible). - Verification of my "no performance impact" claims is still "to be done". llvm-svn: 74704
2009-07-03 01:08:52 +08:00
"Index"
"Lexer"
"Misc"
"PCH"
"Parser"
"Preprocessor"
"Rewriter"
"Sema"
"SemaCUDA"
"SemaCXX"
"SemaObjC"
"SemaObjCXX"
"SemaOpenCL"
"SemaTemplate")
set(LLVM_SOURCE_DIR "${LLVM_MAIN_SRC_DIR}")
set(LLVM_BINARY_DIR "${LLVM_BINARY_DIR}")
set(LLVM_BUILD_MODE "%(build_mode)s")
2009-11-08 17:46:39 +08:00
set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}/%(build_config)s")
set(LLVM_LIBS_DIR "${LLVM_BINARY_DIR}/lib/%(build_config)s")
set(CLANG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..")
set(CLANG_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..")
if(BUILD_SHARED_LIBS)
set(ENABLE_SHARED 1)
else()
set(ENABLE_SHARED 0)
endif(BUILD_SHARED_LIBS)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
@ONLY)
include(FindPythonInterp)
if(PYTHONINTERP_FOUND)
if( LLVM_MAIN_SRC_DIR )
set(LIT "${LLVM_SOURCE_DIR}/utils/lit/lit.py")
else()
set(LIT "${PATH_TO_LLVM_BUILD}/bin/${CMAKE_CFG_INTDIR}/llvm-lit")
# Installed LLVM does not contain ${CMAKE_CFG_INTDIR} in paths.
if( NOT EXISTS ${LIT} )
set(LIT "${PATH_TO_LLVM_BUILD}/bin/llvm-lit")
endif()
endif()
if( PATH_TO_LLVM_BUILD )
set(CLANG_TEST_EXTRA_ARGS "--path=${CLANG_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}")
endif()
option(CLANG_TEST_USE_VG "Run Clang tests under Valgrind" OFF)
if(CLANG_TEST_USE_VG)
set(CLANG_TEST_EXTRA_ARGS ${CLANG_TEST_EXTRA_ARGS} "--vg")
endif ()
set(LIT_ARGS "${CLANG_TEST_EXTRA_ARGS} ${LLVM_LIT_ARGS}")
separate_arguments(LIT_ARGS)
add_custom_target(clang-test.deps)
set_target_properties(clang-test.deps PROPERTIES FOLDER "Clang tests")
add_custom_target(clang-test
COMMAND ${PYTHON_EXECUTABLE}
${LIT}
--param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
--param clang_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
--param build_config=${CMAKE_CFG_INTDIR}
--param build_mode=${RUNTIME_BUILD_MODE}
${LIT_ARGS}
${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Running Clang regression tests")
set_target_properties(clang-test PROPERTIES FOLDER "Clang tests")
if( NOT CLANG_BUILT_STANDALONE )
add_custom_target(check-all
COMMAND ${PYTHON_EXECUTABLE}
${LIT}
--param build_config=${CMAKE_CFG_INTDIR}
--param build_mode=${RUNTIME_BUILD_MODE}
${LIT_ARGS}
${LLVM_BINARY_DIR}/test
${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Running Clang and LLVM regression tests")
add_dependencies(check-all clang-test.deps)
if ( LLVM_INCLUDE_TESTS )
add_dependencies(clang-test.deps ClangUnitTests)
add_dependencies(check-all check.deps)
endif ( LLVM_INCLUDE_TESTS )
add_dependencies(clang-test.deps
llvm-dis llc opt
FileCheck count not
)
set_target_properties(check-all PROPERTIES FOLDER "Clang tests")
endif()
add_dependencies(clang-test clang-test.deps)
add_dependencies(clang-test.deps
clang clang-headers c-index-test diagtool arcmt-test c-arcmt-test
)
endif()