<div dir="ltr"><br clear="all"><div><div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">I am new to clang AST. I am trying to write a program which rewrites all locations in a TU where template alias are used.</div>
<div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px"><br></div><div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">say, given</div><div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">
<br></div><div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">1. template<class T,class U = T></div><div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">2. class class_1{};</div>
<div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">3. template<class U></div><div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">4. using alias1 = class_1<U>; </div>
<div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px"><div>5. template<class T,class U></div><div>6. using alias2 = class_1<T,U>; </div><div>7.</div><div>8. template<class X,class Y = alias1<X> ></div>
<div>9. void foo(...)</div><div>10. {</div><div>11. alias2<int,X> x = ...; <br>12. }</div><div><br></div><div>I am interested to transform all references to template alias to something like typename alias1<X>::type, typename alias2<int,X>::type x = ... etc, and may be optionally remove the 'typename' part if the resulting type is not dependent.</div>
<div>I am using C++ API with RAV, and presently can get all template alias decl using </div>Visit/Traverse TypeAliasTemplateDecl, but has no idea how to get all references to them, such as at line 8 & 11 , irrespective to their name.</div>
<div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px"><br></div><div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">Any help will be appreciated. </div><div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">
Thank you.</div></div>
</div>