clang-tutor | A collection of out-of-tree Clang plugins for teaching | Compiler library
kandi X-RAY | clang-tutor Summary
kandi X-RAY | clang-tutor Summary
A collection of out-of-tree Clang plugins for teaching and learning
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of clang-tutor
clang-tutor Key Features
clang-tutor Examples and Code Snippets
Community Discussions
Trending Discussions on clang-tutor
QUESTION
I am using a RecursiveASTVisitor
to capture variable declarations. For templates, such as the one below, how can I use clang tool to get the location in the source code for each of the parameters?
ANSWER
Answered 2019-Jun-08 at 22:50The first attempt was the closest to what you need. The node you are looking for is VarDecl
and it's type location. VarTemplateSpecializationDecl
is a variable template (C++14 feature) specialization.
Represents a variable template specialization, which refers to a variable template with a given set of template arguments.
Variable template specializations represent both explicit specializations of variable templates, as in the example below, and implicit instantiations of variable templates.
Clang makes a distinction between types and type locations. Type is more of an abstract entity, while TypeLoc represents an actual entrance of a type in the source code. When you write type A
in your code many times, it's all different TypeLocs, but the same Type.
Here is an example of how to get TypeLoc for your declaration:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install clang-tutor
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page