In the following c++ source file:
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 explicit instantiation of the function template foo
in form of a clang::SourceLocation
.
I have tried:
clang::FunctionDecl* FS; //the AST node for the foo<double> function obtained by some AST matcher
if(const clang::FunctionTemplateSpecializationInfo* TSI = FS->getTemplateSpecializationInfo()) {
clang::SourceLocation = TSI->getPointOfInstantiation();
}
This location will be line 5 and column 15 (the begin of "foo"). I have not found a way to obtain the begin of the complete explicit instantiation and the end. Is there a way to achieve this?