<commit_before>mkdir external

## Get llvm
if [ ! -d "external/llvm" ]; then
  pushd external
  git clone https://github.com/llvm-mirror/llvm
  cd llvm
  patch -p0 <  ../../llvm_patches/RefCount.diff
  popd
fi

## Get libcxx
if [ ! -d "external/llvm/projects/libcx" ]; then
  pushd external/llvm/projects
  git clone https://github.com/llvm-mirror/libcxx
  git clone https://github.com/llvm-mirror/libcxxabi
  popd
fi

## Get clang
if [ ! -d "external/llvm/tools/clang" ]; then
  pushd external/llvm/tools
  git clone https://github.com/llvm-mirror/clang
  cd clang
  patch -p0 < ../../../../llvm_patches/IRTime.diff
  patch -p0 < ../../../../llvm_patches/LexingTime.diff
  patch -p0 < ../../../../llv_patches/TemplateInstTime.diff
  popd
fi

## Get templight
if [ ! -d "external/llvm/tools/clang/tools/templight" ]; then
  pushd external/llvm/tools/clang/tools
  git clone https://github.com/mikael-s-persson/templight
  cd ..
  svn patch tools/templight/templight_clang_patch.diff
  popd
fi

## Build all llvm
if [ ! -d "external/llvm_build" ]; then
  mkdir external/llvm_build
  pushd external/llvm_build
  cmake ../llvm \
    -G Ninja \
    -DCMAKE_BUILD_TYPE="Release" \
    -DLLVM_TARGETS_TO_BUILD="X86;AArch64;ARM" \
    -DCMAKE_SHARED_LINKER_FLAGS="-Wl,-ldl,-lpthread,-lutil" \
    -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
  ninja
  popd
fi

## Get template instantiation time tools
if [ ! -d "external/templight-tools" ]; then
  pushd external
  git clone https://github.com/eduardo-elizondo/templight-tools
  cd templight-tools
  cmake .<commit_msg>Modified build to add templight patch<commit_after>mkdir external

## Get llvm
if [ ! -d "external/llvm" ]; then
  pushd external
  git clone https://github.com/llvm-mirror/llvm
  cd llvm
  patch -p0 <  ../../llvm_patches/RefCount.diff
  popd
fi

## Get libcxx
if [ ! -d "external/llvm/projects/libcx" ]; then
  pushd external/llvm/projects
  git clone https://github.com/llvm-mirror/libcxx
  git clone https://github.com/llvm-mirror/libcxxabi
  popd
fi

## Get clang
if [ ! -d "external/llvm/tools/clang" ]; then
  pushd external/llvm/tools
  git clone https://github.com/llvm-mirror/clang
  cd clang
  patch -p0 < ../../../../llvm_patches/IRTime.diff
  patch -p0 < ../../../../llvm_patches/LexingTime.diff
  patch -p0 < ../../../../llv_patches/TemplateInstTime.diff
  popd
fi

## Get templight
if [ ! -d "external/llvm/tools/clang/tools/templight" ]; then
  pushd external/llvm/tools/clang/tools
  git clone https://github.com/mikael-s-persson/templight
  cd ..
  patch -p0 < tools/templight/templight_clang_patch.diff
  popd
fi

## Build all llvm
if [ ! -d "external/llvm_build" ]; then
  mkdir external/llvm_build
  pushd external/llvm_build
  cmake ../llvm \
    -G Ninja \
    -DCMAKE_BUILD_TYPE="Release" \
    -DLLVM_TARGETS_TO_BUILD="X86;AArch64;ARM" \
    -DCMAKE_SHARED_LINKER_FLAGS="-Wl,-ldl,-lpthread,-lutil" \
    -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
  ninja
  popd
fi

## Get template instantiation time tools
if [ ! -d "external/templight-tools" ]; then
  pushd external
  git clone https://github.com/eduardo-elizondo/templight-tools
  cd templight-tools
  cmake .
{'fraction_non_alphanumeric': 0.14303959131545338, 'fraction_numerical': 0.005427841634738187, 'mean_word_length': 3.0373711340206184, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 3, 'https://': 12, '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': '4771316', 'n_tokens_mistral': 1187, 'n_tokens_neox': 1169, 'n_words': 237}