<commit_before>set(sources
  CoreFoundationShims.h
  FoundationShims.h
  GlobalObjects.h
  HeapObject.h
  LibcShims.h
  RefCount.h
  RuntimeShims.h
  RuntimeStubs.h
  SwiftStddef.h
  SwiftStdint.h
  UnicodeShims.h
  module.map
  )
set(output_dir "${SWIFTLIB_DIR}/shims")

set(commands
    COMMAND ${CMAKE_COMMAND} "-E" "make_directory" "${output_dir}")
set(outputs)
foreach(input ${sources})
  list(APPEND commands
      COMMAND
        "${CMAKE_COMMAND}" "-E" "copy_if_different"
        "${CMAKE_CURRENT_SOURCE_DIR}/${input}"
        "${output_dir}/${input}")
  list(APPEND outputs "${output_dir}/${input}")
endforeach()
# Put the output dir itself last so that it isn't considered the primary output.
list(APPEND outputs "${output_dir}")

add_custom_command_target(unused_var
    ${commands}
    CUSTOM_TARGET_NAME "copy_shim_headers"
    OUTPUT "${outputs}"
    DEPENDS "${sources}"
    COMMENT "Copying SwiftShims module to ${output_dir}")

if ("${LLVM_PACKAGE_VERSION}" STREQUAL "")
  message(FATAL_ERROR
          "LLVM_PACKAGE_VERSION must be set before including subdirectories")
endif()

# Symlink in the Clang headers.
# First extract the "version" used for Clang's resource directory.
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
  "${LLVM_PACKAGE_VERSION}")

if(SWIFT_BUILT_STANDALONE)
  set(clang_headers_locations
      "${LLVM_LIBRARY_DIR}/clang/${CLANG_VERSION}"

      # FIXME: if we want to support separate Clang builds and mix different
      # build configurations of Clang and Swift, this line should be adjusted.
      "${SWIFT_PATH_TO_CLANG_BUILD}/${CMAKE_CFG_INTDIR}/lib/clang/${CLANG_VERSION}")

  set(clang_headers_location)
  foreach(loc ${clang_headers_locations})
  message(WARNING "go: ${loc}")
    if(EXISTS "${loc}")
      set(clang_headers_location "${loc}")
      break()
    endif()
  endforeach()
  if("${clang_headers_location}" STREQUAL "")
    message(FATAL_ERROR "Clang headers were not found")
  endif()
else() # NOT SWIFT_BUILT_STANDALONE
  set(clang_headers_location "${LLVM_LIBRARY_DIR}/clang/${CLANG_VERSION}")
endif()

add_custom_command_target(unused_var
    COMMAND
      "${CMAKE_COMMAND}" "-E" "make_directory" "${SWIFTLIB_DIR}"
    COMMAND
      "${CMAKE_COMMAND}" "-E" "create_symlink"
      "${clang_headers_location}"
      "${SWIFTLIB_DIR}/clang"

    # Create a broken symlink that points to '../clang/$VERSION'.  It is not
    # used when running Swift tools from the build tree directly, but we will
    # install it in such a way that it points to Clang installation.  If the 
    # link can be resolved, CMake would try to follow it when installing the
    # project under certain conditions.
    COMMAND<commit_msg>cmake: remove debugging 'message()'<commit_after>set(sources
  CoreFoundationShims.h
  FoundationShims.h
  GlobalObjects.h
  HeapObject.h
  LibcShims.h
  RefCount.h
  RuntimeShims.h
  RuntimeStubs.h
  SwiftStddef.h
  SwiftStdint.h
  UnicodeShims.h
  module.map
  )
set(output_dir "${SWIFTLIB_DIR}/shims")

set(commands
    COMMAND ${CMAKE_COMMAND} "-E" "make_directory" "${output_dir}")
set(outputs)
foreach(input ${sources})
  list(APPEND commands
      COMMAND
        "${CMAKE_COMMAND}" "-E" "copy_if_different"
        "${CMAKE_CURRENT_SOURCE_DIR}/${input}"
        "${output_dir}/${input}")
  list(APPEND outputs "${output_dir}/${input}")
endforeach()
# Put the output dir itself last so that it isn't considered the primary output.
list(APPEND outputs "${output_dir}")

add_custom_command_target(unused_var
    ${commands}
    CUSTOM_TARGET_NAME "copy_shim_headers"
    OUTPUT "${outputs}"
    DEPENDS "${sources}"
    COMMENT "Copying SwiftShims module to ${output_dir}")

if ("${LLVM_PACKAGE_VERSION}" STREQUAL "")
  message(FATAL_ERROR
          "LLVM_PACKAGE_VERSION must be set before including subdirectories")
endif()

# Symlink in the Clang headers.
# First extract the "version" used for Clang's resource directory.
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
  "${LLVM_PACKAGE_VERSION}")

if(SWIFT_BUILT_STANDALONE)
  set(clang_headers_locations
      "${LLVM_LIBRARY_DIR}/clang/${CLANG_VERSION}"

      # FIXME: if we want to support separate Clang builds and mix different
      # build configurations of Clang and Swift, this line should be adjusted.
      "${SWIFT_PATH_TO_CLANG_BUILD}/${CMAKE_CFG_INTDIR}/lib/clang/${CLANG_VERSION}")

  set(clang_headers_location)
  foreach(loc ${clang_headers_locations})
    if(EXISTS "${loc}")
      set(clang_headers_location "${loc}")
      break()
    endif()
  endforeach()
  if("${clang_headers_location}" STREQUAL "")
    message(FATAL_ERROR "Clang headers were not found")
  endif()
else() # NOT SWIFT_BUILT_STANDALONE
  set(clang_headers_location "${LLVM_LIBRARY_DIR}/clang/${CLANG_VERSION}")
endif()

add_custom_command_target(unused_var
    COMMAND
      "${CMAKE_COMMAND}" "-E" "make_directory" "${SWIFTLIB_DIR}"
    COMMAND
      "${CMAKE_COMMAND}" "-E" "create_symlink"
      "${clang_headers_location}"
      "${SWIFTLIB_DIR}/clang"

    # Create a broken symlink that points to '../clang/$VERSION'.  It is not
    # used when running Swift tools from the build tree directly, but we will
    # install it in such a way that it points to Clang installation.  If the 
    # link can be resolved, CMake would try to follow it when installing the
    # project under certain conditions.
    COMMAND
{'fraction_non_alphanumeric': 0.12170196952805648, 'fraction_numerical': 0.002229654403567447, 'mean_word_length': 4.251707317073171, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6705953', 'n_tokens_mistral': 1817, 'n_tokens_neox': 1814, 'n_words': 441}