Qt wiki will be updated on October 12th 2023 starting at 11:30 AM (EEST) and the maintenance will last around 2-3 hours. During the maintenance the site will be unavailable.

Clang-bugs-at-wip-clang-branch: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
==See also==
[[Category:Tools::Qt Creator:Branches]]


* ClangCodeModel plugin has class CXPrettyPrinter that prints clang-c types in <span class="caps">JSON</span>-like format. Use it to debug and feel free to improve this class.
== See also ==
* [[clang-hacking-notes-for-wip-clang-branch|Clang hacking notes]]


==Clang bugs with known workarounds==
* ClangCodeModel plugin has class CXPrettyPrinter that prints clang-c types in JSON-like format. Use it to debug and feel free to improve this class.
* [[clang hacking notes for wip clang branch|Clang hacking notes]]


* Sometimes diagnostic message have one empty SourceRange, which breaks SourceLocation-based euristic. Example:<br /> CXPrettyPrinter reports:<br />
== Clang bugs with known workarounds ==


==Clang bugs==
* Sometimes diagnostic message have one empty SourceRange, which breaks SourceLocation-based euristic. Example:<br /><code><br />#include &lt;vector&amp;gt;


Links to reported bugs will be attached in future
int main()<br />{<br /> std::vector&amp;lt;&gt; a;<br /> return 0;<br />}<br /></code><br />CXPrettyPrinter reports:<br /><code><br />CXDiagnostic: {<br /> 'error: too few template arguments for class template 'vector''<br /> severity: Error<br /> location: {<br /> file: '/home/sergey/Документы/wip-clang/test_projects/objc_test/main.cpp',<br /> line: 5,<br /> column: 10<br /> }<br /> category: 'Semantic Issue';<br /> ranges: [<br /> {<br /> file: '',<br /> from: {0, 0},to: {0, 0}<br /> }<br /> ]<br /> children: [<br /> {<br /> 'note: template is declared here'<br /> severity: Note<br /> location: {<br /> file: '/usr/include/c+''/4.6/bits/stl_vector.h',<br /> line: 180,<br /> column: 11<br /> }<br /> category: 'Semantic Issue';<br /> ranges: [<br /> {<br /> file: '/usr/include/c/4.6/bits/stl_vector.h',<br /> from: {179, 3},to: {179, 65}<br /> }<br /> ]<br /> }<br /> ]<br />}<br /></code>
<br />h2. Clang bugs
<br />Links to reported bugs will be attached in future
<br />* inside lambda, clang doesn't include mutable (non-const) methods of current class even if 'this' was captured by lambda<br />Bug: http://llvm.org/bugs/show_bug.cgi?id=15085<br />See example, completion requested in point marked with '#' sign
<br /><code><br />void UnitConsumer::visitChildren()<br />{<br /> visitChildren(cursor, [this](const CXCursor &amp;cursor, const CXCursor &amp; /*parent*/) {<br /> if (cursor.kind == CXCursor_FieldDecl) {<br /> #<br /> }<br /> });<br />}<br /></code>
<br />* Clang does not add virtual functions to proposals list<br /><code><br />class Base<br />{<br />public:<br /> virtual void overrideMe(int a);<br />};
<br />class Derived : public Base<br />{<br />public:<br /> void #<br />};<br /></code>
<br />* no way to differ method definition and call with qualifier: completion strings and contexts are the same in both cases: http://llvm.org/bugs/show_bug.cgi?id=15745<br /><code><br />class Foo<br />{<br />public:<br /> void declarable(int a, float b);<br />};
<br />void Foo::declarable(int a, float b)<br />{<br /> if (a != 1)<br /> Foo::declarable(1, 2.0);<br />}<br /></code>
<br />Poor diagnostic for such code if C11 disabled<br /><code><br />enum class EnumScoped<br />{<br />};<br /></code>
<br />* clang does not add classes to completion proposals when completing 'foreach'
<br />* when declaring variable, variable itself proposed with highest priority. It's error.
<br />* Macro completions not added after class keyword<br /><code><br />class CLANG_EXPORT CodeCompletionResult<br />{<br />};<br /></code>
<br />* Wrong completions inside function-try-block in constructor: http://llvm.org/bugs/show_bug.cgi?id=15660<br /><code><br />class Class<br />{<br /> int a;<br /> int '''c;<br />public:<br /> Class(int b) try : a(b), c(new int)<br /> {<br /> }<br /> catch (…)<br /> {<br /> // no &quot;delete&amp;quot; proposed<br /> }<br />};<br /></code>
<br />''' Completion with nested names lookup not performed for comparison with enum value<br /><code><br /> if (lexer.tokenKind() == Token::LeftBrace) {<br /> }<br /></code>
<br />* Value types completions added where thay shouldn't be<br /><code><br />QStringList createClangOptions(CPlusPlus::ProjectFile::Kind language,<br /> CPlusPlus::ProjectPart::CXXExtensions extensions,<br /> CPlusPlus::ProjectPart::,<br /> CPlusPlus::ProjectPart::QtVersion qtVersion,<br /> const QList&amp;lt;QByteArray&amp;gt; &amp;defines,<br /> const QStringList &amp;includePaths,<br /> const QStringList &amp;frameworkPaths);<br /></code>
<br />* C''+11 'override' pseudo-keyword breaks clang_annotateTokens()<br /><code><br />bool init() override;<br /></code>


* inside lambda, clang doesn’t include mutable (non-const) methods of current class even if ‘this’ was captured by lambda<br /> Bug: http://llvm.org/bugs/show_bug.cgi?id=15085<br /> See example, completion requested in point marked with ‘#’ sign
* Poor completion context recognition in template params<br /><code><br />std::vector&amp;lt;#&gt; myVector;<br /></code>


* Clang does not add virtual functions to proposals list<br />
* Clang doesn't add Informative completion chunk to macro. It better to add macro definition text to informative.<br /><code><br />#define MACRO std::min(left, right)


* no way to differ method definition and call with qualifier: completion strings and contexts are the same in both cases: http://llvm.org/bugs/show_bug.cgi?id=15745<br />
// Completion proposal &quot;MACRO&amp;quot; doesn't have chunk of kind Informative with text &quot;std::min(left, right)&quot;<br /></code>


Poor diagnostic for such code if C++11 disabled<br />
* Completion stops after asterisk:<br /><code><br />ButtonsFactory '''ButtonsFactory::ms_instance = 0;<br />ButtonsFactory'''// completion requested here<br /></code>


* clang does not add classes to completion proposals when completing ‘foreach’
* Macro trick used in GLEW library not handled by completion: http://llvm.org/bugs/show_bug.cgi?id=15631
 
* when declaring variable, variable itself proposed with highest priority. It’s error.
 
* Macro completions not added after class keyword<br />
 
* Wrong completions inside function-try-block in constructor: http://llvm.org/bugs/show_bug.cgi?id=15660<br />
 
* Completion with nested names lookup not performed for comparison with enum value<br />
 
* Value types completions added where thay shouldn’t be<br />
 
* C++11 ‘override’ pseudo-keyword breaks clang_annotateTokens()<br />
 
* Poor completion context recognition in template params<br />
 
* Clang doesn’t add Informative completion chunk to macro. It better to add macro definition text to informative.<br />
 
* Completion stops after asterisk:<br />
 
* Macro trick used in <span class="caps">GLEW</span> library not handled by completion: http://llvm.org/bugs/show_bug.cgi?id=15631


* Completion results for function with optional arguments does not have default argument value: http://llvm.org/bugs/show_bug.cgi?id=14477
* Completion results for function with optional arguments does not have default argument value: http://llvm.org/bugs/show_bug.cgi?id=14477
===Categories:===
* [[:Category:Tools|Tools]]
** [[:Category:Tools::Qt-Creator:Branches|Qt Creator:Branches]]

Revision as of 10:43, 24 February 2015


See also

  • ClangCodeModel plugin has class CXPrettyPrinter that prints clang-c types in JSON-like format. Use it to debug and feel free to improve this class.
  • Clang hacking notes

Clang bugs with known workarounds

  • Sometimes diagnostic message have one empty SourceRange, which breaks SourceLocation-based euristic. Example:
    <br />#include &lt;vector&amp;gt;
    
    int main()<br />{<br /> std::vector&amp;lt;&gt; a;<br /> return 0;<br />}<br />
    

    CXPrettyPrinter reports:
    <br />CXDiagnostic: {<br /> 'error: too few template arguments for class template 'vector''<br /> severity: Error<br /> location: {<br /> file: '/home/sergey/Документы/wip-clang/test_projects/objc_test/main.cpp',<br /> line: 5,<br /> column: 10<br /> }<br /> category: 'Semantic Issue';<br /> ranges: [<br /> {<br /> file: '',<br /> from: {0, 0},to: {0, 0}<br /> }<br /> ]<br /> children: [<br /> {<br /> 'note: template is declared here'<br /> severity: Note<br /> location: {<br /> file: '/usr/include/c+''/4.6/bits/stl_vector.h',<br /> line: 180,<br /> column: 11<br /> }<br /> category: 'Semantic Issue';<br /> ranges: [<br /> {<br /> file: '/usr/include/c/4.6/bits/stl_vector.h',<br /> from: {179, 3},to: {179, 65}<br /> }<br /> ]<br /> }<br /> ]<br />}<br />
    


h2. Clang bugs
Links to reported bugs will be attached in future
* inside lambda, clang doesn't include mutable (non-const) methods of current class even if 'this' was captured by lambda
Bug: http://llvm.org/bugs/show_bug.cgi?id=15085
See example, completion requested in point marked with '#' sign


<br />void UnitConsumer::visitChildren()<br />{<br /> visitChildren(cursor, [this](const CXCursor &amp;cursor, const CXCursor &amp; /*parent*/) {<br /> if (cursor.kind == CXCursor_FieldDecl) {<br /> #<br /> }<br /> });<br />}<br />


* Clang does not add virtual functions to proposals list

<br />class Base<br />{<br />public:<br /> virtual void overrideMe(int a);<br />};
<br />class Derived : public Base<br />{<br />public:<br /> void #<br />};<br />


* no way to differ method definition and call with qualifier: completion strings and contexts are the same in both cases: http://llvm.org/bugs/show_bug.cgi?id=15745

<br />class Foo<br />{<br />public:<br /> void declarable(int a, float b);<br />};
<br />void Foo::declarable(int a, float b)<br />{<br /> if (a != 1)<br /> Foo::declarable(1, 2.0);<br />}<br />


Poor diagnostic for such code if C11 disabled

<br />enum class EnumScoped<br />{<br />};<br />


* clang does not add classes to completion proposals when completing 'foreach'
* when declaring variable, variable itself proposed with highest priority. It's error.


* Macro completions not added after class keyword

<br />class CLANG_EXPORT CodeCompletionResult<br />{<br />};<br />


* Wrong completions inside function-try-block in constructor: http://llvm.org/bugs/show_bug.cgi?id=15660

<br />class Class<br />{<br /> int a;<br /> int '''c;<br />public:<br /> Class(int b) try : a(b), c(new int)<br /> {<br /> }<br /> catch ()<br /> {<br /> // no &quot;delete&amp;quot; proposed<br /> }<br />};<br />


Completion with nested names lookup not performed for comparison with enum value

<br /> if (lexer.tokenKind() == Token::LeftBrace) {<br /> }<br />


* Value types completions added where thay shouldn't be

<br />QStringList createClangOptions(CPlusPlus::ProjectFile::Kind language,<br /> CPlusPlus::ProjectPart::CXXExtensions extensions,<br /> CPlusPlus::ProjectPart::,<br /> CPlusPlus::ProjectPart::QtVersion qtVersion,<br /> const QList&amp;lt;QByteArray&amp;gt; &amp;defines,<br /> const QStringList &amp;includePaths,<br /> const QStringList &amp;frameworkPaths);<br />


* C+11 'override' pseudo-keyword breaks clang_annotateTokens()

<br />bool init() override;<br />
  • Poor completion context recognition in template params
    <br />std::vector&amp;lt;#&gt; myVector;<br />
    
  • Clang doesn't add Informative completion chunk to macro. It better to add macro definition text to informative.
    <br />#define MACRO std::min(left, right)
    
    // Completion proposal &quot;MACRO&amp;quot; doesn't have chunk of kind Informative with text &quot;std::min(left, right)&quot;<br />
    
  • Completion stops after asterisk:
    <br />ButtonsFactory '''ButtonsFactory::ms_instance = 0;<br />ButtonsFactory'''// completion requested here<br />