Skip to content

Instantly share code, notes, and snippets.

@dsisnero
Forked from vaiorabbit/fficlangtest.rb
Created March 1, 2018 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsisnero/c80c99700878392a05a49c7a4f957b30 to your computer and use it in GitHub Desktop.
Save dsisnero/c80c99700878392a05a49c7a4f957b30 to your computer and use it in GitHub Desktop.
Ruby : ffi-clang のテスト
# Getting LLVM :
# http://llvm.org/releases/download.html#3.4
# Usage example :
# $ LLVM_CONFIG=~/Downloads/clang+llvm-3.4-x86_64-apple-darwin10.9/bin/llvm-config ruby fficlangtest.rb /usr/include/stdio.h
require 'ffi/clang'
index = FFI::Clang::Index.new
translation_unit = index.parse_translation_unit(ARGV[0])
cursor = translation_unit.cursor
cursor.visit_children do |cursor, parent|
puts "#{cursor.kind} #{cursor.spelling.inspect}"
next :recurse
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment