diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2022-11-27 15:42:18 -0800 |
---|---|---|
committer | Takashi Kokubun <takashikkbn@gmail.com> | 2022-11-27 21:04:41 -0800 |
commit | 6d26f78f684607a39249882ea686a231f8768bd5 (patch) | |
tree | a8094cfe5159387ff71ffdb701739b70ba8dee53 /tool | |
parent | 833545a211b720c1adb6dba5b4b110a8cf62dc1b (diff) |
MJIT: Clear .cache/clangd on bindgen if exists
Diffstat (limited to 'tool')
-rwxr-xr-x | tool/mjit/bindgen.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tool/mjit/bindgen.rb b/tool/mjit/bindgen.rb index c1003fd723..1c60262216 100755 --- a/tool/mjit/bindgen.rb +++ b/tool/mjit/bindgen.rb @@ -329,6 +329,13 @@ cflags = [ File.join(build_dir, ".ext/include/#{RUBY_PLATFORM}"), ].map { |dir| "-I#{dir}" } +# Clear .cache/clangd created by the language server, which could break this bindgen +clangd_cache = File.join(src_dir, '.cache/clangd') +if Dir.exist?(clangd_cache) + system('rm', '-rf', clangd_cache, exception: true) +end + +# Parse mjit_compiler.h and generate mjit_c.rb nodes = HeaderParser.new(File.join(src_dir, 'mjit_compiler.h'), cflags: cflags).parse generator = BindingGenerator.new( src_path: src_path, @@ -424,4 +431,5 @@ generator = BindingGenerator.new( ) generator.generate(nodes) +# Write mjit_c.rb File.write(src_path, generator.src) |