osyo-manga / vim-snowdrop

libclang in Vim
21 stars 1 forks source link

Windows 64bit マシンで ClangOnWin の 64 bit のバイナリを使用すると問題が起こる #5

Open osyo-manga opened 9 years ago

osyo-manga commented 9 years ago

不具合 1

再現環境

struct X {
  int val1; // SnowdropFixit -> int val1;
};

int func() { return 1; }

int main(int argc, char const* argv[])
{
//■ SnowdropGotoDefinition -> 8行目へ
//| ■ SnowdropEchoTypeof -> フリーズ
  X x;
//■ SnowdropGotoDefinition -> not fount x
//| ■ SnowdropEchoTypeof -> フリーズ
//| ■ SnowdropGotoDefinition -> フリーズ
//| |      ■ SnowdropEchoResultTypeof -> type : int 
//| |      ■ SnowdropGotoDefinition -> 12行目へ
  x.val1 = func();
//    ■ SnowdropEchoTypeof -> フリーズ
//    |      ■ SnowdropEchoTypeof -> type : int 
  int val2 = 10;
  return 0;
}

不具合 2

再現環境

struct X {
  int val1; // SnowdropFixit -> int val1;
};

int func() { return 1; }

int main(int argc, char const* argv[])
{
//■ SnowdropGotoDefinition -> エラー(*1)
//| ■ SnowdropEchoTypeof -> エラー(*2)
  X x;
  return 0;
}
ghost commented 9 years ago

不具合1についてです. 今現在,プラグインがアップデートされたことで

//■ SnowdropGotoDefinition -> not fount x
  x.val1 = func();

は修正されており,

  X x;

の行に飛ぶようになっています.

また,

libcall(libclang, "clang_getClangVersion", "") の呼び出しの結果がおかしい これは 32 bit 版の Clang では動作する

この32bit版のClangが動作するのは32bit版のVimから呼び出した場合で, 64bit版のVimから呼び出した場合は不具合2と同様, clang_getClangVersion のライブラリ呼出に失敗します.

osyo-manga commented 9 years ago

コメントありがとうございます。 Windows 8 と Windows 7 だとエラー内容が違っているみたいですねぇ。

osyo-manga commented 9 years ago

現状、原因を突き止めるのは難しそうなので、どの環境(組み合わせ)だと問題なく動作するのかを探す感じになるかなぁ…。

osyo-manga commented 9 years ago

検証1

環境

成功

失敗(もしくはエラー、落ちる)

参照

roxma commented 7 years ago

Any progress? I have the same issue with SnowdropGotoDefinition

Error detected while processing function snowdrop#goto_definition_in_cursor[3]..snowdrop#definition_in_cursor[1]..snowdrop#definition[1]..snowdrop#context[1]..snowdrop#libclang#context[1]..<SNR>42_binding_call[1]..snowdrop#libclang#pyth
on#context[2]..provider#python#Call:
line   18:
error caught in request handler 'python_eval ('snowdrop.context(\t\tvim.eval("a:source"),\t\tvim.eval("a:filename"),\t\tvim.eval("option"),\t\tint(vim.eval("a:line")),\t\tint(vim.eval("a:col")) )\t',)':
Traceback (most recent call last):
  File "/home/roxma/.local/lib/python2.7/site-packages/neovim/plugin/script_host.py", line 150, in python_eval
    return eval(expr, self.module.__dict__)
  File "<string>", line 1, in <module>
  File "/home/roxma/dotfiles/vim/.config/nvim/plugged/vim-snowdrop/snowdrop/python/snowdrop/__init__.py", line 35, in context
    return libclang.context(source, filename, options, line, col)
  File "/home/roxma/dotfiles/vim/.config/nvim/plugged/vim-snowdrop/snowdrop/python/snowdrop/libclang.py", line 219, in context
    result["semantic_parent"] = cursor_context(cursor.semantic_parent)
  File "/home/roxma/dotfiles/vim/.config/nvim/plugged/vim-snowdrop/snowdrop/python/snowdrop/libclang.py", line 198, in cursor_context
    "arguments_type" : cursor_arguments_type_context(cursor),
  File "/home/roxma/dotfiles/vim/.config/nvim/plugged/vim-snowdrop/snowdrop/python/snowdrop/libclang.py", line 172, in cursor_arguments_type_context
    return ([cursor_context(x)["type"] for x in cursor.get_arguments()])
  File "/home/roxma/dotfiles/vim/.config/nvim/plugged/vim-snowdrop/snowdrop/python/snowdrop/libclang.py", line 196, in cursor_context
    "type" : type_context(cursor.type),
  File "/home/roxma/dotfiles/vim/.config/nvim/plugged/vim-snowdrop/snowdrop/python/snowdrop/libclang.py", line 149, in type_context
    "kind" : type.kind.name,
  File "/home/roxma/dotfiles/vim/.config/nvim/plugged/vim-snowdrop/snowdrop/python/snowdrop/clang/cindex.py", line 1463, in kind
    return TypeKind.from_id(self._kind_id)
  File "/home/roxma/dotfiles/vim/.config/nvim/plugged/vim-snowdrop/snowdrop/python/snowdrop/clang/cindex.py", line 1403, in from_id
    raise ValueError,'Unknown type kind %d' % id
ValueError: Unknown type kind 114
Error detected while processing function snowdrop#goto_definition_in_cursor[3]..snowdrop#definition_in_cursor[1]..snowdrop#definition[2]..<SNR>39_get_definition:
line    1:
E121: Undefined variable: definition
E116: Invalid arguments for function empty(a:cursor.definition)
E15: Invalid expression: empty(a:cursor.definition)
Not found 'abcdfe'.

source code of test.cpp:

#include <iostream>

int main(int argc, const char *argv[])
{
    int abcdfe = 5;
    abcdfe = 3;
    return 0;
}

minimal vimrc:

set nocompatible
syntax on
filetype plugin indent on
set encoding=utf-8 fileencodings=ucs-bom,utf-8,gbk,gb18030,latin1 termencoding=utf-8

call plug#begin(expand('<sfile>:h') . '/plugged/')
Plug 'osyo-manga/vim-snowdrop'
let g:snowdrop#libclang_directory = "/usr/lib"
call plug#end()
osyo-manga commented 7 years ago

hi, Thanks for Issues. Please create new Issue.