<div dir="ltr"><div>Thanks Artem. This is what I've tried before writing original mail. However it does not work, I got zero matches.</div><div><br></div><div>Here is reproducer:</div><div><br></div><div><div><b>namespace my_nm {</b></div><div><b>template<typename T, unsigned U></b></div><div><b>struct my_type {  };</b></div><div><b>}</b></div><div><b><br></b></div><div><b>my_nm::my_type<int, 10> m;<br></b></div></div><div><br></div><div><br></div><div>I got types from LLVM IR analysis, and then want to find them in Clang AST.</div><div><br></div><div>From LLVM I got mangled name:</div><div><b>N5my_nm7my_typeIiLj10EEE</b><br></div><div><br></div><div>Demangled to:  </div><div><div><b>my_nm::my_type<int, 10u></b></div></div><div><br></div><div>However I can't find it by any matcher:</div><div><br></div><div><div>auto matches = match(qualType(asString("<b style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">my_nm::my_type<int, 10u></b>")).bind("types"), astCtx);  // Zero matches</div></div><div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><div><br></div><div>auto matches = match(qualType(asString("<b style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">N5my_nm7my_typeIiLj10EEE</b>")).bind("types"), astCtx);  // Zero matches</div><div><br></div><div>Probably there is some other way to go back from LLVM IR to Clang AST?</div><div><br></div></div><br class="gmail-Apple-interchange-newline">Thanks,</div><div>Roman</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-02-28 12:36 GMT-08:00 Artem Dergachev <span dir="ltr"><<a href="mailto:noqnoqneo@gmail.com" target="_blank">noqnoqneo@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I don't think it's possible via straightforward lookup - you might need to scan the AST to do this.<br>
<br>
Eg. using ASTMatchers:<br>
<br>
    qualType(asString("my_nm::my_t<wbr>ype<int, 10u>"))<br>
<br>
Or, if you're not using ASTMatchers (likely), you can do the same with a RecursiveASTVisitor. Or manually.<div><div class="h5"><br>
<br>
On 27/02/2018 10:56 AM, Roman Popov via cfe-dev wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
Hello,<br>
<br>
Is it possible to find type in AST by it's qualified type?<br>
<br>
For example I have string "my_nm::my_type<int, 10u>", how can I get clang::QualType if type is present in translation unit?<br>
<br>
Thanks,<br>
Roman<br>
<br>
<br></div></div>
______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
</blockquote>
<br>
</blockquote></div><br></div>