This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Collect enum constants in SymbolCollector
ClosedPublic

Authored by hokein on Jan 15 2018, 8:28 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

hokein created this revision.Jan 15 2018, 8:28 AM
ilya-biryukov added inline comments.Jan 15 2018, 8:53 AM
clangd/index/SymbolCollector.cpp
75 ↗(On Diff #129864)

What are those declarations exactly?

unittests/clangd/SymbolCollectorTests.cpp
174 ↗(On Diff #129864)

I'd say we should drop enum constants inside stongly-typed enums (i.e. enum class).
They can't be found inside namespace by code completion, therefore being similar to static method in that regard. (And we don't include static methods now, right?)

hokein updated this revision to Diff 130372.Jan 18 2018, 2:02 AM
hokein marked 2 inline comments as done.

Ignore enum constants in scoped enum.

hokein added inline comments.Jan 18 2018, 2:03 AM
clangd/index/SymbolCollector.cpp
75 ↗(On Diff #129864)

This would ignore anonymous declarations, e.g. anonymous class/enum. See the unittest.

unittests/clangd/SymbolCollectorTests.cpp
174 ↗(On Diff #129864)

yeah, that makes sense.

ioeric added a subscriber: ioeric.Jan 18 2018, 2:11 AM
ioeric added inline comments.
unittests/clangd/SymbolCollectorTests.cpp
164 ↗(On Diff #130372)

Could you add a test case like the following and check whether ns::X is in the result?

namespace ns {
  enum {
     X
  };
}
hokein updated this revision to Diff 130395.Jan 18 2018, 4:56 AM
hokein marked an inline comment as done.

Add one more test.

ilya-biryukov accepted this revision.Jan 18 2018, 8:04 AM

LGTM. (See the comment about changing the comment, though)

clangd/index/SymbolCollector.cpp
75 ↗(On Diff #129864)

Thanks for clarifying. Maybe we could change the comment to say "anonymous" instead of "nameless"? This is what bit got me confused.

This revision is now accepted and ready to land.Jan 18 2018, 8:04 AM
hokein updated this revision to Diff 130568.Jan 19 2018, 1:12 AM
hokein marked an inline comment as done.

Update comment.

This revision was automatically updated to reflect the committed changes.