2009-11-09 19:04:45 +03:00
|
|
|
// Code-completion through the C interface
|
2009-11-09 19:06:30 +03:00
|
|
|
#include "nonexistent_header.h"
|
2009-11-09 19:04:45 +03:00
|
|
|
struct X {
|
|
|
|
int member;
|
2009-11-10 00:35:27 +03:00
|
|
|
|
|
|
|
enum E { Val1 };
|
2009-11-09 19:04:45 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Y {
|
|
|
|
float member;
|
|
|
|
void memfunc(int i = 17);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Z : X, Y {
|
|
|
|
double member;
|
|
|
|
operator int() const;
|
|
|
|
};
|
2010-08-17 03:05:20 +04:00
|
|
|
struct W { };
|
2009-11-09 19:04:45 +03:00
|
|
|
struct Z get_Z();
|
2010-08-17 03:05:20 +04:00
|
|
|
namespace N { }
|
2009-11-09 19:04:45 +03:00
|
|
|
void test_Z() {
|
2009-11-10 00:35:27 +03:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:23:11 %s | FileCheck -check-prefix=CHECK-MEMBER %s
|
2009-11-09 19:04:45 +03:00
|
|
|
get_Z().member = 17;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
float& overloaded(int i, long second);
|
|
|
|
double& overloaded(float f, int second);
|
|
|
|
int& overloaded(Z z, int second);
|
|
|
|
|
|
|
|
void test_overloaded() {
|
2009-11-10 00:35:27 +03:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:33:18 %s | FileCheck -check-prefix=CHECK-OVERLOAD %s
|
2009-11-09 19:04:45 +03:00
|
|
|
overloaded(Z(), 0);
|
|
|
|
}
|
|
|
|
|
2010-06-16 00:26:51 +04:00
|
|
|
Z::operator int() const {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-12-18 21:53:37 +03:00
|
|
|
// CHECK-MEMBER: FieldDecl:{ResultType double}{TypedText member}
|
2010-01-14 02:24:38 +03:00
|
|
|
// CHECK-MEMBER: FieldDecl:{ResultType int}{Text X::}{TypedText member}
|
|
|
|
// CHECK-MEMBER: FieldDecl:{ResultType float}{Text Y::}{TypedText member}
|
2010-09-04 03:30:36 +04:00
|
|
|
// CHECK-MEMBER: CXXMethod:{ResultType void}{Informative Y::}{TypedText memfunc}{LeftParen (}{Optional {Placeholder int i}}{RightParen )}
|
|
|
|
// CHECK-MEMBER: CXXConversion:{ResultType int}{TypedText operator int}{LeftParen (}{RightParen )}{Informative const}
|
2010-09-05 04:17:29 +04:00
|
|
|
// CHECK-MEMBER: CXXMethod:{ResultType Z &}{TypedText operator=}{LeftParen (}{Placeholder const Z &}{RightParen )}
|
|
|
|
// CHECK-MEMBER: CXXMethod:{ResultType X &}{Text X::}{TypedText operator=}{LeftParen (}{Placeholder const X &}{RightParen )}
|
|
|
|
// CHECK-MEMBER: CXXMethod:{ResultType Y &}{Text Y::}{TypedText operator=}{LeftParen (}{Placeholder const Y &}{RightParen )}
|
2010-03-10 14:27:22 +03:00
|
|
|
// CHECK-MEMBER: EnumConstantDecl:{ResultType X::E}{Informative E::}{TypedText Val1}
|
2009-12-11 20:31:05 +03:00
|
|
|
// CHECK-MEMBER: StructDecl:{TypedText X}{Text ::}
|
|
|
|
// CHECK-MEMBER: StructDecl:{TypedText Y}{Text ::}
|
|
|
|
// CHECK-MEMBER: StructDecl:{TypedText Z}{Text ::}
|
2010-09-04 03:30:36 +04:00
|
|
|
// CHECK-MEMBER: CXXDestructor:{ResultType void}{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )}
|
|
|
|
// CHECK-MEMBER: CXXDestructor:{ResultType void}{Informative Y::}{TypedText ~Y}{LeftParen (}{RightParen )}
|
|
|
|
// CHECK-MEMBER: CXXDestructor:{ResultType void}{TypedText ~Z}{LeftParen (}{RightParen )}
|
2009-11-09 19:04:45 +03:00
|
|
|
|
2010-03-10 14:27:22 +03:00
|
|
|
// CHECK-OVERLOAD: NotImplemented:{ResultType int &}{Text overloaded}{LeftParen (}{Text Z z}{Comma , }{CurrentParameter int second}{RightParen )}
|
2009-12-18 21:53:37 +03:00
|
|
|
// CHECK-OVERLOAD: NotImplemented:{ResultType float &}{Text overloaded}{LeftParen (}{Text int i}{Comma , }{CurrentParameter long second}{RightParen )}
|
|
|
|
// CHECK-OVERLOAD: NotImplemented:{ResultType double &}{Text overloaded}{LeftParen (}{Text float f}{Comma , }{CurrentParameter int second}{RightParen )}
|
2010-06-16 00:26:51 +04:00
|
|
|
|
|
|
|
// RUN: c-index-test -code-completion-at=%s:37:10 %s | FileCheck -check-prefix=CHECK-EXPR %s
|
2010-09-16 20:21:35 +04:00
|
|
|
// CHECK-EXPR: NotImplemented:{TypedText int} (60)
|
|
|
|
// CHECK-EXPR: NotImplemented:{TypedText long} (60)
|
2010-08-26 02:15:42 +04:00
|
|
|
// CHECK-EXPR: FieldDecl:{ResultType double}{TypedText member} (10)
|
2010-08-26 04:30:24 +04:00
|
|
|
// CHECK-EXPR: FieldDecl:{ResultType int}{Text X::}{TypedText member} (5)
|
2010-06-16 00:26:51 +04:00
|
|
|
// CHECK-EXPR: FieldDecl:{ResultType float}{Text Y::}{TypedText member} (11)
|
2010-09-04 03:30:36 +04:00
|
|
|
// CHECK-EXPR: CXXMethod:{ResultType void}{TypedText memfunc}{LeftParen (}{Optional {Placeholder int i}}{RightParen )} (22)
|
|
|
|
// CHECK-EXPR: Namespace:{TypedText N}{Text ::} (75)
|