<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body>
<p><br>
</p>
<p>clang-query parsing is less strict than the c++ language, so
there are probably a few of these differences.</p>
<p>I assume you realize that you should instead use either <br>
</p>
<p>unless(has()) <br>
</p>
<p>or <br>
</p>
<p>has(decl(unless(cxxRecordDecl())))<br>
</p>
<p>depending on what you are trying to achieve?</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 16/11/2020 17:33, Hartogs Siegfried
via cfe-dev wrote:<br>
</div>
<blockquote type="cite"
cite="mid:310C304E-9E8A-4A2D-BDB2-771ACFC83306@student.ethz.ch">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
A minimal code sample to trigger the error:<br class="">
<div class=""><br class="">
<div class="">
<div class="">#include "clang/ASTMatchers/ASTMatchers.h"</div>
<div class=""><br class="">
</div>
<div class="">using namespace clang::ast_matchers;</div>
<div class=""><br class="">
</div>
<div class="">int main(int argc, char** argv){</div>
<div class=""> auto m =
cxxRecordDecl(has(unless(cxxRecordDecl())));</div>
<div class=""> return 0;</div>
<div class=""><br class="">
</div>
<div class="">}</div>
<div class=""><br class="">
</div>
<div class="">Best, Siegfried</div>
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 16Nov, 2020, at 16:57, Hartogs Siegfried
<<a href="mailto:hartogss@student.ethz.ch" class=""
moz-do-not-send="true">hartogss@student.ethz.ch</a>>
wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode:
space; line-break: after-white-space;" class="">
Hello everyone,
<div class=""><br class="">
</div>
<div class="">Why is it that the following matcher </div>
<div class=""><br class="">
</div>
<div class="">
<div style="margin: 0px; font-stretch: normal;
line-height: normal;" class=""><font class=""
face="Ubuntu Mono">cxxRecordDecl(has(unless(cxxRecordDecl())))</font></div>
</div>
<div style="margin: 0px; font-stretch: normal;
line-height: normal;" class=""><font class=""
face="Ubuntu Mono"><br class="">
</font></div>
<div style="margin: 0px; font-stretch: normal;
line-height: normal;" class="">works in clang-query,
but when copied to to a .cpp file, it won't compile
the matcher:</div>
<div style="margin: 0px; font-stretch: normal;
line-height: normal;" class=""><br class="">
</div>
<div style="margin: 0px; font-stretch: normal;
line-height: normal;" class="">
<div style="margin: 0px; font-stretch: normal;
line-height: normal; font-family: "Ubuntu
Mono";" class="">
<span style="font-variant-ligatures:
no-common-ligatures;" class="">../lib/UsingAnalysis.cpp:46:29:
</span><span style="font-variant-ligatures:
no-common-ligatures;" class="">error:
</span><span style="font-variant-ligatures:
no-common-ligatures;" class="">no matching
function for call to object of type 'const
internal::ArgumentAdaptingMatcherFunc<internal::HasMatcher>'</span></div>
<div style="margin: 0px; font-stretch: normal;
line-height: normal; font-family: "Ubuntu
Mono";" class="">
<span style="font-variant-ligatures:
no-common-ligatures" class=""> auto m =
cxxRecordDecl(has(unless(cxxRecordDecl())));</span></div>
<div style="margin: 0px; font-stretch: normal;
line-height: normal; font-family: "Ubuntu
Mono";" class="">
<span style="font-variant-ligatures:
no-common-ligatures" class="">
^~~</span></div>
<div style="margin: 0px; font-stretch: normal;
line-height: normal; font-family: "Ubuntu
Mono";" class="">
<span style="font-variant-ligatures:
no-common-ligatures;" class="">/usr/local/include/clang/ASTMatchers/ASTMatchersInternal.h:1183:3:
</span><span style="font-variant-ligatures:
no-common-ligatures;" class="">note: </span>
<span style="font-variant-ligatures:
no-common-ligatures" class="">candidate template
ignored: could not match 'Matcher' against
'VariadicOperatorMatcher'</span></div>
<div style="margin: 0px; font-stretch: normal;
line-height: normal; font-family: "Ubuntu
Mono";" class="">
<span style="font-variant-ligatures:
no-common-ligatures;" class="">
operator()(const Matcher<T>
&InnerMatcher) const {</span></div>
<div style="margin: 0px; font-stretch: normal;
line-height: normal; font-family: "Ubuntu
Mono";" class="">
<span style="font-variant-ligatures:
no-common-ligatures;" class=""><br class="">
</span></div>
<div style="margin: 0px; font-stretch: normal;
line-height: normal;" class="">Tried on macOS
10.13 & Ubuntu 20.04 with LLVM 11.0.0.</div>
<div style="margin: 0px; font-stretch: normal;
line-height: normal;" class=""><br class="">
</div>
<div style="margin: 0px; font-stretch: normal;
line-height: normal;" class="">Best,</div>
<div style="margin: 0px; font-stretch: normal;
line-height: normal;" class="">Siegfried</div>
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
cfe-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a>
</pre>
</blockquote>
</body>
</html>