<commit_before>set(LLVM_USED_LIBS
  clangFrontend
  clangDriver
  clangSerialization
  clangIndex
  clangSema
  clangAST
  clangLex
  clangBasic)

set( LLVM_LINK_COMPONENTS
  support
  mc
  )

set(SOURCES
  CIndex.cpp
  CIndexCXX.cpp
  CIndexCodeCompletion.cpp
  CIndexDiagnostic.cpp
  CIndexInclusionStack.cpp
  CIndexUSRs.cpp
  CIndexer.cpp
  CXCursor.cpp
  CXString.cpp
  CXType.cpp
  ../../include/clang-c/Index.h
  )

if( LLVM_ENABLE_PIC AND NOT WIN32 )
  set(SHARED_LIBRARY TRUE)
  add_clang_library(libclang ${SOURCES})

  set_target_properties(libclang
    PROPERTIES
    OUTPUT_NAME "clang"
    VERSION ${LIBCLANG_LIBRARY_VERSION}
    DEFINE_SYMBOL _CINDEX_LIB_)

  if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
    # Darwin-specific linker flags

    set(LIBCLANG_LINK_FLAGS "-Wl,-compatibility_version -Wl,1")

    set(LIBCLANG_LINK_FLAGS
      "${LIBCLANG_LINK_FLAGS} -Wl,-dead_strip -Wl,-seg1addr -Wl,0xE0000000")

    set_target_properties(libclang
      PROPERTIES
      LINK_FLAGS "${LIBCLANG_LINK_FLAGS}"
      INSTALL_NAME_DIR "@executable_path/../lib")
  endif()

  set(LIBCLANG_STATIC_TARGET_NAME libclang_static)
else()
  set(LIBCLANG_STATIC_TARGET_NAME libclang)
endif()

if( NOT BUILD_SHARED_LIBS )
  add_clang_library(${LIBCLANG_STATIC_TARGET_NAME} STATIC ${SOURCES})

  set_target_properties(${LIBCLANG_STATIC_TARGET_NAME}
    PROPERTIES
    OUTPUT_NAME "clang")

  if(MSVC)
    # windows.h doesn't compile with /Za
    get_target_property(NON_ANSI_COMPILE_FLAGS ${LIBCLANG_STATIC_TARGET_NAME}
      COMPILE_FLAGS)
    string(REPLACE /Za "" NON_ANSI_COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS})
    set_target_properties(${LIBCLANG_STATIC_TARGET_NAME} PROPERTIES
      COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS})
  endif()
endif()<commit_msg>Reverting "Build libclang as a static library too."<commit_after>set(SHARED_LIBRARY TRUE)

set(LLVM_USED_LIBS
  clangFrontend
  clangDriver
  clangSerialization
  clangIndex
  clangSema
  clangAST
  clangLex
  clangBasic)

set( LLVM_LINK_COMPONENTS
  support
  mc
  )

add_clang_library(libclang
  CIndex.cpp
  CIndexCXX.cpp
  CIndexCodeCompletion.cpp
  CIndexDiagnostic.cpp
  CIndexInclusionStack.cpp
  CIndexUSRs.cpp
  CIndexer.cpp
  CXCursor.cpp
  CXString.cpp
  CXType.cpp
  ../../include/clang-c/Index.h
)

if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  # Darwin-specific linker flags

  set(LIBCLANG_LINK_FLAGS "-Wl,-compatibility_version -Wl,1")
                        
  set(LIBCLANG_LINK_FLAGS 
      "${LIBCLANG_LINK_FLAGS} -Wl,-dead_strip -Wl,-seg1addr -Wl,0xE0000000")

  set_target_properties(libclang
    PROPERTIES
    LINK_FLAGS "${LIBCLANG_LINK_FLAGS}"
    INSTALL_NAME_DIR "@executable_path/../lib")
endif()

# Versioning information
set_target_properties(libclang PROPERTIES VERSION ${LIBCLANG_LIBRARY_VERSION})

if(MSVC)
  # windows.h doesn't compile with /Za
  get_target_property(NON_ANSI_COMPILE_FLAGS libclang COMPILE_FLAGS)
  string(REPLACE /Za "" NON_ANSI_COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS})
  set_target_properties(libclang PROPERTIES COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS})
endif(MSVC)

set_target_properties(libclang
  PROPERTIES
  PREFIX ""  # Otherwise we get liblibclang.so
  LINKER_LANGUAGE CXX
  DEFINE_SYMBOL _CINDEX_LIB_)
{'fraction_non_alphanumeric': 0.0833074292819397, 'fraction_numerical': 0.006838669567920423, 'mean_word_length': 4.6456140350877195, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '5274938', 'n_tokens_mistral': 1294, 'n_tokens_neox': 1219, 'n_words': 187}