aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaCodeComplete.cpp
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2016-10-12 11:40:15 +0000
committerAlex Lorenz <arphaman@gmail.com>2016-10-12 11:40:15 +0000
commit06cfa99268ecab69900300c237e010d01a0db881 (patch)
tree0f444c94eb0b955d3fa9bed3731feec07efee192 /clang/lib/Sema/SemaCodeComplete.cpp
parenta9fcc1d2a437e75907572c5a765a933e679ae5a9 (diff)
downloadllvm-06cfa99268ecab69900300c237e010d01a0db881.zip
llvm-06cfa99268ecab69900300c237e010d01a0db881.tar.gz
llvm-06cfa99268ecab69900300c237e010d01a0db881.tar.bz2
[CodeCompletion] Show protocol properties that are accessed through qualified id
This commit improves code completion for properties that are declared in Objective-C protocols by making sure that properties show up in completions when they are accessed through a qualified id. rdar://24426041 Differential Revision: https://reviews.llvm.org/D25436 llvm-svn: 284007
Diffstat (limited to 'clang/lib/Sema/SemaCodeComplete.cpp')
-rw-r--r--clang/lib/Sema/SemaCodeComplete.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index 36babc4..d235479 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -3720,20 +3720,21 @@ void Sema::CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base,
Results.AddResult(Result("template"));
}
}
- } else if (!IsArrow && BaseType->getAsObjCInterfacePointerType()) {
+ } else if (!IsArrow && BaseType->isObjCObjectPointerType()) {
// Objective-C property reference.
AddedPropertiesSet AddedProperties;
-
- // Add property results based on our interface.
- const ObjCObjectPointerType *ObjCPtr
- = BaseType->getAsObjCInterfacePointerType();
- assert(ObjCPtr && "Non-NULL pointer guaranteed above!");
- AddObjCProperties(CCContext, ObjCPtr->getInterfaceDecl(), true,
- /*AllowNullaryMethods=*/true, CurContext,
- AddedProperties, Results);
-
+
+ if (const ObjCObjectPointerType *ObjCPtr =
+ BaseType->getAsObjCInterfacePointerType()) {
+ // Add property results based on our interface.
+ assert(ObjCPtr && "Non-NULL pointer guaranteed above!");
+ AddObjCProperties(CCContext, ObjCPtr->getInterfaceDecl(), true,
+ /*AllowNullaryMethods=*/true, CurContext,
+ AddedProperties, Results);
+ }
+
// Add properties from the protocols in a qualified interface.
- for (auto *I : ObjCPtr->quals())
+ for (auto *I : BaseType->getAs<ObjCObjectPointerType>()->quals())
AddObjCProperties(CCContext, I, true, /*AllowNullaryMethods=*/true,
CurContext, AddedProperties, Results);
} else if ((IsArrow && BaseType->isObjCObjectPointerType()) ||