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

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 9 08:02:50 PDT 2017

ilya-biryukov added inline comments.

Comment at: test/CodeCompletion/call.cpp:22
   // CHECK-CC1: COMPLETION: Pattern : dynamic_cast<<#type#>>(<#expression#>)
-  // CHECK-CC1: f(N::Y y, <#int ZZ#>)
+  // CHECK-CC1: f(Y y, <#int ZZ#>)
   // CHECK-CC1-NEXT: f(int i, <#int j#>, int k)
arphaman wrote:
> Could we also test a similar class to `Y` that's not typedefed, so you'd see `f(N::Y)`?
Not sure if you expect this to behave differently, but I've updated `qualifiers-as-written.cpp` to include a similar case. You could take a look and validate whether it matches your expected behavior.

The general idea is to not add extra qualification in completion items, where possible, and prefer to show what was written in the source code.
This is what currently happens for all names that had name-qualifiers. However, before this patch, unqualified names would printed with an added name qualifiers.

This sometimes led to really bad results. One example is vector's `push_back` that roughly gets printed as (libstdc++ version) `push_back(std::vector<int, std::allocator<int>>::value_type _Value)`. Whereas in the source code it's just `push_back(value_type _Value)`.


More information about the cfe-commits mailing list