Skip to content

Commit

Permalink
Revert "[AST] Add generator for source location introspection"
Browse files Browse the repository at this point in the history
This reverts commit d627a27.

This fails to link on Windows somehow.
  • Loading branch information
steveire committed Mar 10, 2021
1 parent 774b707 commit 14050dd
Show file tree
Hide file tree
Showing 12 changed files with 0 additions and 962 deletions.
85 changes: 0 additions & 85 deletions clang/include/clang/Tooling/NodeIntrospection.h

This file was deleted.

70 changes: 0 additions & 70 deletions clang/lib/Tooling/CMakeLists.txt
Expand Up @@ -8,78 +8,10 @@ add_subdirectory(Core)
add_subdirectory(Inclusions)
add_subdirectory(Refactoring)
add_subdirectory(ASTDiff)
add_subdirectory(DumpTool)
add_subdirectory(Syntax)
add_subdirectory(DependencyScanning)
add_subdirectory(Transformer)

find_package(Python3 COMPONENTS Interpreter)

# The generation of ASTNodeAPI.json takes a long time in a
# Debug build due to parsing AST.h. Disable the processing
# but setting CLANG_TOOLING_BUILD_AST_INTROSPECTION as an
# internal hidden setting to override.
# When the processing is disabled, a trivial/empty JSON
# file is generated by clang-ast-dump and generate_cxx_src_locs.py
# generates the same API, but with a trivial implementation.

option(CLANG_TOOLING_BUILD_AST_INTROSPECTION "Enable AST introspection" TRUE)
set(skip_expensive_processing $<OR:$<CONFIG:Debug>,$<NOT:$<BOOL:${CLANG_TOOLING_BUILD_AST_INTROSPECTION}>>>)

add_custom_command(
COMMENT Generate ASTNodeAPI.json
OUTPUT ${CMAKE_BINARY_DIR}/ASTNodeAPI.json
DEPENDS clang-ast-dump clang-headers
COMMAND
$<TARGET_FILE:clang-ast-dump>
# Skip this in debug mode because parsing AST.h is too slow
--skip-processing=${skip_expensive_processing}
--astheader=${CMAKE_SOURCE_DIR}/../clang/include/clang/AST/AST.h
-I ${CMAKE_BINARY_DIR}/lib/clang/${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}/include
-I ${CMAKE_SOURCE_DIR}/../clang/include
-I ${CMAKE_BINARY_DIR}/tools/clang/include/
-I ${CMAKE_BINARY_DIR}/include
-I ${CMAKE_SOURCE_DIR}/include
--json-output-path ${CMAKE_BINARY_DIR}/ASTNodeAPI.json
)

add_custom_target(run-ast-api-dump-tool
DEPENDS ${CMAKE_BINARY_DIR}/ASTNodeAPI.json
)

# Replace the last lib component of the current binary directory with include
string(FIND ${CMAKE_CURRENT_BINARY_DIR} "/lib/" PATH_LIB_START REVERSE)
if(PATH_LIB_START EQUAL -1)
message(FATAL_ERROR "Couldn't find lib component in binary directory")
endif()
math(EXPR PATH_LIB_END "${PATH_LIB_START}+5")
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD)
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} ${PATH_LIB_END} -1 PATH_TAIL)
string(CONCAT BINARY_INCLUDE_DIR ${PATH_HEAD} "/include/clang/" ${PATH_TAIL})

add_custom_command(
COMMENT Generate NodeIntrospection.inc
OUTPUT ${BINARY_INCLUDE_DIR}/NodeIntrospection.inc
DEPENDS ${CMAKE_BINARY_DIR}/ASTNodeAPI.json ${CMAKE_CURRENT_SOURCE_DIR}/DumpTool/generate_cxx_src_locs.py
COMMAND
${CMAKE_COMMAND} -E make_directory
${CMAKE_CURRENT_BINARY_DIR}/generated/
COMMAND
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/DumpTool/generate_cxx_src_locs.py
--json-input-path ${CMAKE_BINARY_DIR}/ASTNodeAPI.json
--output-file generated/NodeIntrospection.inc
--empty-implementation ${skip_expensive_processing}
COMMAND
${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_BINARY_DIR}/generated/NodeIntrospection.inc
${BINARY_INCLUDE_DIR}/NodeIntrospection.inc
)

add_custom_target(run-ast-api-generate-tool
DEPENDS
${BINARY_INCLUDE_DIR}/NodeIntrospection.inc
)

add_clang_library(clangTooling
AllTUsExecution.cpp
ArgumentsAdjusters.cpp
Expand All @@ -95,8 +27,6 @@ add_clang_library(clangTooling
Refactoring.cpp
RefactoringCallbacks.cpp
StandaloneExecution.cpp
NodeIntrospection.cpp
${BINARY_INCLUDE_DIR}/NodeIntrospection.inc
Tooling.cpp

DEPENDS
Expand Down
33 changes: 0 additions & 33 deletions clang/lib/Tooling/DumpTool/APIData.h

This file was deleted.

171 changes: 0 additions & 171 deletions clang/lib/Tooling/DumpTool/ASTSrcLocProcessor.cpp

This file was deleted.

0 comments on commit 14050dd

Please sign in to comment.