diff options
Diffstat (limited to 'clang/lib/AST/DeclObjC.cpp')
-rw-r--r-- | clang/lib/AST/DeclObjC.cpp | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index 5db04509999..01fd10429fc 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/lib/AST/DeclObjC.cpp @@ -51,7 +51,7 @@ void ObjCListBase::set(void *const* InList, unsigned Elts, ASTContext &Ctx) { memcpy(List, InList, sizeof(void*)*Elts); } -void ObjCProtocolList::set(ObjCProtocolDecl* const* InList, unsigned Elts, +void ObjCProtocolList::set(ObjCProtocolDecl* const* InList, unsigned Elts, const SourceLocation *Locs, ASTContext &Ctx) { if (Elts == 0) return; @@ -145,7 +145,7 @@ bool ObjCContainerDecl::HasUserDeclaredSetterMethod( break; } } - + // Also look into protocols, for a user declared instance method. for (const auto *Proto : ID->all_referenced_protocols()) if (Proto->HasUserDeclaredSetterMethod(Property)) @@ -235,7 +235,7 @@ ObjCPropertyDecl *ObjCContainerDecl::FindPropertyDeclaration( if (Def->isHidden()) return nullptr; } - + // Search the extensions of a class first; they override what's in // the class itself. if (const auto *ClassDecl = dyn_cast<ObjCInterfaceDecl>(this)) { @@ -332,7 +332,7 @@ ObjCInterfaceDecl *ObjCInterfaceDecl::getSuperClass() const { // FIXME: Should make sure no callers ever do this. if (!hasDefinition()) return nullptr; - + if (data().ExternallyCompleted) LoadExternalDefinition(); @@ -351,7 +351,7 @@ ObjCInterfaceDecl *ObjCInterfaceDecl::getSuperClass() const { SourceLocation ObjCInterfaceDecl::getSuperClassLoc() const { if (TypeSourceInfo *superTInfo = getSuperClassTInfo()) return superTInfo->getTypeLoc().getLocStart(); - + return SourceLocation(); } @@ -429,12 +429,12 @@ void ObjCInterfaceDecl::mergeClassExtensionProtocolList( if (data().ExternallyCompleted) LoadExternalDefinition(); - if (data().AllReferencedProtocols.empty() && + if (data().AllReferencedProtocols.empty() && data().ReferencedProtocols.empty()) { data().AllReferencedProtocols.set(ExtList, ExtNum, C); return; } - + // Check for duplicate protocol in class's protocol list. // This is O(n*m). But it is extremely rare and number of protocols in // class or its extension are very few. @@ -446,7 +446,7 @@ void ObjCInterfaceDecl::mergeClassExtensionProtocolList( if (C.ProtocolCompatibleWithProtocol(ProtoInExtension, Proto)) { protocolExists = true; break; - } + } } // Do we want to warn on a protocol in extension class which // already exist in the class? Probably not. @@ -633,7 +633,7 @@ ObjCIvarDecl *ObjCInterfaceDecl::lookupInstanceVariable(IdentifierInfo *ID, return I; } } - + ClassDecl = ClassDecl->getSuperClass(); } return nullptr; @@ -673,7 +673,7 @@ ObjCInterfaceDecl::lookupNestedProtocol(IdentifierInfo *Name) { /// the class, its categories, and its super classes (using a linear search). /// When argument category "C" is specified, any implicit method found /// in this category is ignored. -ObjCMethodDecl *ObjCInterfaceDecl::lookupMethod(Selector Sel, +ObjCMethodDecl *ObjCInterfaceDecl::lookupMethod(Selector Sel, bool isInstance, bool shallowCategoryLookup, bool followSuper, @@ -693,7 +693,7 @@ ObjCMethodDecl *ObjCInterfaceDecl::lookupMethod(Selector Sel, // 1. Look through primary class. if ((MethodDecl = ClassDecl->getMethod(Sel, isInstance))) return MethodDecl; - + // 2. Didn't find one yet - now look through categories. for (const auto *Cat : ClassDecl->visible_categories()) if ((MethodDecl = Cat->getMethod(Sel, isInstance))) @@ -704,7 +704,7 @@ ObjCMethodDecl *ObjCInterfaceDecl::lookupMethod(Selector Sel, for (const auto *I : ClassDecl->protocols()) if ((MethodDecl = I->lookupMethod(Sel, isInstance))) return MethodDecl; - + // 4. Didn't find one yet - now look through categories' protocols if (!shallowCategoryLookup) for (const auto *Cat : ClassDecl->visible_categories()) { @@ -716,8 +716,8 @@ ObjCMethodDecl *ObjCInterfaceDecl::lookupMethod(Selector Sel, if (C != Cat || !MethodDecl->isImplicit()) return MethodDecl; } - - + + if (!followSuper) return nullptr; @@ -742,7 +742,7 @@ ObjCMethodDecl *ObjCInterfaceDecl::lookupPrivateMethod( ObjCMethodDecl *Method = nullptr; if (ObjCImplementationDecl *ImpDecl = getImplementation()) - Method = Instance ? ImpDecl->getInstanceMethod(Sel) + Method = Instance ? ImpDecl->getInstanceMethod(Sel) : ImpDecl->getClassMethod(Sel); // Look through local category implementations associated with the class. @@ -990,12 +990,12 @@ ObjCMethodFamily ObjCMethodDecl::getMethodFamily() const { if (!isInstanceMethod()) family = OMF_None; break; - + case OMF_initialize: if (isInstanceMethod() || !getReturnType()->isVoidType()) family = OMF_None; break; - + case OMF_performSelector: if (!isInstanceMethod() || !getReturnType()->isObjCIdType()) family = OMF_None; @@ -1021,7 +1021,7 @@ ObjCMethodFamily ObjCMethodDecl::getMethodFamily() const { } } break; - + } // Cache the result. @@ -1441,11 +1441,11 @@ ObjCInterfaceDecl::ObjCInterfaceDecl(const ASTContext &C, DeclContext *DC, : ObjCContainerDecl(ObjCInterface, DC, Id, CLoc, AtLoc), redeclarable_base(C) { setPreviousDecl(PrevDecl); - + // Copy the 'data' pointer over. if (PrevDecl) Data = PrevDecl->Data; - + setImplicit(IsInternal); setTypeParamList(typeParamList); @@ -1459,9 +1459,9 @@ void ObjCInterfaceDecl::LoadExternalDefinition() const { } void ObjCInterfaceDecl::setExternallyCompleted() { - assert(getASTContext().getExternalSource() && + assert(getASTContext().getExternalSource() && "Class can't be externally completed without an external source"); - assert(hasDefinition() && + assert(hasDefinition() && "Forward declarations can't be externally completed"); data().ExternallyCompleted = true; } @@ -1496,7 +1496,7 @@ ObjCImplementationDecl::getObjCRuntimeNameAsString() const { if (ObjCInterfaceDecl *ID = const_cast<ObjCImplementationDecl*>(this)->getClassInterface()) return ID->getObjCRuntimeNameAsString(); - + return getName(); } @@ -1504,11 +1504,11 @@ ObjCImplementationDecl *ObjCInterfaceDecl::getImplementation() const { if (const ObjCInterfaceDecl *Def = getDefinition()) { if (data().ExternallyCompleted) LoadExternalDefinition(); - + return getASTContext().getObjCImplementation( const_cast<ObjCInterfaceDecl*>(Def)); } - + // FIXME: Should make sure no callers ever do this. return nullptr; } @@ -1576,7 +1576,7 @@ ObjCIvarDecl *ObjCInterfaceDecl::all_declared_ivar_begin() { // cached and complete! if (!data().IvarListMissingImplementation) return data().IvarList; - + if (ObjCImplementationDecl *ImplDecl = getImplementation()) { data().IvarListMissingImplementation = false; if (!ImplDecl->ivar_empty()) { @@ -1593,7 +1593,7 @@ ObjCIvarDecl *ObjCInterfaceDecl::all_declared_ivar_begin() { curIvar->setNextIvar(IV); curIvar = IV; } - + if (!layout.empty()) { // Order synthesized ivars by their size. std::stable_sort(layout.begin(), layout.end()); @@ -1659,7 +1659,7 @@ bool ObjCInterfaceDecl::ClassImplementsProtocol(ObjCProtocolDecl *lProto, bool RHSIsQualifiedID) { if (!hasDefinition()) return false; - + ObjCInterfaceDecl *IDecl = this; // 1st, look up the class. for (auto *PI : IDecl->protocols()){ @@ -1869,7 +1869,7 @@ void ObjCProtocolDecl::allocateDefinitionData() { void ObjCProtocolDecl::startDefinition() { allocateDefinitionData(); - + // Update all of the declarations with a pointer to the definition. for (auto *RD : redecls()) RD->Data = this->Data; @@ -1926,7 +1926,7 @@ ObjCProtocolDecl::getObjCRuntimeNameAsString() const { void ObjCCategoryDecl::anchor() {} ObjCCategoryDecl::ObjCCategoryDecl(DeclContext *DC, SourceLocation AtLoc, - SourceLocation ClassNameLoc, + SourceLocation ClassNameLoc, SourceLocation CategoryNameLoc, IdentifierInfo *Id, ObjCInterfaceDecl *IDecl, ObjCTypeParamList *typeParamList, @@ -2008,7 +2008,7 @@ ObjCCategoryImplDecl::Create(ASTContext &C, DeclContext *DC, atStartLoc, CategoryNameLoc); } -ObjCCategoryImplDecl *ObjCCategoryImplDecl::CreateDeserialized(ASTContext &C, +ObjCCategoryImplDecl *ObjCCategoryImplDecl::CreateDeserialized(ASTContext &C, unsigned ID) { return new (C, ID) ObjCCategoryImplDecl(nullptr, nullptr, nullptr, SourceLocation(), SourceLocation(), |