[PATCH] D47223: [clangd] Handle enumerators in named, unscoped enums similarly to scoped enums

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 28 05:44:44 PDT 2018


ilya-biryukov added a comment.

So to keep completion working, maybe we can give add enumerators with full qualification and have a flag that determines whether the last component of the qualifier can be ignored?
This would give a simple implementation path for now, and will add a semantic signal that we need to support enumerators, at least.
For example,

  enum En {
    A,
  };
  
  enum class ScopedEn {
    A
  };

will produce symbols with

  [ { Scope = "En::", 
      InsideUnscopedEnum=true, 
      Name="A"}, 
    { Scope = "ScopedEn::",
      InsideUnscopedEnum = false,
      Name = "A" } ]

fuzzyFind will have 2 variants:

- For code completion, it will return `En::A` only when queries with `::A` (e.g. in global scope).
- For workspace symbol, it can return `En::A` for `A` and `En::A`. For `::A` it can return empty results.

Scoped enums work the same as before. Other case (using decls and inline namespaces) will also work as before.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D47223





More information about the cfe-commits mailing list