<div dir="ltr">I've not looked into the libstdc++ code for this, but my guess would be that implicit instantiation of that function's definition is being suppressed by an explicit instantiation declaration -- so the definition of the template might be in the AST, but we're not allowed to instantiate it even though it was used.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 12 Nov 2020 at 16:52, Artem Dergachev via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
If it's not in the AST, it's not in the translation unit. Try
searching the AST dump, maybe you're looking in the wrong place.<br>
<br>
Static analyzer is intended to work more or less correctly
regardless of whether the method is present. Like, it doesn't even
have to be libc++ to begin with. But i'd be pretty surprised if the
body is there but the static analyzer can't find it. Most likely
something else is going on.<br>
<br>
You should be looking for the fully instantiated body, not the
original template, because that's what the static analyzer works
with. Clang duplicates the AST for each template instantiation so it
should be there if it's at all available.<br>
<br>
<div>On 11/10/20 12:28 AM, Ding Fei via
cfe-dev wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hi all!
<div><br>
</div>
<div>I would like to know if it's possible to get the method
body of std::__cxx11::basic_string::_M_construct(size_type,
_CharT) ?</div>
<div><br>
</div>
<div>The question arises when StaticAnalyzer's
ExprEnging::defaultEvalCall()</div>
<div>
<div>tries to inline this method but the CXXMethodDecl node
for '_M_construct'</div>
<div>(and a few other similar members) from the AST has no
body attached to it.</div>
<div><br>
</div>
<div>The body (templated?) should be in the AST but is hidden
somewhere else,</div>
<div>otherwise the TU would be incomplete.</div>
<div><br>
</div>
<div>Any hint would be appreciated, thanks!</div>
<div><br>
</div>
-- <br>
<div dir="ltr">Best Regards<br>
<br>
Ding Fei<br>
E-mail: <a href="mailto:danix800@gmail.com" target="_blank">danix800@gmail.com</a></div>
</div>
</div>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
cfe-dev mailing list
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a>
</pre>
</blockquote>
<br>
</div>
_______________________________________________<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="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>