<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi!
<div class=""><br class="">
</div>
<div class="">On the following code</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">template<typename T></div>
<div class="">class C{};</div>
<div class="">template<typename T></div>
<div class="">C<T> c;</div>
<div class="">void func(){</div>
<div class=""> c<float>;</div>
<div class="">}</div>
</div>
<div class=""><br class="">
</div>
<div class="">with the matcher </div>
<div class=""><br class="">
</div>
<div class=""><b class="">varDecl(hasType(classTemplateSpecializationDecl()))</b></div>
<div class=""><br class="">
</div>
<div class="">I get two matches which are exactly the same:</div>
<div class="">
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Ubuntu Mono"; color: rgb(255, 255, 255); background-color: rgb(53, 55, 61);" class="">
<span style="font-variant-ligatures: no-common-ligatures;" class=""><font size="2" class="">Match #1:</font></span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Ubuntu Mono"; color: rgb(255, 255, 255); background-color: rgb(53, 55, 61); min-height: 18px;" class="">
<font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class="">
</font></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Ubuntu Mono"; color: rgb(255, 255, 255); background-color: rgb(53, 55, 61);" class="">
<span style="font-variant-ligatures: no-common-ligatures;" class=""><font size="2" class="">Binding for "root":</font></span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Ubuntu Mono"; color: rgb(255, 210, 148); background-color: rgb(53, 55, 61);" class="">
<font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(191, 217, 169);" class="">VarTemplateSpecializationDecl</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> 0x7fe879820a28</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 255, 255);" class="">
<</span><span style="font-variant-ligatures: no-common-ligatures;" class="">test:16:1</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 255, 255);" class="">,
</span><span style="font-variant-ligatures: no-common-ligatures;" class="">col:6</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 255, 255);" class="">>
</span><span style="font-variant-ligatures: no-common-ligatures;" class="">col:6</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 255, 255);" class=""> used</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(165, 219, 235);" class="">
c</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 255, 255);" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(191, 217, 169);" class="">'C<float>':'C<float>'</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 255, 255);" class="">
callinit</span></font></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Ubuntu Mono"; color: rgb(255, 255, 255); background-color: rgb(53, 55, 61);" class="">
<font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(165, 196, 228);" class="">|-</span><span style="font-variant-ligatures: no-common-ligatures;" class="">TemplateArgument type
</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(191, 217, 169);" class="">'float'</span></font></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Ubuntu Mono"; color: rgb(191, 217, 169); background-color: rgb(53, 55, 61);" class="">
<font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(165, 196, 228);" class="">| `-</span><span style="font-variant-ligatures: no-common-ligatures;" class="">BuiltinType</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 210, 148);" class="">
0x7fe87901ee00</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 255, 255);" class="">
</span><span style="font-variant-ligatures: no-common-ligatures;" class="">'float'</span></font></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Ubuntu Mono"; color: rgb(191, 217, 169); background-color: rgb(53, 55, 61);" class="">
<font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(165, 196, 228);" class="">`-</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(218, 180, 210);" class="">CXXConstructExpr</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 210, 148);" class="">
0x7fe879852190</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 255, 255);" class=""> <</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 210, 148);" class="">col:6</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 255, 255);" class="">>
</span><span style="font-variant-ligatures: no-common-ligatures;" class="">'C<float>':'C<float>'</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 255, 255);" class="">
</span><span style="font-variant-ligatures: no-common-ligatures;" class="">'void () noexcept'</span></font></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Ubuntu Mono"; color: rgb(255, 255, 255); background-color: rgb(53, 55, 61); min-height: 18px;" class="">
<font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class="">
</font></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Ubuntu Mono"; color: rgb(255, 255, 255); background-color: rgb(53, 55, 61); min-height: 18px;" class="">
<font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class="">
</font></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Ubuntu Mono"; color: rgb(255, 255, 255); background-color: rgb(53, 55, 61);" class="">
<span style="font-variant-ligatures: no-common-ligatures;" class=""><font size="2" class="">Match #2:</font></span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Ubuntu Mono"; color: rgb(255, 255, 255); background-color: rgb(53, 55, 61); min-height: 18px;" class="">
<font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class="">
</font></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Ubuntu Mono"; color: rgb(255, 255, 255); background-color: rgb(53, 55, 61);" class="">
<span style="font-variant-ligatures: no-common-ligatures;" class=""><font size="2" class="">Binding for "root":</font></span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Ubuntu Mono"; color: rgb(255, 210, 148); background-color: rgb(53, 55, 61);" class="">
<font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(191, 217, 169);" class="">VarTemplateSpecializationDecl</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> 0x7fe879820a28</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 255, 255);" class="">
<</span><span style="font-variant-ligatures: no-common-ligatures;" class="">test:16:1</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 255, 255);" class="">,
</span><span style="font-variant-ligatures: no-common-ligatures;" class="">col:6</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 255, 255);" class="">>
</span><span style="font-variant-ligatures: no-common-ligatures;" class="">col:6</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 255, 255);" class=""> used</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(165, 219, 235);" class="">
c</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 255, 255);" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(191, 217, 169);" class="">'C<float>':'C<float>'</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 255, 255);" class="">
callinit</span></font></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Ubuntu Mono"; color: rgb(255, 255, 255); background-color: rgb(53, 55, 61);" class="">
<font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(165, 196, 228);" class="">|-</span><span style="font-variant-ligatures: no-common-ligatures;" class="">TemplateArgument type
</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(191, 217, 169);" class="">'float'</span></font></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Ubuntu Mono"; color: rgb(191, 217, 169); background-color: rgb(53, 55, 61);" class="">
<font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(165, 196, 228);" class="">| `-</span><span style="font-variant-ligatures: no-common-ligatures;" class="">BuiltinType</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 210, 148);" class="">
0x7fe87901ee00</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 255, 255);" class="">
</span><span style="font-variant-ligatures: no-common-ligatures;" class="">'float'</span></font></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Ubuntu Mono"; color: rgb(191, 217, 169); background-color: rgb(53, 55, 61);" class="">
<font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(165, 196, 228);" class="">`-</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(218, 180, 210);" class="">CXXConstructExpr</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 210, 148);" class="">
0x7fe879852190</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 255, 255);" class=""> <</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 210, 148);" class="">col:6</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 255, 255);" class="">>
</span><span style="font-variant-ligatures: no-common-ligatures;" class="">'C<float>':'C<float>'</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 255, 255);" class="">
</span><span style="font-variant-ligatures: no-common-ligatures;" class="">'void () noexcept'</span></font></div>
</div>
<div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class="">
</span></div>
<div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Is this a bug? I'd expect there to be only one match.</span></div>
<div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">The goal is to find variables whose type refers to a class instantiation, is this a good approach?</span></div>
<div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Behavior occurs in clang-query and the C++ API on Apple, on both clang 11.0.0 and 10.0.1; didn't yet have the possibility to test 11.0.1.</span></div>
<div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class="">
</span></div>
<div class="">Thanks & best,</div>
<div class="">Sigi</div>
</div>
</body>
</html>