<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Feb 23, 2014 at 4:46 PM, Christian Schafmeister <span dir="ltr"><<a href="mailto:chris.schaf@verizon.net" target="_blank">chris.schaf@verizon.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div>If I read the documentation at <a href="http://clang.llvm.org/docs/LibASTMatchersReference.html" target="_blank">http://clang.llvm.org/docs/LibASTMatchersReference.html</a> correctly, the partial matcher "hasType(qualType(…))" is not legal.</div>
</blockquote><div><br></div><div>hasType has an overload for Decl and QualType:</div><div><a href="http://clang.llvm.org/doxygen/namespaceclang_1_1ast__matchers.html#a605703cba74d951cd64ee10b82bb4139">http://clang.llvm.org/doxygen/namespaceclang_1_1ast__matchers.html#a605703cba74d951cd64ee10b82bb4139</a></div>
<div><br></div><div>We have to fix the docs :)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><br></div><div>I ask because I’ve seen it used several times, it’s an example in the documentation for “isCanonicalType” (see below), and I’m wrapping the ASTMatcher library in my Common Lisp environment to write refactoring tools in Common Lisp and I’ve used the documentation at <a href="http://clang.llvm.org/docs/LibASTMatchersReference.html" target="_blank">http://clang.llvm.org/docs/LibASTMatchersReference.html</a> to define what matchers are legal and which are not.</div>
<div><br></div><div>I think I need to use hasType(qualType(…)) for a matcher that I’m writing and I need to figure out how to work it into my rules.</div><div><br></div><div><br></div><div>isCanonicalType documentation follows</div>
<div><pre style="color:rgb(34,34,34)">Matches QualTypes whose canonical type matches InnerMatcher.
Given:
typedef int &int_ref;
int a;
int_ref b = a;
varDecl(<u>hasType(qualType(</u>referenceType()))))) will not match the
declaration of b but varDecl(hasType(qualType(hasCanonicalType(referenceType())))))) does.</pre><div><br></div><div>The predicate hasType(…) requires a Matcher<Decl> as the inner matcher and qualType(…) is of type Matcher<QualType>, not Matcher<Decl>.<br>
<div><div></div></div></div><div><br></div><div>Any insight that anyone can provide would be very helpful.</div><div><br></div><div>Best,</div><div><br></div><div><br></div></div><div>
<div><div>Christian Schafmeister</div><div>Associate Professor</div><div>Chemistry Department</div><div>Temple University</div></div>
</div>
<br></div></blockquote></div><br></div></div>