[PATCH] D38538: Avoid printing some redundant name qualifiers in completion

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 4 05:41:06 PDT 2017


ilya-biryukov created this revision.
Herald added a subscriber: eraman.

Adjusted PrintingPolicy inside code completion to avoid printing some
redundant name qualifiers.

Before this change, typedefs that were written unqualified in source
code were printed with qualifiers in completion. For example, in the
following code

  struct foo {
      typedef int type;
      type method();
  };

completion item for `method` had return type of `foo::type`, even
though the original code used `type` without qualifiers.
After this change, the completion item has return type `type`, as
originally written in the source code.

Note that this change does not suppress qualifiers written by the
user. For example, in the following code

  typedef int type;
  struct foo {
      typedef int type;
      ::type method(foo::type);
  };

completion item for `method` has return type of `::type` and
parameter type of `foo::type`, as originally written in the source
code.


https://reviews.llvm.org/D38538

Files:
  lib/Sema/SemaCodeComplete.cpp
  test/CodeCompletion/call.cpp
  test/CodeCompletion/enum-switch-case-qualified.cpp
  test/CodeCompletion/enum-switch-case.cpp
  test/CodeCompletion/qualifiers-as-written.cpp
  test/CodeCompletion/uninstantiated_params.cpp
  test/Index/code-completion.cpp
  test/Index/complete-cxx-inline-methods.cpp
  test/Index/complete-documentation-templates.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38538.117662.patch
Type: text/x-patch
Size: 7618 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171004/6d6e6983/attachment.bin>


More information about the cfe-commits mailing list