Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Clang] Incomplete/incorrect code completion about explicit object member function #109608

Open
zwuis opened this issue Sep 23, 2024 · 3 comments
Assignees
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clangd

Comments

@zwuis
Copy link
Contributor

zwuis commented Sep 23, 2024

Godbolt: https://godbolt.org/z/EPaebdEx9

struct S {
  void foo1() const;
  void foo2();
  void foo3(this const S& self);
  void foo4(this S& self);
};

void S::foo1() const {
  this-> // #1
}

void S::foo2() {
  this-> // #2
}

void S::foo3(this const S& self) {
  self. // #3
}

void S::foo4(this S& self) {
  self. // #4
}

void test1(S s) {
  s. // #5
}

void test2(const S s) {
  s. // #6
}

Code completion results:

At #1, #3 and #6: (missing foo3)

COMPLETION: foo1 : [#void#]foo1()[# const#]
COMPLETION: S : S::

At #2, #4 and #5: (unexpected argument in foo3 and foo4)

COMPLETION: foo1 : [#void#]foo1()[# const#]
COMPLETION: foo2 : [#void#]foo2()
COMPLETION: foo3 : [#void#]foo3(<#const S &self#>)
COMPLETION: foo4 : [#void#]foo4(<#S &self#>)
COMPLETION: operator= : [#S &#]operator=(<#const S &#>)
COMPLETION: operator= : [#S &#]operator=(<#S &&#>)
COMPLETION: S : S::
COMPLETION: ~S : [#void#]~S()
@github-actions github-actions bot added the clang Clang issues not falling into any other category label Sep 23, 2024
@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" and removed clang Clang issues not falling into any other category labels Sep 23, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Sep 23, 2024

@llvm/issue-subscribers-clang-frontend

Author: Yanzuo Liu (zwuis)

Godbolt: <https://godbolt.org/z/EPaebdEx9>
struct S {
  void foo1() const;
  void foo2();
  void foo3(this const S&amp; self);
  void foo4(this S&amp; self);
};

void S::foo1() const {
  this-&gt; // #<!-- -->1
}

void S::foo2() {
  this-&gt; // #<!-- -->2
}

void S::foo3(this const S&amp; self) {
  self. // #<!-- -->3
}

void S::foo4(this S&amp; self) {
  self. // #<!-- -->4
}

void test1(S s) {
  s. // #<!-- -->5
}

void test2(const S s) {
  s. // #<!-- -->6
}

Code completion results:

At #<!-- -->1, #<!-- -->3 and #<!-- -->6: (missing foo3)

COMPLETION: foo1 : [#void#]foo1()[# const#]
COMPLETION: S : S::

At #<!-- -->2, #<!-- -->4 and #<!-- -->5: (unexpected argument in foo3 and foo4)

COMPLETION: foo1 : [#void#]foo1()[# const#]
COMPLETION: foo2 : [#void#]foo2()
COMPLETION: foo3 : [#void#]foo3(&lt;#const S &amp;self#&gt;)
COMPLETION: foo4 : [#void#]foo4(&lt;#S &amp;self#&gt;)
COMPLETION: operator= : [#S &amp;#]operator=(&lt;#const S &amp;#&gt;)
COMPLETION: operator= : [#S &amp;#]operator=(&lt;#S &amp;&amp;#&gt;)
COMPLETION: S : S::
COMPLETION: ~S : [#void#]~S()

@llvmbot
Copy link
Collaborator

llvmbot commented Sep 23, 2024

@llvm/issue-subscribers-clangd

Author: Yanzuo Liu (zwuis)

Godbolt: <https://godbolt.org/z/EPaebdEx9>
struct S {
  void foo1() const;
  void foo2();
  void foo3(this const S&amp; self);
  void foo4(this S&amp; self);
};

void S::foo1() const {
  this-&gt; // #<!-- -->1
}

void S::foo2() {
  this-&gt; // #<!-- -->2
}

void S::foo3(this const S&amp; self) {
  self. // #<!-- -->3
}

void S::foo4(this S&amp; self) {
  self. // #<!-- -->4
}

void test1(S s) {
  s. // #<!-- -->5
}

void test2(const S s) {
  s. // #<!-- -->6
}

Code completion results:

At #<!-- -->1, #<!-- -->3 and #<!-- -->6: (missing foo3)

COMPLETION: foo1 : [#void#]foo1()[# const#]
COMPLETION: S : S::

At #<!-- -->2, #<!-- -->4 and #<!-- -->5: (unexpected argument in foo3 and foo4)

COMPLETION: foo1 : [#void#]foo1()[# const#]
COMPLETION: foo2 : [#void#]foo2()
COMPLETION: foo3 : [#void#]foo3(&lt;#const S &amp;self#&gt;)
COMPLETION: foo4 : [#void#]foo4(&lt;#S &amp;self#&gt;)
COMPLETION: operator= : [#S &amp;#]operator=(&lt;#const S &amp;#&gt;)
COMPLETION: operator= : [#S &amp;#]operator=(&lt;#S &amp;&amp;#&gt;)
COMPLETION: S : S::
COMPLETION: ~S : [#void#]~S()

@16bit-ykiko
Copy link
Contributor

16bit-ykiko commented Sep 23, 2024

I’m interested in this issue. Could you please assign it to me? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clangd
Projects
None yet
Development

No branches or pull requests

5 participants