<div dir="ltr"><span style="font-size:13px">The fixes are now in as of </span><a href="https://reviews.llvm.org/rL309809" style="font-size:13px">https://reviews.llvm.org/rL309809</a><span style="font-size:13px">.</span><div style="font-size:13px"><br></div><div style="font-size:13px">Cheers,</div><div style="font-size:13px">/Manuel</div><br><div class="gmail_quote"><div dir="ltr">On Fri, Jul 28, 2017 at 11:27 AM Manuel Klimek <<a href="mailto:klimek@google.com">klimek@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">This is actually a problem with hasDeclaration; I realized that I hadn't submitted <a href="https://reviews.llvm.org/D27104" target="_blank">https://reviews.llvm.org/D27104</a> yet; I now adapted it to also solve your problem (as this was simpler than fixing the current code).</div><div dir="ltr"><div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jul 26, 2017 at 12:02 PM Jonas Toth via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello everybody,<br>
<br>
iam working on a clang-tidy-check to handle gsl::owner, at least i try to.<br>
What iam doing right now, is trying to get the Matchers done and here is<br>
what I have as testcode for experimentation.<br>
<br>
namespace gsl {<br>
template<typename T> using owner = T;<br>
}<br>
<br>
template<typename T> class vector {};<br>
template<typename T> using heap_array = vector<T>;<br>
<br>
using file = int;<br>
<br>
void f() {<br>
gsl::owner<int*> owner = new int(10);<br>
<br>
int i = 0;<br>
int* no_owner = &i;<br>
int** no_owner_at_all = &no_owner;<br>
<br>
file n = 15;<br>
<br>
heap_array<int> array;<br>
}<br>
<br>
// match varDecl(hasType(hasDeclaration(typeAliasDecl()))) # works for file<br>
// match varDecl(hasType(hasDeclaration(typeAliasTemplateDecl()))) #<br>
works for file<br>
// match varDecl(hasType(hasDeclaration(typedefNameDecl()))) # works<br>
for file<br>
// match<br>
varDecl(hasType(hasDeclaration(typedefNameDecl(hasName("file"))))) #<br>
works as well, matching the declaration<br>
//<br>
// match typeAliasTemplateDecl() # gets all declaration<br>
// match typeAliasTemplateDecl(hasName("::gsl::owner")) # gets the<br>
declaration right<br>
// match typeAliasTemplateDecl(hasName("heap_array")) # gets the<br>
declaration right<br>
//<br>
// match varDecl(hasType(hasDeclaration(typeAliasTemplateDecl()))) # nothing<br>
// match<br>
varDecl(hasType(hasDeclaration(typeAliasTemplateDecl(hasName("::gsl::owner")))))<br>
# nothing<br>
// match<br>
varDecl(hasType(hasDeclaration(typeAliasTemplateDecl(hasName("owner")))))<br>
# nothing<br>
// match<br>
varDecl(hasType(hasDeclaration(typeAliasTemplateDecl(hasName("::gsl::owner<int<br>
*>"))))) # nothing<br>
// match<br>
varDecl(hasType(hasDeclaration(typeAliasTemplateDecl(hasName("heap_array")))))<br>
# nothing<br>
// match<br>
varDecl(hasType(hasDeclaration(typeAliasTemplateDecl(hasName("heap_array<int>")))))<br>
# nothing<br>
<br>
Matching Variables, Parameters and so on for Using-Aliases seems to work<br>
fine, but not for Templated Aliases.<br>
I tested these, with the current clang-query from Trunk.<br>
<br>
Is the way, iam approaching the matcher incorrect or is it some kind of<br>
bug in typeAliasTemplateDecl?<br>
<br>
Thank you very much for your help :)<br>
<br>
_______________________________________________<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/mailman/listinfo/cfe-dev</a><br>
</blockquote></div></div></div></blockquote></div></div>