• Hi, I’m trying to get the SourceLocation of a type reference inside an explicit template instantiation declaration, for example: struct Foo {}; template void func(const Foo &) {} // I want the SourceLocation of Foo on this line: template void func<0>(const Foo &); I’ve tried to get the SourceLocation of typeLoc , but return the location from the template definition instead of the instantiation line. • Is there a correct way to retrieve the SourceLocation of a type reference in the parameter list of an explicit instantiation declaration, or is this information simply not preserved in the AST? • zwuis 2 AST Nodes of explicit instantiation are missing currently. • 1 Like

Hi, I’m trying to get the SourceLocation of a type reference inside an explicit template instantiation declaration, for example: struct Foo {}; template void func(const Foo &) {} // I want the SourceLocation of Foo on this line: template void func<0>(const Foo &); I’ve tried to get the SourceLocation of typeLoc , but return the location from the template definition instead of the instantiation line. • Is there a correct way to retrieve the SourceLocation of a type reference in the parameter list of an explicit instantiation declaration, or is this information simply not preserved in the AST? • zwuis 2 AST Nodes of explicit instantiation are missing currently.

Article Summaries:

  • Hi, I’m trying to get the SourceLocation of a type reference inside an explicit template instantiation declaration, for example: struct Foo {}; template void func(const Foo &) {} // I want the SourceLocation of Foo on this line: template void func<0>(const Foo &); I’ve tried to get the SourceLocation of typeLoc , but return the location from the template definition instead of the instantiation line. Is there a correct way to retrieve the SourceLocation of a type reference in the parameter list of an explicit instantiation declaration, or is this information simply not preserved in the AST? T

Sources: