[cfe-dev] How to get the AST of an expression serving as a template argument?

Nikola Smiljanic via cfe-dev cfe-dev at lists.llvm.org
Thu Apr 7 23:34:49 PDT 2016


Sorry I can't give you the exact code but you want to get the primary
template this was instantiated from (I think getTemplatedDecl returns it)
and look at its argument.

On Thu, Apr 7, 2016 at 1:58 PM, slycelote via cfe-dev <
cfe-dev at lists.llvm.org> wrote:
>
> For example, in the program below RecursiveASTVisitor sees the template
> argument as the integer 6. How to get the actual expression "n+n"?
>
> template<int m>
> struct S {
> };
>
> const int n = 3;
>
> template<>
> struct S<n+n> {
> };
>
> int main() {
>     S<6> s;
> }
>
>
> --
> Sly.
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160408/691449e8/attachment.html>


More information about the cfe-dev mailing list