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

Add name for anonymous Enum #524

Merged
merged 1 commit into from
Nov 16, 2019
Merged

Add name for anonymous Enum #524

merged 1 commit into from
Nov 16, 2019

Conversation

xVanTuring
Copy link
Contributor

ccls/src/indexer.cc

Lines 963 to 965 in bd609e8

case TTK_Enum:
tag = "enum";
break;

Here, case Decl::Record is trying to match enum. However, EnumDecl and RecordDecl are both inherited from TagDecl directly, is, so the matching here will never get executed, which causes the anonymous Enum having no name. So I add a case:: Enum matching above case Decl::Record, and it will add a simple name for anonymous Enum.

Of course, removing the matching code is an alternative solution.
Any edits are welcome.

@MaskRay MaskRay merged commit 0f6b72e into MaskRay:master Nov 16, 2019
@MaskRay
Copy link
Owner

MaskRay commented Nov 16, 2019

Thanks. This will assign anon enum to an anonymous Enum.

struct A {
  enum {B,C} xx;
};

textDocument/hover on enum will say "anon enum".

Use{{fromTokenRange(sm, lang, {sl1, sl1}), Role::Definition},
lid},
fromTokenRange(sm, lang, sr1)};
type1.def.spell = {Use{{fromTokenRange(sm, lang, {sl1, sl1}),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deleted this unrelated change when merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants