]> granicus.if.org Git - clang/commit
Avoid printing some redundant name qualifiers in completion
authorIlya Biryukov <ibiryukov@google.com>
Wed, 8 Nov 2017 10:39:09 +0000 (10:39 +0000)
committerIlya Biryukov <ibiryukov@google.com>
Wed, 8 Nov 2017 10:39:09 +0000 (10:39 +0000)
commit84f05ebee70a608bc7ba478636fdbb30067d855e
treebb3794b4c07408be9724f5a3e395986a08633ff3
parent55570a3383b2c35a4c5d56b01d795a4abe41eafa
Avoid printing some redundant name qualifiers in completion

Summary:
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.

Reviewers: arphaman, bkramer, klimek

Reviewed By: arphaman

Subscribers: mgorny, eraman, cfe-commits

Differential Revision: https://reviews.llvm.org/D38538

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317677 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaCodeComplete.cpp
test/CodeCompletion/call.cpp
test/CodeCompletion/qualifiers-as-written.cpp [new file with mode: 0644]
test/CodeCompletion/uninstantiated_params.cpp
test/Index/complete-cxx-inline-methods.cpp