<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Yep. Confirmed removing that flag gets a diagnostic in the test case. Thanks for the input.</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On 1 Nov 2015, at 17:26, Val Markovic <<a href="mailto:val@markovic.io" class="">val@markovic.io</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Yeah, that's almost certainly it then. The thing is, that flag gives something like a 10x perf boost when compiling large TUs. I think we almost certainly want to have it on by default, though we <i class="">may</i> want to expose a user-level setting to turn it off. That's a big "may" since we've been using the flag for something like a year if not more and nobody has complained about this until now.</div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Sun, Nov 1, 2015 at 9:22 AM, Ben Jackson <span dir="ltr" class=""><<a href="mailto:puremourning@gmail.com" target="_blank" class="">puremourning@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">Val, </div><div class=""><br class=""></div><div class="">I think you might be right. I will try it out to confirm, but the docs look to point to exactly that:</div><div class=""><br class=""></div><div class=""><table border="0" cellspacing="2" cellpadding="0" style="font-family: 'Lucida Grande', Verdana, Geneva, Arial, sans-serif; font-size: 13px; line-height: 1.3;" class=""><tbody class=""><tr class=""><td valign="top" class=""><em class="">CXTranslationUnit_Incomplete</em> </td><td class=""><p style="line-height:1.3" class="">Used to indicate that the translation unit is incomplete. </p><p style="line-height:1.3" class="">When a translation unit is considered "incomplete", semantic analysis that is typically performed at the end of the translation unit will be suppressed. For example, <font color="#ff2600" class="">this suppresses the completion of tentative declarations in C and of instantiation of implicitly-instantiation function templates in C++. </font>This option is typically used when parsing a header with the intent of producing a precompiled header.</p></td></tr></tbody></table><div class=""><br class=""></div></div><div class="">Thanks,</div><div class="">Ben</div><div class=""><div class="h5"><div class=""><br class=""></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 1 Nov 2015, at 17:12, Val Markovic <<a href="mailto:val@markovic.io" target="_blank" class="">val@markovic.io</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">Could this be related to the Incomplete flag we started passing to libclang a while ago?</div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Sun, Nov 1, 2015 at 9:11 AM, Manuel Klimek <span dir="ltr" class=""><<a href="mailto:klimek@google.com" target="_blank" class="">klimek@google.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">+Benjamin <div class=""><br class=""><div class="gmail_quote"><div class=""><div class=""><div dir="ltr" class="">On Tue, Oct 27, 2015 at 5:15 PM Val Markovic <<a href="mailto:val@markovic.io" target="_blank" class="">val@markovic.io</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">+klimek</div><div dir="ltr" class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Mon, Oct 26, 2015 at 3:09 PM, Ben Jackson <span dir="ltr" class=""><<a href="mailto:puremourning@gmail.com" target="_blank" class="">puremourning@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi there,<br class="">
<br class="">
An issue was raised against ycmd that we were not reporting errors as a result of failed template instantiations. This is because, seemingly, libclang does not report diagnostics for template instantiations where instantiation fails (in the sense that the generated code is not valid).<br class="">
<br class="">
A fairly canonical test case is as follows:<br class="">
<br class="">
    template<typename T><br class="">
    void get_size(const T& t)<br class="">
    {<br class="">
        return t.size();<br class="">
    }<br class="">
<br class="">
    struct Test<br class="">
    {<br class="">
        void not_size() const;<br class="">
    };<br class="">
<br class="">
    int run_test()<br class="">
    {<br class="">
        Test t;<br class="">
<br class="">
        get_size(t);<br class="">
<br class="">
        return "not_an_int";<br class="">
    }<br class="">
<br class="">
Expected: a diagnostic reported at the line ‘get_size(t)’ as struct Test does not have a size()const method. However, no diagnostic is reported.<br class="">
<br class="">
The ‘return “not_an_int”’ is just to prove that diagnostics reporting is working in general in the test case.<br class="">
<br class="">
When running the above with ‘c-index-test -index-file’, grepping for ‘[diagnostic]’, the result is :<br class="">
<br class="">
    $ ./bin/c-index-test -index-file ../llvm/tools/clang/test/Index/diagnostics-template-instantiation.cpp  | grep '\[diagnostic\]'<br class="">
    ../llvm/tools/clang/test/Index/diagnostics-template-instantiation.cpp:18:12: error: cannot initialize return object of type 'int' with an lvalue of type 'const char [11]'<br class="">
[diagnostic]: ../llvm/tools/clang/test/Index/diagnostics-template-instantiation.cpp:18:12: error: cannot initialize return object of type ‘int' with an lvalue of type 'const char [11]'<br class="">
<br class="">
However, when running clang directly, we get the diagnostic for get_size(t):<br class="">
<br class="">
     clang++ ../llvm/tools/clang/test/Index/diagnostics-template-instantiation.cpp<br class="">
    ../llvm/tools/clang/test/Index/diagnostics-template-instantiation.cpp:18:12: error: cannot initialize return object of type 'int' with an lvalue of type 'const char [11]'<br class="">
        return "not_an_int";<br class="">
           ^~~~~~~~~~~~<br class="">
    ../llvm/tools/clang/test/Index/diagnostics-template-instantiation.cpp:4:14: error: no member named 'size' in 'Test'<br class="">
        return t.size();<br class="">
           ~ ^<br class="">
    ../llvm/tools/clang/test/Index/diagnostics-template-instantiation.cpp:16:5: note: in instantiation of function template specialization 'get_size<Test>' requested here<br class="">
        get_size(t);<br class="">
    ^<br class="">
    2 errors generated.<br class="">
<br class="">
Is this a bug or simply a limitation of the libclang interface? Or is there something required to get these diagnostics to report. Apologies, I must confess I have not looked into this in detail within clang.<br class=""></blockquote></div></div></div></blockquote><div class=""><br class=""></div></div></div><div class="">I'd expect there to be a way to drive libclang to get those diagnostics. On the other hand, it would probably mean a significant slow-down, because template instantiation can be a significant amount of the parse time.</div><span class=""><div class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br class="">
Many thanks and kind regards,<br class="">
Ben<br class="">
<span class=""><font color="#888888" class=""><br class="">
--<br class="">
You received this message because you are subscribed to the Google Groups "ycm-dev" group.<br class="">
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:ycm-dev%2Bunsubscribe@googlegroups.com" target="_blank" class="">ycm-dev+unsubscribe@googlegroups.com</a>.<br class="">
To post to this group, send email to <a href="mailto:ycm-dev@googlegroups.com" target="_blank" class="">ycm-dev@googlegroups.com</a>.<br class="">
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/ycm-dev/41DF481E-282F-4C3D-A4F8-19CC9C706AE0%40gmail.com" rel="noreferrer" target="_blank" class="">https://groups.google.com/d/msgid/ycm-dev/41DF481E-282F-4C3D-A4F8-19CC9C706AE0%40gmail.com</a>.<br class="">
For more options, visit <a href="https://groups.google.com/d/optout" rel="noreferrer" target="_blank" class="">https://groups.google.com/d/optout</a>.<br class="">
</font></span></blockquote></div><br class=""></div></div></blockquote></span></div></div></div>
</blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></body></html>