<div dir="ltr">You might need to provide more details - at least a cursory example shows the function call in the ast dump: <a href="https://godbolt.org/z/zvqTa3">https://godbolt.org/z/zvqTa3</a></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 3, 2020 at 4:02 AM Владимир Фролов via cfe-users <<a href="mailto:cfe-users@lists.llvm.org">cfe-users@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Greetings! I'm using clang for source-to-source translation.</div><div> </div><div>Recently I got a problem with parsing code which use templates.</div><div>First, here is the working example:</div><div> </div><div><div><span style="font-family:"courier new",monospace">struct MyTestVector2</span></div><div><span style="font-family:"courier new",monospace">{</span></div><div><span style="font-family:"courier new",monospace"> unsigned int _data[6];</span></div><div><span style="font-family:"courier new",monospace"> unsigned int * data() { return &_data[0]; }</span></div><div><span style="font-family:"courier new",monospace">};</span></div></div><div><span style="font-family:"courier new",monospace">... </span></div><div><div><span style="font-family:"courier new",monospace">MyTestVector2 testData2;</span></div><div><span style="font-family:"courier new",monospace">kernel_TestColor(&hit, </span></div><div><span style="font-family:"courier new",monospace">                testData2.data(), tidX, tidY);</span></div></div><div>This code processed normally and i gon correct "CXXMemberCallExpr" node for kernel_TestColor which i actually need.</div><div>Then i changed MyTestVector2 to template:</div><div> </div><div><div><span style="font-family:"courier new",monospace">template<class T></span></div><div><span style="font-family:"courier new",monospace">struct MyTestVector2</span></div><div><span style="font-family:"courier new",monospace">{</span></div><div><span style="font-family:"courier new",monospace"> T _data[6];</span></div><div><span style="font-family:"courier new",monospace"> T * data() { return &_data[0]; }</span></div><div><span style="font-family:"courier new",monospace">};</span></div><div> </div><div><span style="font-family:"courier new",monospace">...</span></div><div><span style="font-family:"courier new",monospace">MyTestVector2<unsigned int> testData2;</span></div><div><span style="font-family:"courier new",monospace">kernel_TestColor(&hit,</span></div><div><span style="font-family:"courier new",monospace">                testData2.data(), tidX, tidY);</span></div><div> </div></div><div>This time i got</div><div> </div><div><div>`-DeclStmt 0x55555816e128 <line:59:3, col:40></div><div>  `-VarDecl 0x55555816e0c0 <col:3, col:31> col:31 invalid testData2 'MyTestVector2<unsigned int>':'MyTestVector2<unsigned int>'</div></div><div> </div><div>This time, The AST node for <span style="font-family:"courier new",monospace">kernel_TestColor is just missed!</span></div><div><div>The code is absolutely correct itself, it can be build and run.</div></div><div> </div><div>I'm using AST processing for code generation, so it is important for me to get  AST node for <span style="font-family:"courier new",monospace">kernel_TestColor</span> and then analyze its arguments.</div><div>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 "<span style="font-family:"courier new",monospace">testData2.data()</span>" at some level of AST for the second parameter of <span style="font-family:"courier new",monospace">kernel_TestColor would be enough for me</span>.</div><div> </div><div>I would be appretiate for help or advice.</div><div>Currently i use llvm 10.</div><div><div>Thanks!</div></div><div>-- </div><div>Best Regards,</div><div> Frolov V.A.</div><div> </div>_______________________________________________<br>
cfe-users mailing list<br>
<a href="mailto:cfe-users@lists.llvm.org" target="_blank">cfe-users@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users</a><br>
</blockquote></div>