<commit_before>
if(SWIFT_BUILD_ONLY_SYNTAXPARSERLIB)
  set(SWIFTAST_LLVM_LINK_COMPONENTS)
else()
  set(SWIFTAST_LLVM_LINK_COMPONENTS
    bitreader bitwriter coroutines coverage irreader debuginfoDWARF
    profiledata instrumentation object objcarcopts mc mcparser
    bitreader bitwriter lto ipo option core support ${LLVM_TARGETS_TO_BUILD}
  )
endif()

add_swift_host_library(swiftAST STATIC
  AbstractSourceFileDepGraphFactory.cpp
  AccessRequests.cpp
  ASTContext.cpp
  ASTDemangler.cpp
  ASTDumper.cpp
  ASTMangler.cpp
  ASTNode.cpp
  ASTPrinter.cpp
  ASTScope.cpp
  ASTScopeCreation.cpp
  ASTScopeLookup.cpp
  ASTScopePrinting.cpp
  ASTScopeSourceRange.cpp
  ASTVerifier.cpp
  ASTWalker.cpp
  Attr.cpp
  AutoDiff.cpp
  Availability.cpp
  AvailabilitySpec.cpp
  Builtins.cpp
  CaptureInfo.cpp
  ClangSwiftTypeCorrespondence.cpp
  ClangTypeConverter.cpp
  ConcreteDeclRef.cpp
  ConformanceLookupTable.cpp
  Decl.cpp
  DeclContext.cpp
  DeclNameLoc.cpp
  DiagnosticConsumer.cpp
  DiagnosticEngine.cpp
  DiagnosticList.cpp
  DocComment.cpp
  Evaluator.cpp
  Expr.cpp
  FineGrainedDependencies.cpp
  FrontendSourceFileDepGraphFactory.cpp
  GenericEnvironment.cpp
  GenericSignature.cpp
  GenericSignatureBuilder.cpp
  Identifier.cpp
  ImportCache.cpp
  IncrementalRanges.cpp
  IndexSubset.cpp
  InlinableText.cpp
  LayoutConstraint.cpp
  Module.cpp
  ModuleLoader.cpp
  ModuleNameLookup.cpp
  NameLookup.cpp
  NameLookupRequests.cpp
  Parameter.cpp
  Pattern.cpp
  PlatformKind.cpp
  PrettyStackTrace.cpp
  ProtocolConformance.cpp
  RawComment.cpp
  ReferencedNameTracker.cpp
  RequirementEnvironment.cpp
  SyntaxASTMap.cpp
  SILLayout.cpp
  Stmt.cpp
  SubstitutionMap.cpp
  SwiftNameTranslation.cpp
  Type.cpp
  TypeCheckRequests.cpp
  TypeDeclFinder.cpp
  TypeJoinMeet.cpp
  TypeRefinementContext.cpp
  TypeRepr.cpp
  TypeWalker.cpp
  UnqualifiedLookup.cpp
  USRGeneration.cpp

  LLVM_LINK_COMPONENTS
  ${SWIFTAST_LLVM_LINK_COMPONENTS}
  )

if(SWIFT_FORCE_OPTIMIZED_TYPECHECKER)
  if(CMAKE_CXX_COMPILER_ID STREQUAL MSVC OR CMAKE_CXX_SIMULATE_ID STREQUAL MSVC)
    target_compile_options(swiftAST PRIVATE /O2 /Ob2)
  else()
    target_compile_options(swiftAST PRIVATE -O3)
  endif()
endif()
if(NOT SWIFT_BUILD_ONLY_SYNTAXPARSERLIB)
  target_link_libraries(swiftAST INTERFACE
    clangCodeGen
    clangIndex
    clangFormat
    clangToolingCore
    clangFrontendTool
    clangFrontend
    clangDriver
    clangSerialization
    clangParse
    clangSema
    clangAnalysis
    clangEdit
    clangRewriteFrontend
    clangRewrite
    clangAST
    clangLex
    clangAPINotes
    clangBasic)
endif()

