summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/Type.cpp11
-rw-r--r--clang/lib/Parse/ParseObjc.cpp9
2 files changed, 18 insertions, 2 deletions
diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index 5a60655bf48..cee5fee8391 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -1339,6 +1339,17 @@ Optional<ArrayRef<QualType>> Type::getObjCSubstitutions(
return objectType->getTypeArgs();
}
+bool Type::acceptsObjCTypeParams() const {
+ if (auto *IfaceT = getAsObjCInterfaceType()) {
+ if (auto *ID = IfaceT->getInterface()) {
+ if (ID->getTypeParamList())
+ return true;
+ }
+ }
+
+ return false;
+}
+
void ObjCObjectType::computeSuperClassTypeSlow() const {
// Retrieve the class declaration for this type. If there isn't one
// (e.g., this is some variant of "id" or "Class"), then there is no
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp
index 4f16d47dfa7..ed6090453da 100644
--- a/clang/lib/Parse/ParseObjc.cpp
+++ b/clang/lib/Parse/ParseObjc.cpp
@@ -1658,8 +1658,13 @@ void Parser::parseObjCTypeArgsOrProtocolQualifiers(
identifierLocs[i]));
}
- Actions.CodeCompleteObjCProtocolReferences(identifierLocPairs.data(),
- identifierLocPairs.size());
+ QualType BaseT = Actions.GetTypeFromParser(baseType);
+ if (!BaseT.isNull() && BaseT->acceptsObjCTypeParams()) {
+ Actions.CodeCompleteOrdinaryName(getCurScope(), Sema::PCC_Type);
+ } else {
+ Actions.CodeCompleteObjCProtocolReferences(identifierLocPairs.data(),
+ identifierLocPairs.size());
+ }
cutOffParsing();
return;
}
OpenPOWER on IntegriCloud