<commit_before>JULIAHOME=EnvHash()["JULIAHOME"]
libLLVM_path = joinpath(JULIAHOME, "deps/llvm-3.3/include/llvm-c")
clanginc_path = joinpath(JULIAHOME, "deps/llvm-3.3/Release/lib/clang/3.3/include")

wrap_hdrs = map(x->joinpath(libLLVM_path, x), 
  {
  "BitWriter.h",
  "Target.h",
  "Initialization.h",
  "Disassembler.h",
  "Core.h",
  "TargetMachine.h",
  "Analysis.h",
  "ExecutionEngine.h",
  "Transforms/Vectorize.h",
  "Transforms/PassManagerBuilder.h",
  "Transforms/Scalar.h",
  "Transforms/IPO.h",
  "LinkTimeOptimizer.h",
  "Object.h",
  "EnhancedDisassembly.h",
  "BitReader.h"
  })

clang_includes = map(x->joinpath(JULIAHOME, x), [
  "deps/llvm-3.3/build/Release/lib/clang/3.3/include",
  "deps/llvm-3.3/include",
  "deps/llvm-3.3/include",
  "deps/llvm-3.3/build/include/",
  "deps/llvm-3.3/include/"
  ])
clang_extraargs = ["-D", "__STDC_LIMIT_MACROS", "-D", "__STDC_CONSTANT_MACROS"]

using Clang.cindex
using Clang.wrap_c
function wrap_libLLVM()
  wrap_c.wrap_c_headers(wrap_hdrs, clang_includes, clang_extraargs, "libLLVM_h.jl")
end
<commit_msg>Update libLLVM generator example<commit_after>#
# Example script to wrap libLLVM (LLVM C interface)
#

using Clang.cindex
using Clang.wrap_c

LLVM_VER = "3.3"
LLVM_BUILD_TYPE="Release+Asserts"

JULIA_ROOT=abspath(JULIA_HOME, "../../")
LLVM_PATH=joinpath(JULIA_ROOT, "deps/llvm-$LLVM_VER")
libLLVM_path = joinpath(LLVM_PATH, "include/llvm-c")
clanginc_path = joinpath(LLVM_PATH, "build/$LLVM_BUILD_TYPE/lib/clang/3.3/include")

libllvm_hdrs = map(x->joinpath(libLLVM_path, x), 
    {
    "BitWriter.h",
    "Target.h",
    "Initialization.h",
    "Disassembler.h",
    "Core.h",
    "TargetMachine.h",
    "Analysis.h",
    "ExecutionEngine.h",
    "Transforms/Vectorize.h",
    "Transforms/PassManagerBuilder.h",
    "Transforms/Scalar.h",
    "Transforms/IPO.h",
    "LinkTimeOptimizer.h",
    "Object.h",
    "BitReader.h"
    })

clang_includes = map(x::ASCIIString->joinpath(LLVM_PATH, x), [
    "build/$LLVM_BUILD_TYPE/lib/clang/3.3/include",
    "build/include/",
    "include"
    ])
clang_extraargs = ["-D", "__STDC_LIMIT_MACROS", "-D", "__STDC_CONSTANT_MACROS"]

const wc = wrap_c.init("libLLVM_h.jl", "libLLVM_common.jl", clang_includes,
                       clang_extraargs, (x...)->true, (x...)->true, (x...)->"libLLVM_h.jl")

function wrap_libLLVM(wc::WrapContext, wrap_hdrs::Vector{ASCIIString})
    wrap_c.wrap_c_headers(wc, wrap_hdrs)
end

{'fraction_non_alphanumeric': 0.17809917355371901, 'fraction_numerical': 0.009917355371900827, 'mean_word_length': 4.286026200873362, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '6853320', 'n_tokens_mistral': 1031, 'n_tokens_neox': 1032, 'n_words': 122}