Comments (5)
So I found out why this happens, at least. So I don't forget, basically the use of a template instantiates a new class, to which the new type refers. The information about this being a templated class is lost, instead you'll obtain the concrete class. At this point it's not possible to easily get back to the templated definition as far as I know. What is possible though, is to get the cursor at the location of the template instantiation, which coincides with the original template declaration, and obtain a cursor to the template.
From there we still need to figure out with which arguments the template was actually instantiated, which might not be trivial to do robustly.
from cldoc.
Actually, we can get the templated cursor back, there was just some binding missing.
from cldoc.
Is this related to the Unhandled cursor: CursorKind.TEMPLATE_REF
messages I am seeing when building the documentation?
To do this robustly, you need to:
- know what each template parameter expands to;
- know which parameters are defined in terms of other parameters (e.g. for std::list, Allocator is defined in terms of T);
- reverse the type expansion for parameters identified in (2);
- remove the template parameters whose signature matches the default parameters.
Thus, for:
std::list<std::string, std::allocator<std::string>>
you have:
1: T = std::string , Allocator = std::allocator<std::string>
3: T = std::string , Allocator = std::allocator<T>
4:T = std::string
Unless libclang provides a way of getting this information in the way it has structured the types.
from cldoc.
It seems this would be pretty hard to get right currently. It looks like there might be API coming in the next version of libclang (https://github.com/llvm-mirror/clang/blob/master/include/clang-c/Index.h#L3110), but for now it's not available.
from cldoc.
This has been fixed in latest master
, but from the looks of it this will only be possible from clang 4.0 or later (3.9 does not expose this information). I'm considering only supporting 4.0 and upwards.
from cldoc.
Related Issues (20)
- Not recognizing function parameters and returns HOT 2
- Install on Arch linux fails HOT 10
- ValueError: Unknown cursor kind 601 on macOS HOT 3
- Errors when including <cstdint> HOT 2
- Support C variable arguments HOT 2
- ValueError: Unknown type kind 119 (Mac OS X Sierra)
- Unknown type kind HOT 4
- Clang 3.9 incompatibilities HOT 2
- 'friend class Bar' causes "ValueError: Unknown template argument kind 603" HOT 2
- Not working with Python3 HOT 3
- ubuntu 17.10 problem library problem with 1.11 latest release HOT 2
- TypeError: expected a string or other character buffer object HOT 2
- Passing linker arguments into cldoc is broken
- Unable to match comments if a macro is expanded before the declaration.
- Failed to run on Ubuntu 18.04 LTS HOT 6
- how to generate documentation from folder tree HOT 1
- python 3.5 compatibility HOT 1
- Is this library still maintained? HOT 1
- Links in README.md are broken HOT 1
- Python 3.10 > AttributeError: module 'collections' has no attribute 'MutableMapping'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cldoc.