Greetings! I'm using clang for source-to-source translation.
Recently I got a problem with parsing code which use templates.
First, here is the working example:
struct MyTestVector2
{
unsigned int _data[6];
unsigned int * data() { return &_data[0]; }
};
...
MyTestVector2 testData2;
kernel_TestColor(&hit,
testData2.data(), tidX, tidY);
This code processed normally and i gon correct "CXXMemberCallExpr" node for kernel_TestColor which i actually need.
Then i changed MyTestVector2 to template:
template<class T>
struct MyTestVector2
{
T _data[6];
T * data() { return &_data[0]; }
};
...
MyTestVector2<unsigned int> testData2;
kernel_TestColor(&hit,
testData2.data(), tidX, tidY);
This time i got
`-DeclStmt 0x55555816e128 <line:59:3, col:40>
`-VarDecl 0x55555816e0c0 <col:3, col:31> col:31 invalid testData2 'MyTestVector2<unsigned int>':'MyTestVector2<unsigned int>'
This time, The AST node for kernel_TestColor is just missed!
The code is absolutely correct itself, it can be build and run.
I'm using AST processing for code generation, so it is important for me to get AST node for kernel_TestColor and then analyze its arguments.
I understand that this seems to be not a bug, but ... may be, there is a way to make parser more tolerant to data types ... because what i actually need is just a strings of all parameters, so, just having "testData2.data()" at some level of AST for the second parameter of kernel_TestColor would be enough for me.
I would be appretiate for help or advice.
Currently i use llvm 10.
Thanks!
--
Best Regards,
Frolov V.A.
_______________________________________________ cfe-users mailing list cfe-users@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users