Handle pseudo-object expressions (and any other placeholder

expression) when code-completing member access expressions. Fixes
<rdar://problem/10717172>.

llvm-svn: 148703
This commit is contained in:
Douglas Gregor 2012-01-23 15:59:30 +00:00
parent c7ee2013d9
commit 1cc88a977c
2 changed files with 23 additions and 4 deletions

View File

@ -3351,15 +3351,19 @@ static void AddObjCProperties(ObjCContainerDecl *Container,
}
}
void Sema::CodeCompleteMemberReferenceExpr(Scope *S, Expr *BaseE,
void Sema::CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base,
SourceLocation OpLoc,
bool IsArrow) {
if (!BaseE || !CodeCompleter)
if (!Base || !CodeCompleter)
return;
ExprResult ConvertedBase = PerformMemberExprBaseConversion(Base, IsArrow);
if (ConvertedBase.isInvalid())
return;
Base = ConvertedBase.get();
typedef CodeCompletionResult Result;
Expr *Base = static_cast<Expr *>(BaseE);
QualType BaseType = Base->getType();
if (IsArrow) {

View File

@ -34,6 +34,14 @@ int test_more_props(Sub *s) {
return s.myOtherPropLikeThing;
}
@interface Other
@property Sub *sub;
@end
int test_two_levels(Other *other) {
return other.sub.myProp;
}
// RUN: c-index-test -code-completion-at=%s:21:7 %s | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: ObjCPropertyDecl:{ResultType int}{TypedText prop1}
// CHECK-CC1: ObjCPropertyDecl:{ResultType float}{TypedText ProtoProp}
@ -59,4 +67,11 @@ int test_more_props(Sub *s) {
// CHECK-CC3-NEXT: Objective-C property access
// CHECK-CC3-NEXT: Container Kind: ObjCInterfaceDecl
// CHECK-CC3-NEXT: Container is complete
// CHECK-CC3-NEXT: Container USR: c:objc(cs)Sub
// CHECK-CC3-NEXT: Container USR: c:objc(cs)Sub
// RUN: c-index-test -code-completion-at=%s:42:20 %s | FileCheck -check-prefix=CHECK-CC4 %s
// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText myOtherPropLikeThing} (37)
// CHECK-CC4-NEXT: ObjCPropertyDecl:{ResultType int}{TypedText myProp} (35)
// CHECK-CC4-NEXT: ObjCPropertyDecl:{ResultType int}{TypedText prop1} (35)
// CHECK-CC4-NEXT: ObjCPropertyDecl:{ResultType float}{TypedText ProtoProp} (35)