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

remove document symbols from macro expansion #794

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

FederAndInk
Copy link
Contributor

@FederAndInk FederAndInk commented May 9, 2021

There is one issue in #674 though that I've completely forgotten about, it does not manage macro expansion eg:

#define M                                                                                \
  namespace ns_name                                                                      \
  {                                                                                      \
  namespace ns_name_impl                                                                 \
  {                                                                                      \
  void f() {}                                                                            \
  }                                                                                      \
  }

M;

may generate this outline:
image

clangd is showing symbols in macro definition but not in macro expansion

at least we have to exclude symbols from macro expansion, here is a quick PR to detect and remove macro expansion, but it may exist a better implementation

The question is, what do we do with macro expansions? Should we remove them? (like this PR does)

eg:

 #define M                                                                               \
  namespace ns_name                                                                      \
  {                                                                                      \
  namespace ns_name_impl                                                                 \
  {                                                                                      \
  void f() {}                                                                            \
  }                                                                                      \
  }

M;
@@ -130,6 +130,20 @@ template <> bool ignore(const QueryVar::Def *def) {
}
} // namespace

bool is_macro_expansion(DB *db, WorkingFile *wf, QueryFile *file,
Copy link
Owner

Choose a reason for hiding this comment

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

This can be folded into ignore for QueryVar::Def

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a little bit cumbersome, I'll make a commit, so you can see what it looks like, but we would have to edit all ignore functions not just for QueryVar::Def because we want to ignore all symbols generated by macro expansion not just variables.

rename is_macro_expansion to isPartOfMacroExpansion
@MaskRay MaskRay force-pushed the master branch 3 times, most recently from db890d4 to cc13ced Compare November 6, 2024 05:57
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