2009-06-06 07:57:17 +08:00
|
|
|
set(CLANG_TEST_DIRECTORIES
|
|
|
|
"Analysis"
|
Initial implementation of a code-completion interface in Clang. In
essence, code completion is triggered by a magic "code completion"
token produced by the lexer [*], which the parser recognizes at
certain points in the grammar. The parser then calls into the Action
object with the appropriate CodeCompletionXXX action.
Sema implements the CodeCompletionXXX callbacks by performing minimal
translation, then forwarding them to a CodeCompletionConsumer
subclass, which uses the results of semantic analysis to provide
code-completion results. At present, only a single, "printing" code
completion consumer is available, for regression testing and
debugging. However, the design is meant to permit other
code-completion consumers.
This initial commit contains two code-completion actions: one for
member access, e.g., "x." or "p->", and one for
nested-name-specifiers, e.g., "std::". More code-completion actions
will follow, along with improved gathering of code-completion results
for the various contexts.
[*] In the current -code-completion-dump testing/debugging mode, the
file is truncated at the completion point and EOF is translated into
"code completion".
llvm-svn: 82166
2009-09-18 05:32:03 +08:00
|
|
|
"CodeCompletion"
|
2009-06-06 07:57:17 +08:00
|
|
|
"CodeGen"
|
|
|
|
"CodeGenCXX"
|
|
|
|
"CodeGenObjC"
|
2011-02-14 09:42:53 +08:00
|
|
|
"CodeGenOpenCL"
|
2009-06-06 07:57:17 +08:00
|
|
|
"Coverage"
|
2009-06-17 04:13:51 +08:00
|
|
|
"CXX"
|
2009-06-06 07:57:17 +08:00
|
|
|
"Driver"
|
|
|
|
"FixIt"
|
|
|
|
"Frontend"
|
2010-03-09 07:38:27 +08:00
|
|
|
"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"
|
2009-06-06 07:57:17 +08:00
|
|
|
"Lexer"
|
|
|
|
"Misc"
|
|
|
|
"PCH"
|
|
|
|
"Parser"
|
|
|
|
"Preprocessor"
|
|
|
|
"Rewriter"
|
|
|
|
"Sema"
|
2010-12-01 11:15:31 +08:00
|
|
|
"SemaCUDA"
|
2009-06-06 07:57:17 +08:00
|
|
|
"SemaCXX"
|
|
|
|
"SemaObjC"
|
|
|
|
"SemaObjCXX"
|
2011-02-16 03:46:23 +08:00
|
|
|
"SemaOpenCL"
|
2009-06-06 07:57:17 +08:00
|
|
|
"SemaTemplate")
|
2009-06-06 00:00:31 +08:00
|
|
|
|
2009-11-08 07:53:32 +08:00
|
|
|
set(LLVM_SOURCE_DIR "${LLVM_MAIN_SRC_DIR}")
|
|
|
|
set(LLVM_BINARY_DIR "${LLVM_BINARY_DIR}")
|
2011-06-24 02:00:48 +08:00
|
|
|
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")
|
2009-11-08 07:53:32 +08:00
|
|
|
set(CLANG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
|
|
|
set(CLANG_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..")
|
2011-02-03 17:01:12 +08:00
|
|
|
if(BUILD_SHARED_LIBS)
|
|
|
|
set(ENABLE_SHARED 1)
|
|
|
|
else()
|
|
|
|
set(ENABLE_SHARED 0)
|
|
|
|
endif(BUILD_SHARED_LIBS)
|
2009-11-08 07:53:32 +08:00
|
|
|
|
|
|
|
configure_file(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
|
|
|
|
|
2011-02-03 17:01:12 +08:00
|
|
|
configure_file(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
|
|
|
|
@ONLY)
|
|
|
|
|
2009-06-06 07:57:17 +08:00
|
|
|
include(FindPythonInterp)
|
|
|
|
if(PYTHONINTERP_FOUND)
|
2011-02-06 03:08:56 +08:00
|
|
|
if( LLVM_MAIN_SRC_DIR )
|
|
|
|
set(LIT "${LLVM_SOURCE_DIR}/utils/lit/lit.py")
|
|
|
|
else()
|
2011-02-06 05:37:51 +08:00
|
|
|
set(LIT "${PATH_TO_LLVM_BUILD}/bin/${CMAKE_CFG_INTDIR}/llvm-lit")
|
2011-02-23 20:07:49 +08:00
|
|
|
# Installed LLVM does not contain ${CMAKE_CFG_INTDIR} in paths.
|
|
|
|
if( NOT EXISTS ${LIT} )
|
|
|
|
set(LIT "${PATH_TO_LLVM_BUILD}/bin/llvm-lit")
|
|
|
|
endif()
|
2011-02-06 03:08:56 +08:00
|
|
|
endif()
|
|
|
|
|
2011-02-06 05:37:51 +08:00
|
|
|
if( PATH_TO_LLVM_BUILD )
|
|
|
|
set(CLANG_TEST_EXTRA_ARGS "--path=${CLANG_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}")
|
|
|
|
endif()
|
2009-06-06 00:00:31 +08:00
|
|
|
|
2009-11-23 05:55:22 +08:00
|
|
|
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 ()
|
|
|
|
|
2010-11-11 12:09:51 +08:00
|
|
|
set(LIT_ARGS "${CLANG_TEST_EXTRA_ARGS} ${LLVM_LIT_ARGS}")
|
|
|
|
separate_arguments(LIT_ARGS)
|
|
|
|
|
2011-02-15 15:54:28 +08:00
|
|
|
add_custom_target(clang-test.deps)
|
2011-02-21 06:06:44 +08:00
|
|
|
set_target_properties(clang-test.deps PROPERTIES FOLDER "Clang tests")
|
2011-02-15 15:54:28 +08:00
|
|
|
|
2009-06-06 07:57:17 +08:00
|
|
|
add_custom_target(clang-test
|
2009-11-03 15:25:53 +08:00
|
|
|
COMMAND ${PYTHON_EXECUTABLE}
|
2011-02-06 03:08:56 +08:00
|
|
|
${LIT}
|
2009-11-06 00:36:19 +08:00
|
|
|
--param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
2011-02-15 15:54:28 +08:00
|
|
|
--param clang_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
|
2009-11-08 07:53:32 +08:00
|
|
|
--param build_config=${CMAKE_CFG_INTDIR}
|
2011-02-15 15:54:28 +08:00
|
|
|
--param build_mode=${RUNTIME_BUILD_MODE}
|
2010-11-11 12:09:51 +08:00
|
|
|
${LIT_ARGS}
|
2009-09-18 03:55:53 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
COMMENT "Running Clang regression tests")
|
2011-02-21 06:06:44 +08:00
|
|
|
set_target_properties(clang-test PROPERTIES FOLDER "Clang tests")
|
2009-09-22 18:07:55 +08:00
|
|
|
|
2011-02-15 15:54:28 +08:00
|
|
|
if( NOT CLANG_BUILT_STANDALONE )
|
2011-07-21 00:35:49 +08:00
|
|
|
add_custom_target(check-all
|
2011-02-15 15:54:28 +08:00
|
|
|
COMMAND ${PYTHON_EXECUTABLE}
|
2011-02-06 03:08:56 +08:00
|
|
|
${LIT}
|
2010-11-29 09:18:56 +08:00
|
|
|
--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")
|
2011-07-16 05:03:20 +08:00
|
|
|
add_dependencies(check-all clang-test.deps)
|
2011-02-25 08:43:05 +08:00
|
|
|
if ( LLVM_INCLUDE_TESTS )
|
2011-07-16 05:03:20 +08:00
|
|
|
add_dependencies(clang-test.deps check.deps ClangUnitTests)
|
2011-02-25 08:43:05 +08:00
|
|
|
endif ( LLVM_INCLUDE_TESTS )
|
2011-02-16 11:07:10 +08:00
|
|
|
add_dependencies(clang-test.deps
|
2011-07-21 00:35:49 +08:00
|
|
|
llvm-dis llc opt
|
2011-02-16 11:07:10 +08:00
|
|
|
FileCheck count not
|
|
|
|
)
|
2011-07-21 00:35:49 +08:00
|
|
|
set_target_properties(check-all PROPERTIES FOLDER "Clang tests")
|
|
|
|
endif()
|
2010-12-10 10:58:03 +08:00
|
|
|
|
|
|
|
add_dependencies(clang-test clang-test.deps)
|
|
|
|
add_dependencies(clang-test.deps
|
2011-07-10 07:36:37 +08:00
|
|
|
clang clang-headers c-index-test arcmt-test c-arcmt-test
|
2011-02-16 11:07:10 +08:00
|
|
|
)
|
2010-12-10 10:58:03 +08:00
|
|
|
|
2009-11-03 15:25:53 +08:00
|
|
|
endif()
|