TU/tu.R

library(RCIndex)
dir = "~/LLVM4.0/clang+llvm-4.0.0-x86_64-apple-darwin"
dir = "~/LLVM/clang+llvm-8.0.0-x86_64-apple-darwin"
dir = "~/LLVM/clang+llvm-10.0.0-x86_64-apple-darwin"
dir = '~/local'
dir = "~/LLVM"
dir = "~/LLVM/local"
stopifnot(file.exists(dir))
version = c(15, 0)
version = c(18, 1)

dir = sprintf("~/LLVM/local_v%d", version[1])

findex = file.path(dir, "include", "clang-c", "Index.h")

stopifnot(file.exists(findex))

sysdir = system("xcrun --show-sdk-path", intern = TRUE)
cu = createTU(findex, include = c(sprintf("%s/include", dir), file.path(sysdir, "usr/include")))


options(nwarnings = 1000)
enums = getEnums(cu, "clang-c")
w = warnings()

library(RCodeGen)

cat(sprintf("# Autogenerated %s", Sys.Date()),
    sprintf("if(all(clangVersionNum(libclangVersion_Install) == c(%d, %d))) {", version[1], version[2]),
    unlist(lapply(enums, makeEnumClass)),
    file = sprintf("../R/a_enumDefs_%d.%d.R", version[1], version[2]),
    "}",
    sep = "\n\n")
omegahat/RClangSimple documentation built on April 25, 2024, 4:18 a.m.