if(SWIFT_BUILD_ONLY_SYNTAXPARSERLIB)
  # Add clangBasic as a single direct dependency to avoid bringing along some
  # llvm libraries that we don't need.
  if("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "WINDOWS")
    set(clangBasicDep "${LLVM_LIBRARY_OUTPUT_INTDIR}/clangBasic.lib")
  else()
    set(clangBasicDep "${LLVM_LIBRARY_OUTPUT_INTDIR}/libclangBasic.a")
  endif()
  target_link_libraries(swiftAST PUBLIC
    swiftBasic)
  target_link_libraries(swiftAST PRIVATE
    swiftSyntax
    ${clangBasicDep})
  target_compile_definitions(swiftAST PRIVATE
    SWIFT_BUILD_ONLY_SYNTAXPARSERLIB=1)
else()
  target_link_libraries(swiftAST PUBLIC
    swiftBasic)
  target_link_libraries(swiftAST PRIVATE
    swiftMarkup
    swiftSyntax)
endif()

# intrinsics_gen is the LLVM tablegen target that generates the include files
# where intrinsics and attributes are declared. swiftAST depends on these
# headers.<commit_msg>Factor out common dependencies in libAST.<commit_after>
if(SWIFT_BUILD_ONLY_SYNTAXPARSERLIB)
  set(SWIFTAST_LLVM_LINK_COMPONENTS)
else()
  set(SWIFTAST_LLVM_LINK_COMPONENTS
    bitreader bitwriter coroutines coverage irreader debuginfoDWARF
    profiledata instrumentation object objcarcopts mc mcparser
    bitreader bitwriter lto ipo option core support ${LLVM_TARGETS_TO_BUILD}
  )
endif()

add_swift_host_library(swiftAST STATIC
  AbstractSourceFileDepGraphFactory.cpp
  AccessRequests.cpp
  ASTContext.cpp
  ASTDemangler.cpp
  ASTDumper.cpp
  ASTMangler.cpp
  ASTNode.cpp
  ASTPrinter.cpp
  ASTScope.cpp
  ASTScopeCreation.cpp
  ASTScopeLookup.cpp
  ASTScopePrinting.cpp
  ASTScopeSourceRange.cpp
  ASTVerifier.cpp
  ASTWalker.cpp
  Attr.cpp
  AutoDiff.cpp
  Availability.cpp
  AvailabilitySpec.cpp
  Builtins.cpp
  CaptureInfo.cpp
  ClangSwiftTypeCorrespondence.cpp
  ClangTypeConverter.cpp
  ConcreteDeclRef.cpp
  ConformanceLookupTable.cpp
  Decl.cpp
  DeclContext.cpp
  DeclNameLoc.cpp
  DiagnosticConsumer.cpp
  DiagnosticEngine.cpp
  DiagnosticList.cpp
  DocComment.cpp
  Evaluator.cpp
  Expr.cpp
  FineGrainedDependencies.cpp
  FrontendSourceFileDepGraphFactory.cpp
  GenericEnvironment.cpp
  GenericSignature.cpp
  GenericSignatureBuilder.cpp
  Identifier.cpp
  ImportCache.cpp
  IncrementalRanges.cpp
  IndexSubset.cpp
  InlinableText.cpp
  LayoutConstraint.cpp
  Module.cpp
  ModuleLoader.cpp
  ModuleNameLookup.cpp
  NameLookup.cpp
  NameLookupRequests.cpp
  Parameter.cpp
  Pattern.cpp
  PlatformKind.cpp
  PrettyStackTrace.cpp
  ProtocolConformance.cpp
  RawComment.cpp
  ReferencedNameTracker.cpp
  RequirementEnvironment.cpp
  SyntaxASTMap.cpp
  SILLayout.cpp
  Stmt.cpp
  SubstitutionMap.cpp
  SwiftNameTranslation.cpp
  Type.cpp
  TypeCheckRequests.cpp
  TypeDeclFinder.cpp
  TypeJoinMeet.cpp
  TypeRefinementContext.cpp
  TypeRepr.cpp
  TypeWalker.cpp
  UnqualifiedLookup.cpp
  USRGeneration.cpp

  LLVM_LINK_COMPONENTS
  ${SWIFTAST_LLVM_LINK_COMPONENTS}
  )

if(SWIFT_FORCE_OPTIMIZED_TYPECHECKER)
  if(CMAKE_CXX_COMPILER_ID STREQUAL MSVC OR CMAKE_CXX_SIMULATE_ID STREQUAL MSVC)
    target_compile_options(swiftAST PRIVATE /O2 /Ob2)
  else()
    target_compile_options(swiftAST PRIVATE -O3)
  endif()
endif()
if(NOT SWIFT_BUILD_ONLY_SYNTAXPARSERLIB)
  target_link_libraries(swiftAST INTERFACE
    clangCodeGen
    clangIndex
    clangFormat
    clangToolingCore
    clangFrontendTool
    clangFrontend
    clangDriver
    clangSerialization
    clangParse
    clangSema
    clangAnalysis
    clangEdit
    clangRewriteFrontend
    clangRewrite
    clangAST
    clangLex
    clangAPINotes
    clangBasic)
endif()

target_link_libraries(swiftAST
  PUBLIC swiftBasic
  PRIVATE swiftSyntax)
if(SWIFT_BUILD_ONLY_SYNTAXPARSERLIB)
  # Add clangBasic as a single direct dependency to avoid bringing along some
  # llvm libraries that we don't need.
  if("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "WINDOWS")
    target_link_libraries(swiftAST PRIVATE
      "${LLVM_LIBRARY_OUTPUT_INTDIR}/clangBasic.lib")
  else()
    target_link_libraries(swiftAST PRIVATE
      "${LLVM_LIBRARY_OUTPUT_INTDIR}/libclangBasic.a")
  endif()
  target_compile_definitions(swiftAST PRIVATE
    SWIFT_BUILD_ONLY_SYNTAXPARSERLIB=1)
else()
  target_link_libraries(swiftAST PRIVATE
    swiftMarkup)
endif()

# intrinsics_gen is the LLVM tablegen target that generates the include files
# where intrinsics and attributes are declared. swiftAST depends on these
# headers.
{'fraction_non_alphanumeric': 0.049734080781946244, 'fraction_numerical': 0.001149920942935173, 'mean_word_length': 4.670741646291768, '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': '1741686', 'n_tokens_mistral': 2499, 'n_tokens_neox': 2363, 'n_words': 424}