<div dir="auto">Great, thanks! <div dir="auto">I will continue the check for owner then.</div><div dir="auto"><br></div><div dir="auto">Regards, Jonas :)</div></div><div class="gmail_extra"><br><div class="gmail_quote">Am 28.07.2017 11:28 vorm. schrieb "Manuel Klimek" <<a href="mailto:klimek@google.com">klimek@google.com</a>>:<br type="attribution"><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.<wbr>llvm.org/D27104</a> yet; I now adapted it to also solve your problem (as this was simpler than fixing the current code).<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(<wbr>hasDeclaration(typeAliasDecl()<wbr>))) # works for file<br>
// match varDecl(hasType(<wbr>hasDeclaration(<wbr>typeAliasTemplateDecl()))) #<br>
works for file<br>
// match varDecl(hasType(<wbr>hasDeclaration(<wbr>typedefNameDecl()))) # works<br>
for file<br>
// match<br>
varDecl(hasType(<wbr>hasDeclaration(<wbr>typedefNameDecl(hasName("file"<wbr>))))) #<br>
works as well, matching the declaration<br>
//<br>
// match typeAliasTemplateDecl() # gets all declaration<br>
// match typeAliasTemplateDecl(hasName(<wbr>"::gsl::owner")) # gets the<br>
declaration right<br>
// match typeAliasTemplateDecl(hasName(<wbr>"heap_array")) # gets the<br>
declaration right<br>
//<br>
// match varDecl(hasType(<wbr>hasDeclaration(<wbr>typeAliasTemplateDecl()))) # nothing<br>
// match<br>
varDecl(hasType(<wbr>hasDeclaration(<wbr>typeAliasTemplateDecl(hasName(<wbr>"::gsl::owner")))))<br>
# nothing<br>
// match<br>
varDecl(hasType(<wbr>hasDeclaration(<wbr>typeAliasTemplateDecl(hasName(<wbr>"owner")))))<br>
# nothing<br>
// match<br>
varDecl(hasType(<wbr>hasDeclaration(<wbr>typeAliasTemplateDecl(hasName(<wbr>"::gsl::owner<int<br>
*>"))))) # nothing<br>
// match<br>
varDecl(hasType(<wbr>hasDeclaration(<wbr>typeAliasTemplateDecl(hasName(<wbr>"heap_array")))))<br>
# nothing<br>
// match<br>
varDecl(hasType(<wbr>hasDeclaration(<wbr>typeAliasTemplateDecl(hasName(<wbr>"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>
______________________________<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></div></div></div>
</blockquote></div></div>