jessevdk / cldoc

clang based documentation generator for C and C++
GNU General Public License v2.0
552 stars 58 forks source link

Unknown type kind #126

Closed pascaldekloe closed 6 years ago

pascaldekloe commented 7 years ago

Generation fails and the error message ain't great either for the following file.

https://github.com/pascaldekloe/colfer/blob/master/c/gen/Colfer.c

% cldoc generate -std=c11 -x c -- --output doc Colfer.h 
Processing Colfer.h
Traceback (most recent call last):
  File "/Users/pascal/Library/Python/2.7/bin/cldoc", line 11, in <module>
    sys.exit(run())
  File "/Users/pascal/Library/Python/2.7/lib/python/site-packages/cldoc/__init__.py", line 57, in run
    run_generate(rest)
  File "/Users/pascal/Library/Python/2.7/lib/python/site-packages/cldoc/__init__.py", line 27, in run_generate
    cmdgenerate.run(args)
  File "/Users/pascal/Library/Python/2.7/lib/python/site-packages/cldoc/cmdgenerate.py", line 125, in run
    t.process()
  File "/Users/pascal/Library/Python/2.7/lib/python/site-packages/cldoc/tree.py", line 212, in process
    self.visit(tu.cursor.get_children())
  File "/Users/pascal/Library/Python/2.7/lib/python/site-packages/cldoc/tree.py", line 517, in visit
    self.visit(item.get_children(), node)
  File "/Users/pascal/Library/Python/2.7/lib/python/site-packages/cldoc/tree.py", line 502, in visit
    node = cls(item, None)
  File "/Users/pascal/Library/Python/2.7/lib/python/site-packages/cldoc/nodes/field.py", line 23, in __init__
    self.type = Type(cursor.type, cursor=cursor)
  File "/Users/pascal/Library/Python/2.7/lib/python/site-packages/cldoc/nodes/ctype.py", line 58, in __init__
    self._kind = tp.kind
  File "/Users/pascal/Library/Python/2.7/lib/python/site-packages/cldoc/clang/cindex.py", line 1627, in kind
    return TypeKind.from_id(self._kind_id)
  File "/Users/pascal/Library/Python/2.7/lib/python/site-packages/cldoc/clang/cindex.py", line 1519, in from_id
    raise ValueError,'Unknown type kind %d' % id
ValueError: Unknown type kind 119
topisani commented 7 years ago

same exact problem here. does anyone know why?

wtbarnes commented 7 years ago

I'm also having this exact same issue.

EDIT

This seems to only be an issue with the current pip version. Installing from source seems to solve this issue, at least for the setup listed here. Still not sure what exactly the underlying issue is...

troelsfr commented 6 years ago

The underlying issue (for me at least) seems to be when you use nested classes

class Foo {
  class Bar {
    // ...
  };
  std::vector< Bar > bars_;
 public:
    // ...
 };

I can confirm that this issue is resolved in the latest repository version as @wtbarnes says in his comment.

jessevdk commented 6 years ago

New version has been released that should resolve this.