2011-11-03 08:16:13 +08:00
|
|
|
namespace {
|
2011-09-04 11:32:15 +08:00
|
|
|
class MyCls {
|
|
|
|
void in_foo() {
|
|
|
|
vec.x = 0;
|
|
|
|
}
|
|
|
|
void out_foo();
|
|
|
|
|
|
|
|
struct Vec { int x, y; };
|
|
|
|
Vec vec;
|
|
|
|
};
|
|
|
|
|
|
|
|
void MyCls::out_foo() {
|
|
|
|
vec.x = 0;
|
|
|
|
}
|
|
|
|
|
2011-11-03 07:39:56 +08:00
|
|
|
class OtherClass : public MyCls {
|
|
|
|
public:
|
|
|
|
OtherClass(const OtherClass &other) : MyCls(other), value(value) { }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int value;
|
|
|
|
MyCls *object;
|
|
|
|
};
|
2011-11-03 08:16:13 +08:00
|
|
|
}
|
2011-11-03 07:39:56 +08:00
|
|
|
|
2012-08-30 10:08:31 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:4:9 -std=c++98 %s | FileCheck %s
|
|
|
|
// RUN: c-index-test -code-completion-at=%s:13:7 -std=c++98 %s | FileCheck %s
|
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
llvm-svn: 317677
2017-11-08 18:39:09 +08:00
|
|
|
// CHECK: CXXMethod:{ResultType Vec &}{TypedText operator=}{LeftParen (}{Placeholder const Vec &}{RightParen )} (79)
|
2011-09-04 11:32:15 +08:00
|
|
|
// CHECK-NEXT: StructDecl:{TypedText Vec}{Text ::} (75)
|
|
|
|
// CHECK-NEXT: FieldDecl:{ResultType int}{TypedText x} (35)
|
|
|
|
// CHECK-NEXT: FieldDecl:{ResultType int}{TypedText y} (35)
|
2017-09-23 03:07:37 +08:00
|
|
|
// CHECK-NEXT: CXXDestructor:{ResultType void}{TypedText ~Vec}{LeftParen (}{RightParen )} (79)
|
2011-09-04 11:32:15 +08:00
|
|
|
// CHECK-NEXT: Completion contexts:
|
|
|
|
// CHECK-NEXT: Dot member access
|
|
|
|
// CHECK-NEXT: Container Kind: StructDecl
|
2011-11-03 07:39:56 +08:00
|
|
|
|
2011-11-03 08:16:13 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:18:41 %s | FileCheck -check-prefix=CHECK-CTOR-INIT %s
|
2011-11-03 07:39:56 +08:00
|
|
|
// CHECK-CTOR-INIT: NotImplemented:{TypedText MyCls}{LeftParen (}{Placeholder args}{RightParen )} (7)
|
|
|
|
// CHECK-CTOR-INIT: MemberRef:{TypedText object}{LeftParen (}{Placeholder args}{RightParen )} (35)
|
|
|
|
// CHECK-CTOR-INIT: MemberRef:{TypedText value}{LeftParen (}{Placeholder args}{RightParen )} (35)
|
2011-11-03 08:16:13 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:18:55 %s | FileCheck -check-prefix=CHECK-CTOR-INIT-2 %s
|
2011-11-03 07:39:56 +08:00
|
|
|
// CHECK-CTOR-INIT-2-NOT: NotImplemented:{TypedText MyCls}{LeftParen (}{Placeholder args}{RightParen )}
|
|
|
|
// CHECK-CTOR-INIT-2: MemberRef:{TypedText object}{LeftParen (}{Placeholder args}{RightParen )} (35)
|
|
|
|
// CHECK-CTOR-INIT-2: MemberRef:{TypedText value}{LeftParen (}{Placeholder args}{RightParen )} (7)
|