[cfe-dev] Get the SourceRange of explicit template instantiations

Matthias Peschke via cfe-dev cfe-dev at lists.llvm.org
Tue Nov 30 02:57:37 PST 2021


Hello all,

I have asked the same question at stackoverflow 
(https://stackoverflow.com/questions/70095653/get-the-sourcerange-of-explicit-template-instantiations-using-clang-ast-library) 
but so far, there is no response.

I want to get the SourceRange of a whole explicit instantiation statement.
For example in this code snippet:

```|
1 //file my_func.cpp||
2 void template<typename Bar> foo(Bar& bar) {||
3 // some code||
4 }||
5 template void foo<double>(double&);|
```

I want to get the beginning and the end of the statement in line 5 as a 
clang::SourceLocation.

I have tried FunctionTemplateSpecializationInfo::getPointOfInstantiation 
which would give for the above example line 5 and column 15 (the begin 
of foo).

Is there a way to get the begin and the end of the whole statement?

Thanks and best regards,
Matthias Peschke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20211130/18616caf/attachment.html>


More information about the cfe-dev mailing list