From: Ted Kremenek Date: Mon, 7 Jan 2008 19:49:32 +0000 (+0000) Subject: Substituted all instances of the string "Objc" for "ObjC". This fixes X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a526c5c67e5a0473c340903ee542ce570119665f;p=clang Substituted all instances of the string "Objc" for "ObjC". This fixes some naming inconsistencies in the names of classes pertaining to Objective-C support in clang. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45715 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/AST/ASTContext.cpp b/AST/ASTContext.cpp index 85ccfd7556..a9a3d57293 100644 --- a/AST/ASTContext.cpp +++ b/AST/ASTContext.cpp @@ -48,8 +48,8 @@ void ASTContext::PrintStats() const { unsigned NumFunctionNP = 0, NumTypeName = 0, NumTagged = 0, NumReference = 0; unsigned NumTagStruct = 0, NumTagUnion = 0, NumTagEnum = 0, NumTagClass = 0; - unsigned NumObjcInterfaces = 0, NumObjcQualifiedInterfaces = 0; - unsigned NumObjcQualifiedIds = 0; + unsigned NumObjCInterfaces = 0, NumObjCQualifiedInterfaces = 0; + unsigned NumObjCQualifiedIds = 0; for (unsigned i = 0, e = Types.size(); i != e; ++i) { Type *T = Types[i]; @@ -80,12 +80,12 @@ void ASTContext::PrintStats() const { case Decl::Class: ++NumTagClass; break; case Decl::Enum: ++NumTagEnum; break; } - } else if (isa(T)) - ++NumObjcInterfaces; - else if (isa(T)) - ++NumObjcQualifiedInterfaces; - else if (isa(T)) - ++NumObjcQualifiedIds; + } else if (isa(T)) + ++NumObjCInterfaces; + else if (isa(T)) + ++NumObjCQualifiedInterfaces; + else if (isa(T)) + ++NumObjCQualifiedIds; else { QualType(T, 0).dump(); assert(0 && "Unknown type!"); @@ -106,11 +106,11 @@ void ASTContext::PrintStats() const { fprintf(stderr, " %d union types\n", NumTagUnion); fprintf(stderr, " %d class types\n", NumTagClass); fprintf(stderr, " %d enum types\n", NumTagEnum); - fprintf(stderr, " %d interface types\n", NumObjcInterfaces); + fprintf(stderr, " %d interface types\n", NumObjCInterfaces); fprintf(stderr, " %d protocol qualified interface types\n", - NumObjcQualifiedInterfaces); + NumObjCQualifiedInterfaces); fprintf(stderr, " %d protocol qualified id types\n", - NumObjcQualifiedIds); + NumObjCQualifiedIds); fprintf(stderr, "Total bytes = %d\n", int(NumBuiltin*sizeof(BuiltinType)+ NumPointer*sizeof(PointerType)+NumArray*sizeof(ArrayType)+ NumComplex*sizeof(ComplexType)+NumVector*sizeof(VectorType)+ @@ -162,12 +162,12 @@ void ASTContext::InitBuiltinTypes() { LongDoubleComplexTy = getComplexType(LongDoubleTy); BuiltinVaListType = QualType(); - ObjcIdType = QualType(); + ObjCIdType = QualType(); IdStructType = 0; - ObjcClassType = QualType(); + ObjCClassType = QualType(); ClassStructType = 0; - ObjcConstantStringType = QualType(); + ObjCConstantStringType = QualType(); // void * type VoidPtrTy = getPointerType(VoidTy); @@ -256,7 +256,7 @@ ASTContext::getTypeInfo(QualType T, SourceLocation L) { } break; } - case Type::ObjcQualifiedId: + case Type::ObjCQualifiedId: Target.getPointerInfo(Size, Align, getFullLoc(L)); break; case Type::Pointer: @@ -691,65 +691,65 @@ QualType ASTContext::getTypedefType(TypedefDecl *Decl) { return QualType(Decl->TypeForDecl, 0); } -/// getObjcInterfaceType - Return the unique reference to the type for the +/// getObjCInterfaceType - Return the unique reference to the type for the /// specified ObjC interface decl. -QualType ASTContext::getObjcInterfaceType(ObjcInterfaceDecl *Decl) { +QualType ASTContext::getObjCInterfaceType(ObjCInterfaceDecl *Decl) { if (Decl->TypeForDecl) return QualType(Decl->TypeForDecl, 0); - Decl->TypeForDecl = new ObjcInterfaceType(Type::ObjcInterface, Decl); + Decl->TypeForDecl = new ObjCInterfaceType(Type::ObjCInterface, Decl); Types.push_back(Decl->TypeForDecl); return QualType(Decl->TypeForDecl, 0); } -/// getObjcQualifiedInterfaceType - Return a -/// ObjcQualifiedInterfaceType type for the given interface decl and +/// getObjCQualifiedInterfaceType - Return a +/// ObjCQualifiedInterfaceType type for the given interface decl and /// the conforming protocol list. -QualType ASTContext::getObjcQualifiedInterfaceType(ObjcInterfaceDecl *Decl, - ObjcProtocolDecl **Protocols, unsigned NumProtocols) { +QualType ASTContext::getObjCQualifiedInterfaceType(ObjCInterfaceDecl *Decl, + ObjCProtocolDecl **Protocols, unsigned NumProtocols) { llvm::FoldingSetNodeID ID; - ObjcQualifiedInterfaceType::Profile(ID, Protocols, NumProtocols); + ObjCQualifiedInterfaceType::Profile(ID, Protocols, NumProtocols); void *InsertPos = 0; - if (ObjcQualifiedInterfaceType *QT = - ObjcQualifiedInterfaceTypes.FindNodeOrInsertPos(ID, InsertPos)) + if (ObjCQualifiedInterfaceType *QT = + ObjCQualifiedInterfaceTypes.FindNodeOrInsertPos(ID, InsertPos)) return QualType(QT, 0); // No Match; - ObjcQualifiedInterfaceType *QType = - new ObjcQualifiedInterfaceType(Decl, Protocols, NumProtocols); + ObjCQualifiedInterfaceType *QType = + new ObjCQualifiedInterfaceType(Decl, Protocols, NumProtocols); Types.push_back(QType); - ObjcQualifiedInterfaceTypes.InsertNode(QType, InsertPos); + ObjCQualifiedInterfaceTypes.InsertNode(QType, InsertPos); return QualType(QType, 0); } -/// getObjcQualifiedIdType - Return a -/// getObjcQualifiedIdType type for the 'id' decl and +/// getObjCQualifiedIdType - Return a +/// getObjCQualifiedIdType type for the 'id' decl and /// the conforming protocol list. -QualType ASTContext::getObjcQualifiedIdType(QualType idType, - ObjcProtocolDecl **Protocols, +QualType ASTContext::getObjCQualifiedIdType(QualType idType, + ObjCProtocolDecl **Protocols, unsigned NumProtocols) { llvm::FoldingSetNodeID ID; - ObjcQualifiedIdType::Profile(ID, Protocols, NumProtocols); + ObjCQualifiedIdType::Profile(ID, Protocols, NumProtocols); void *InsertPos = 0; - if (ObjcQualifiedIdType *QT = - ObjcQualifiedIdTypes.FindNodeOrInsertPos(ID, InsertPos)) + if (ObjCQualifiedIdType *QT = + ObjCQualifiedIdTypes.FindNodeOrInsertPos(ID, InsertPos)) return QualType(QT, 0); // No Match; QualType Canonical; if (!idType->isCanonical()) { - Canonical = getObjcQualifiedIdType(idType.getCanonicalType(), + Canonical = getObjCQualifiedIdType(idType.getCanonicalType(), Protocols, NumProtocols); - ObjcQualifiedIdType *NewQT = - ObjcQualifiedIdTypes.FindNodeOrInsertPos(ID, InsertPos); + ObjCQualifiedIdType *NewQT = + ObjCQualifiedIdTypes.FindNodeOrInsertPos(ID, InsertPos); assert(NewQT == 0 && "Shouldn't be in the map!"); } - ObjcQualifiedIdType *QType = - new ObjcQualifiedIdType(Canonical, Protocols, NumProtocols); + ObjCQualifiedIdType *QType = + new ObjCQualifiedIdType(Canonical, Protocols, NumProtocols); Types.push_back(QType); - ObjcQualifiedIdTypes.InsertNode(QType, InsertPos); + ObjCQualifiedIdTypes.InsertNode(QType, InsertPos); return QualType(QType, 0); } @@ -961,9 +961,9 @@ static bool isTypeTypedefedAsBOOL(QualType T) { return false; } -/// getObjcEncodingTypeSize returns size of type for objective-c encoding +/// getObjCEncodingTypeSize returns size of type for objective-c encoding /// purpose. -int ASTContext::getObjcEncodingTypeSize(QualType type) { +int ASTContext::getObjCEncodingTypeSize(QualType type) { SourceLocation Loc; uint64_t sz = getTypeSize(type, Loc); @@ -976,15 +976,15 @@ int ASTContext::getObjcEncodingTypeSize(QualType type) { return sz / getTypeSize(CharTy, Loc); } -/// getObjcEncodingForMethodDecl - Return the encoded type for this method +/// getObjCEncodingForMethodDecl - Return the encoded type for this method /// declaration. -void ASTContext::getObjcEncodingForMethodDecl(ObjcMethodDecl *Decl, +void ASTContext::getObjCEncodingForMethodDecl(ObjCMethodDecl *Decl, std::string& S) { // Encode type qualifer, 'in', 'inout', etc. for the return type. - getObjcEncodingForTypeQualifier(Decl->getObjcDeclQualifier(), S); + getObjCEncodingForTypeQualifier(Decl->getObjCDeclQualifier(), S); // Encode result type. - getObjcEncodingForType(Decl->getResultType(), S); + getObjCEncodingForType(Decl->getResultType(), S); // Compute size of all parameters. // Start with computing size of a pointer in number of bytes. // FIXME: There might(should) be a better way of doing this computation! @@ -996,8 +996,8 @@ void ASTContext::getObjcEncodingForMethodDecl(ObjcMethodDecl *Decl, int NumOfParams = Decl->getNumParams(); for (int i = 0; i < NumOfParams; i++) { QualType PType = Decl->getParamDecl(i)->getType(); - int sz = getObjcEncodingTypeSize (PType); - assert (sz > 0 && "getObjcEncodingForMethodDecl - Incomplete param type"); + int sz = getObjCEncodingTypeSize (PType); + assert (sz > 0 && "getObjCEncodingForMethodDecl - Incomplete param type"); ParmOffset += sz; } S += llvm::utostr(ParmOffset); @@ -1010,15 +1010,15 @@ void ASTContext::getObjcEncodingForMethodDecl(ObjcMethodDecl *Decl, QualType PType = Decl->getParamDecl(i)->getType(); // Process argument qualifiers for user supplied arguments; such as, // 'in', 'inout', etc. - getObjcEncodingForTypeQualifier( - Decl->getParamDecl(i)->getObjcDeclQualifier(), S); - getObjcEncodingForType(PType, S); + getObjCEncodingForTypeQualifier( + Decl->getParamDecl(i)->getObjCDeclQualifier(), S); + getObjCEncodingForType(PType, S); S += llvm::utostr(ParmOffset); - ParmOffset += getObjcEncodingTypeSize(PType); + ParmOffset += getObjCEncodingTypeSize(PType); } } -void ASTContext::getObjcEncodingForType(QualType T, std::string& S) const +void ASTContext::getObjCEncodingForType(QualType T, std::string& S) const { // FIXME: This currently doesn't encode: // @ An object (whether statically typed or typed id) @@ -1084,20 +1084,20 @@ void ASTContext::getObjcEncodingForType(QualType T, std::string& S) const S += encoding; } - else if (T->isObjcQualifiedIdType()) { + else if (T->isObjCQualifiedIdType()) { // Treat id same as 'id' for encoding purposes. - return getObjcEncodingForType(getObjcIdType(), S); + return getObjCEncodingForType(getObjCIdType(), S); } else if (const PointerType *PT = T->getAsPointerType()) { QualType PointeeTy = PT->getPointeeType(); - if (isObjcIdType(PointeeTy) || PointeeTy->isObjcInterfaceType()) { + if (isObjCIdType(PointeeTy) || PointeeTy->isObjCInterfaceType()) { S += '@'; return; - } else if (isObjcClassType(PointeeTy)) { + } else if (isObjCClassType(PointeeTy)) { S += '#'; return; - } else if (isObjcSelType(PointeeTy)) { + } else if (isObjCSelType(PointeeTy)) { S += ':'; return; } @@ -1112,7 +1112,7 @@ void ASTContext::getObjcEncodingForType(QualType T, std::string& S) const } S += '^'; - getObjcEncodingForType(PT->getPointeeType(), S); + getObjCEncodingForType(PT->getPointeeType(), S); } else if (const ArrayType *AT = T->getAsArrayType()) { S += '['; @@ -1121,7 +1121,7 @@ void ASTContext::getObjcEncodingForType(QualType T, std::string& S) const else assert(0 && "Unhandled array type!"); - getObjcEncodingForType(AT->getElementType(), S); + getObjCEncodingForType(AT->getElementType(), S); S += ']'; } else if (T->getAsFunctionType()) { S += '?'; @@ -1132,7 +1132,7 @@ void ASTContext::getObjcEncodingForType(QualType T, std::string& S) const S += '='; for (int i = 0; i < RDecl->getNumMembers(); i++) { FieldDecl *field = RDecl->getMember(i); - getObjcEncodingForType(field->getType(), S); + getObjCEncodingForType(field->getType(), S); } S += '}'; } else if (T->isEnumeralType()) { @@ -1141,7 +1141,7 @@ void ASTContext::getObjcEncodingForType(QualType T, std::string& S) const assert(0 && "@encode for type not implemented!"); } -void ASTContext::getObjcEncodingForTypeQualifier(Decl::ObjcDeclQualifier QT, +void ASTContext::getObjCEncodingForTypeQualifier(Decl::ObjCDeclQualifier QT, std::string& S) const { if (QT & Decl::OBJC_TQ_In) S += 'n'; @@ -1164,11 +1164,11 @@ void ASTContext::setBuiltinVaListType(QualType T) BuiltinVaListType = T; } -void ASTContext::setObjcIdType(TypedefDecl *TD) +void ASTContext::setObjCIdType(TypedefDecl *TD) { - assert(ObjcIdType.isNull() && "'id' type already set!"); + assert(ObjCIdType.isNull() && "'id' type already set!"); - ObjcIdType = getTypedefType(TD); + ObjCIdType = getTypedefType(TD); // typedef struct objc_object *id; const PointerType *ptr = TD->getUnderlyingType()->getAsPointerType(); @@ -1178,11 +1178,11 @@ void ASTContext::setObjcIdType(TypedefDecl *TD) IdStructType = rec; } -void ASTContext::setObjcSelType(TypedefDecl *TD) +void ASTContext::setObjCSelType(TypedefDecl *TD) { - assert(ObjcSelType.isNull() && "'SEL' type already set!"); + assert(ObjCSelType.isNull() && "'SEL' type already set!"); - ObjcSelType = getTypedefType(TD); + ObjCSelType = getTypedefType(TD); // typedef struct objc_selector *SEL; const PointerType *ptr = TD->getUnderlyingType()->getAsPointerType(); @@ -1192,17 +1192,17 @@ void ASTContext::setObjcSelType(TypedefDecl *TD) SelStructType = rec; } -void ASTContext::setObjcProtoType(QualType QT) +void ASTContext::setObjCProtoType(QualType QT) { - assert(ObjcProtoType.isNull() && "'Protocol' type already set!"); - ObjcProtoType = QT; + assert(ObjCProtoType.isNull() && "'Protocol' type already set!"); + ObjCProtoType = QT; } -void ASTContext::setObjcClassType(TypedefDecl *TD) +void ASTContext::setObjCClassType(TypedefDecl *TD) { - assert(ObjcClassType.isNull() && "'Class' type already set!"); + assert(ObjCClassType.isNull() && "'Class' type already set!"); - ObjcClassType = getTypedefType(TD); + ObjCClassType = getTypedefType(TD); // typedef struct objc_class *Class; const PointerType *ptr = TD->getUnderlyingType()->getAsPointerType(); @@ -1212,11 +1212,11 @@ void ASTContext::setObjcClassType(TypedefDecl *TD) ClassStructType = rec; } -void ASTContext::setObjcConstantStringInterface(ObjcInterfaceDecl *Decl) { - assert(ObjcConstantStringType.isNull() && +void ASTContext::setObjCConstantStringInterface(ObjCInterfaceDecl *Decl) { + assert(ObjCConstantStringType.isNull() && "'NSConstantString' type already set!"); - ObjcConstantStringType = getObjcInterfaceType(Decl); + ObjCConstantStringType = getObjCInterfaceType(Decl); } bool ASTContext::builtinTypesAreCompatible(QualType lhs, QualType rhs) { @@ -1231,20 +1231,20 @@ bool ASTContext::builtinTypesAreCompatible(QualType lhs, QualType rhs) { /// a qualified interface type and the other type is of a different class. /// Example, II or II

. bool ASTContext::objcTypesAreCompatible(QualType lhs, QualType rhs) { - if (lhs->isObjcInterfaceType() && isObjcIdType(rhs)) + if (lhs->isObjCInterfaceType() && isObjCIdType(rhs)) return true; - else if (isObjcIdType(lhs) && rhs->isObjcInterfaceType()) + else if (isObjCIdType(lhs) && rhs->isObjCInterfaceType()) return true; - if (ObjcInterfaceType *lhsIT = - dyn_cast(lhs.getCanonicalType().getTypePtr())) { - ObjcQualifiedInterfaceType *rhsQI = - dyn_cast(rhs.getCanonicalType().getTypePtr()); + if (ObjCInterfaceType *lhsIT = + dyn_cast(lhs.getCanonicalType().getTypePtr())) { + ObjCQualifiedInterfaceType *rhsQI = + dyn_cast(rhs.getCanonicalType().getTypePtr()); return rhsQI && (lhsIT->getDecl() == rhsQI->getDecl()); } - else if (ObjcInterfaceType *rhsIT = - dyn_cast(rhs.getCanonicalType().getTypePtr())) { - ObjcQualifiedInterfaceType *lhsQI = - dyn_cast(lhs.getCanonicalType().getTypePtr()); + else if (ObjCInterfaceType *rhsIT = + dyn_cast(rhs.getCanonicalType().getTypePtr())) { + ObjCQualifiedInterfaceType *lhsQI = + dyn_cast(lhs.getCanonicalType().getTypePtr()); return lhsQI && (rhsIT->getDecl() == lhsQI->getDecl()); } return false; @@ -1253,10 +1253,10 @@ bool ASTContext::objcTypesAreCompatible(QualType lhs, QualType rhs) { bool ASTContext::interfaceTypesAreCompatible(QualType lhs, QualType rhs) { if (lhs == rhs) return true; - ObjcInterfaceType *lhsIT = cast(lhs.getTypePtr()); - ObjcInterfaceType *rhsIT = cast(rhs.getTypePtr()); - ObjcInterfaceDecl *rhsIDecl = rhsIT->getDecl(); - ObjcInterfaceDecl *lhsIDecl = lhsIT->getDecl(); + ObjCInterfaceType *lhsIT = cast(lhs.getTypePtr()); + ObjCInterfaceType *rhsIT = cast(rhs.getTypePtr()); + ObjCInterfaceDecl *rhsIDecl = rhsIT->getDecl(); + ObjCInterfaceDecl *lhsIDecl = lhsIT->getDecl(); // rhs is derived from lhs it is OK; else it is not OK. while (rhsIDecl != NULL) { if (rhsIDecl == lhsIDecl) @@ -1268,21 +1268,21 @@ bool ASTContext::interfaceTypesAreCompatible(QualType lhs, QualType rhs) { bool ASTContext::QualifiedInterfaceTypesAreCompatible(QualType lhs, QualType rhs) { - ObjcQualifiedInterfaceType *lhsQI = - dyn_cast(lhs.getCanonicalType().getTypePtr()); + ObjCQualifiedInterfaceType *lhsQI = + dyn_cast(lhs.getCanonicalType().getTypePtr()); assert(lhsQI && "QualifiedInterfaceTypesAreCompatible - bad lhs type"); - ObjcQualifiedInterfaceType *rhsQI = - dyn_cast(rhs.getCanonicalType().getTypePtr()); + ObjCQualifiedInterfaceType *rhsQI = + dyn_cast(rhs.getCanonicalType().getTypePtr()); assert(rhsQI && "QualifiedInterfaceTypesAreCompatible - bad rhs type"); - if (!interfaceTypesAreCompatible(getObjcInterfaceType(lhsQI->getDecl()), - getObjcInterfaceType(rhsQI->getDecl()))) + if (!interfaceTypesAreCompatible(getObjCInterfaceType(lhsQI->getDecl()), + getObjCInterfaceType(rhsQI->getDecl()))) return false; /* All protocols in lhs must have a presense in rhs. */ for (unsigned i =0; i < lhsQI->getNumProtocols(); i++) { bool match = false; - ObjcProtocolDecl *lhsProto = lhsQI->getProtocols(i); + ObjCProtocolDecl *lhsProto = lhsQI->getProtocols(i); for (unsigned j = 0; j < rhsQI->getNumProtocols(); j++) { - ObjcProtocolDecl *rhsProto = rhsQI->getProtocols(j); + ObjCProtocolDecl *rhsProto = rhsQI->getProtocols(j); if (lhsProto == rhsProto) { match = true; break; @@ -1296,11 +1296,11 @@ bool ASTContext::QualifiedInterfaceTypesAreCompatible(QualType lhs, /// ProtocolCompatibleWithProtocol - return 'true' if 'lProto' is in the /// inheritance hierarchy of 'rProto'. -static bool ProtocolCompatibleWithProtocol(ObjcProtocolDecl *lProto, - ObjcProtocolDecl *rProto) { +static bool ProtocolCompatibleWithProtocol(ObjCProtocolDecl *lProto, + ObjCProtocolDecl *rProto) { if (lProto == rProto) return true; - ObjcProtocolDecl** RefPDecl = rProto->getReferencedProtocols(); + ObjCProtocolDecl** RefPDecl = rProto->getReferencedProtocols(); for (unsigned i = 0; i < rProto->getNumReferencedProtocols(); i++) if (ProtocolCompatibleWithProtocol(lProto, RefPDecl[i])) return true; @@ -1310,12 +1310,12 @@ static bool ProtocolCompatibleWithProtocol(ObjcProtocolDecl *lProto, /// ClassImplementsProtocol - Checks that 'lProto' protocol /// has been implemented in IDecl class, its super class or categories (if /// lookupCategory is true). -static bool ClassImplementsProtocol(ObjcProtocolDecl *lProto, - ObjcInterfaceDecl *IDecl, +static bool ClassImplementsProtocol(ObjCProtocolDecl *lProto, + ObjCInterfaceDecl *IDecl, bool lookupCategory) { // 1st, look up the class. - ObjcProtocolDecl **protoList = IDecl->getReferencedProtocols(); + ObjCProtocolDecl **protoList = IDecl->getReferencedProtocols(); for (unsigned i = 0; i < IDecl->getNumIntfRefProtocols(); i++) { if (ProtocolCompatibleWithProtocol(lProto, protoList[i])) return true; @@ -1323,7 +1323,7 @@ static bool ClassImplementsProtocol(ObjcProtocolDecl *lProto, // 2nd, look up the category. if (lookupCategory) - for (ObjcCategoryDecl *CDecl = IDecl->getCategoryList(); CDecl; + for (ObjCCategoryDecl *CDecl = IDecl->getCategoryList(); CDecl; CDecl = CDecl->getNextClassCategory()) { protoList = CDecl->getReferencedProtocols(); for (unsigned i = 0; i < CDecl->getNumReferencedProtocols(); i++) { @@ -1340,42 +1340,42 @@ static bool ClassImplementsProtocol(ObjcProtocolDecl *lProto, return false; } -/// ObjcQualifiedIdTypesAreCompatible - Compares two types, at least +/// ObjCQualifiedIdTypesAreCompatible - Compares two types, at least /// one of which is a protocol qualified 'id' type. When 'compare' /// is true it is for comparison; when false, for assignment/initialization. -bool ASTContext::ObjcQualifiedIdTypesAreCompatible(QualType lhs, +bool ASTContext::ObjCQualifiedIdTypesAreCompatible(QualType lhs, QualType rhs, bool compare) { // match id with an 'id' type in all cases. if (const PointerType *PT = lhs->getAsPointerType()) { QualType PointeeTy = PT->getPointeeType(); - if (isObjcIdType(PointeeTy) || PointeeTy->isVoidType()) + if (isObjCIdType(PointeeTy) || PointeeTy->isVoidType()) return true; } else if (const PointerType *PT = rhs->getAsPointerType()) { QualType PointeeTy = PT->getPointeeType(); - if (isObjcIdType(PointeeTy) || PointeeTy->isVoidType()) + if (isObjCIdType(PointeeTy) || PointeeTy->isVoidType()) return true; } - ObjcQualifiedInterfaceType *lhsQI = 0; - ObjcQualifiedInterfaceType *rhsQI = 0; - ObjcInterfaceDecl *lhsID = 0; - ObjcInterfaceDecl *rhsID = 0; - ObjcQualifiedIdType *lhsQID = dyn_cast(lhs); - ObjcQualifiedIdType *rhsQID = dyn_cast(rhs); + ObjCQualifiedInterfaceType *lhsQI = 0; + ObjCQualifiedInterfaceType *rhsQI = 0; + ObjCInterfaceDecl *lhsID = 0; + ObjCInterfaceDecl *rhsID = 0; + ObjCQualifiedIdType *lhsQID = dyn_cast(lhs); + ObjCQualifiedIdType *rhsQID = dyn_cast(rhs); if (lhsQID) { if (!rhsQID && rhs->getTypeClass() == Type::Pointer) { QualType rtype = cast(rhs.getCanonicalType())->getPointeeType(); rhsQI = - dyn_cast( + dyn_cast( rtype.getCanonicalType().getTypePtr()); if (!rhsQI) { - ObjcInterfaceType *IT = dyn_cast( + ObjCInterfaceType *IT = dyn_cast( rtype.getCanonicalType().getTypePtr()); if (IT) rhsID = IT->getDecl(); @@ -1385,7 +1385,7 @@ bool ASTContext::ObjcQualifiedIdTypesAreCompatible(QualType lhs, return false; unsigned numRhsProtocols = 0; - ObjcProtocolDecl **rhsProtoList = 0; + ObjCProtocolDecl **rhsProtoList = 0; if (rhsQI) { numRhsProtocols = rhsQI->getNumProtocols(); rhsProtoList = rhsQI->getReferencedProtocols(); @@ -1396,7 +1396,7 @@ bool ASTContext::ObjcQualifiedIdTypesAreCompatible(QualType lhs, } for (unsigned i =0; i < lhsQID->getNumProtocols(); i++) { - ObjcProtocolDecl *lhsProto = lhsQID->getProtocols(i); + ObjCProtocolDecl *lhsProto = lhsQID->getProtocols(i); bool match = false; // when comparing an id

on lhs with a static type on rhs, @@ -1407,7 +1407,7 @@ bool ASTContext::ObjcQualifiedIdTypesAreCompatible(QualType lhs, match = true; } else for (unsigned j = 0; j < numRhsProtocols; j++) { - ObjcProtocolDecl *rhsProto = rhsProtoList[j]; + ObjCProtocolDecl *rhsProto = rhsProtoList[j]; if (ProtocolCompatibleWithProtocol(lhsProto, rhsProto) || compare && ProtocolCompatibleWithProtocol(rhsProto, lhsProto)) { match = true; @@ -1423,10 +1423,10 @@ bool ASTContext::ObjcQualifiedIdTypesAreCompatible(QualType lhs, QualType ltype = cast(lhs.getCanonicalType())->getPointeeType(); lhsQI = - dyn_cast( + dyn_cast( ltype.getCanonicalType().getTypePtr()); if (!lhsQI) { - ObjcInterfaceType *IT = dyn_cast( + ObjCInterfaceType *IT = dyn_cast( ltype.getCanonicalType().getTypePtr()); if (IT) lhsID = IT->getDecl(); @@ -1436,7 +1436,7 @@ bool ASTContext::ObjcQualifiedIdTypesAreCompatible(QualType lhs, return false; unsigned numLhsProtocols = 0; - ObjcProtocolDecl **lhsProtoList = 0; + ObjCProtocolDecl **lhsProtoList = 0; if (lhsQI) { numLhsProtocols = lhsQI->getNumProtocols(); lhsProtoList = lhsQI->getReferencedProtocols(); @@ -1450,7 +1450,7 @@ bool ASTContext::ObjcQualifiedIdTypesAreCompatible(QualType lhs, // one of 'id's protocols. if (lhsID) { for (unsigned j = 0; j < rhsQID->getNumProtocols(); j++) { - ObjcProtocolDecl *rhsProto = rhsQID->getProtocols(j); + ObjCProtocolDecl *rhsProto = rhsQID->getProtocols(j); if (ClassImplementsProtocol(rhsProto, lhsID, compare)) { match = true; break; @@ -1459,9 +1459,9 @@ bool ASTContext::ObjcQualifiedIdTypesAreCompatible(QualType lhs, } else for (unsigned i =0; i < numLhsProtocols; i++) { match = false; - ObjcProtocolDecl *lhsProto = lhsProtoList[i]; + ObjCProtocolDecl *lhsProto = lhsProtoList[i]; for (unsigned j = 0; j < rhsQID->getNumProtocols(); j++) { - ObjcProtocolDecl *rhsProto = rhsQID->getProtocols(j); + ObjCProtocolDecl *rhsProto = rhsQID->getProtocols(j); if (ProtocolCompatibleWithProtocol(lhsProto, rhsProto) || compare && ProtocolCompatibleWithProtocol(rhsProto, lhsProto)) { match = true; @@ -1501,8 +1501,8 @@ bool ASTContext::tagTypesAreCompatible(QualType lhs, QualType rhs) { return true; } // "Class" and "id" are compatible built-in structure types. - if (isObjcIdType(lhs) && isObjcClassType(rhs) || - isObjcClassType(lhs) && isObjcIdType(rhs)) + if (isObjCIdType(lhs) && isObjCClassType(rhs) || + isObjCClassType(lhs) && isObjCIdType(rhs)) return true; return false; } @@ -1616,7 +1616,7 @@ bool ASTContext::typesAreCompatible(QualType lhs, QualType rhs) { // For Objective-C, it is possible for two types to be compatible // when their classes don't match (when dealing with "id"). If either type // is an interface, we defer to objcTypesAreCompatible(). - if (lcanon->isObjcInterfaceType() || rcanon->isObjcInterfaceType()) + if (lcanon->isObjCInterfaceType() || rcanon->isObjCInterfaceType()) return objcTypesAreCompatible(lcanon, rcanon); return false; } @@ -1633,12 +1633,12 @@ bool ASTContext::typesAreCompatible(QualType lhs, QualType rhs) { return tagTypesAreCompatible(lcanon, rcanon); case Type::Builtin: return builtinTypesAreCompatible(lcanon, rcanon); - case Type::ObjcInterface: + case Type::ObjCInterface: return interfaceTypesAreCompatible(lcanon, rcanon); case Type::Vector: case Type::OCUVector: return vectorTypesAreCompatible(lcanon, rcanon); - case Type::ObjcQualifiedInterface: + case Type::ObjCQualifiedInterface: return QualifiedInterfaceTypesAreCompatible(lcanon, rcanon); default: assert(0 && "unexpected type"); diff --git a/AST/Decl.cpp b/AST/Decl.cpp index a69d6dd142..f67d7124f5 100644 --- a/AST/Decl.cpp +++ b/AST/Decl.cpp @@ -33,10 +33,10 @@ static unsigned nProtocolDecls = 0; static unsigned nForwardProtocolDecls = 0; static unsigned nCategoryDecls = 0; static unsigned nIvarDecls = 0; -static unsigned nObjcImplementationDecls = 0; -static unsigned nObjcCategoryImpl = 0; -static unsigned nObjcCompatibleAlias = 0; -static unsigned nObjcPropertyDecl = 0; +static unsigned nObjCImplementationDecls = 0; +static unsigned nObjCCategoryImpl = 0; +static unsigned nObjCCompatibleAlias = 0; +static unsigned nObjCPropertyDecl = 0; static bool StatSwitch = false; @@ -55,16 +55,16 @@ const char *Decl::getDeclKindName() const { return "ParmVar"; case EnumConstant: return "EnumConstant"; - case ObjcInterface: - return "ObjcInterface"; - case ObjcClass: - return "ObjcClass"; - case ObjcMethod: - return "ObjcMethod"; - case ObjcProtocol: - return "ObjcProtocol"; - case ObjcForwardProtocol: - return "ObjcForwardProtocol"; + case ObjCInterface: + return "ObjCInterface"; + case ObjCClass: + return "ObjCClass"; + case ObjCMethod: + return "ObjCMethod"; + case ObjCProtocol: + return "ObjCProtocol"; + case ObjCForwardProtocol: + return "ObjCForwardProtocol"; case Struct: return "Struct"; case Union: @@ -114,49 +114,49 @@ void Decl::PrintStats() { nTypedef, (int)sizeof(TypedefDecl),int(nTypedef*sizeof(TypedefDecl))); // Objective-C decls... fprintf(stderr, " %d interface decls, %d each (%d bytes)\n", - nInterfaceDecls, (int)sizeof(ObjcInterfaceDecl), - int(nInterfaceDecls*sizeof(ObjcInterfaceDecl))); + nInterfaceDecls, (int)sizeof(ObjCInterfaceDecl), + int(nInterfaceDecls*sizeof(ObjCInterfaceDecl))); fprintf(stderr, " %d instance variable decls, %d each (%d bytes)\n", - nIvarDecls, (int)sizeof(ObjcIvarDecl), - int(nIvarDecls*sizeof(ObjcIvarDecl))); + nIvarDecls, (int)sizeof(ObjCIvarDecl), + int(nIvarDecls*sizeof(ObjCIvarDecl))); fprintf(stderr, " %d class decls, %d each (%d bytes)\n", - nClassDecls, (int)sizeof(ObjcClassDecl), - int(nClassDecls*sizeof(ObjcClassDecl))); + nClassDecls, (int)sizeof(ObjCClassDecl), + int(nClassDecls*sizeof(ObjCClassDecl))); fprintf(stderr, " %d method decls, %d each (%d bytes)\n", - nMethodDecls, (int)sizeof(ObjcMethodDecl), - int(nMethodDecls*sizeof(ObjcMethodDecl))); + nMethodDecls, (int)sizeof(ObjCMethodDecl), + int(nMethodDecls*sizeof(ObjCMethodDecl))); fprintf(stderr, " %d protocol decls, %d each (%d bytes)\n", - nProtocolDecls, (int)sizeof(ObjcProtocolDecl), - int(nProtocolDecls*sizeof(ObjcProtocolDecl))); + nProtocolDecls, (int)sizeof(ObjCProtocolDecl), + int(nProtocolDecls*sizeof(ObjCProtocolDecl))); fprintf(stderr, " %d forward protocol decls, %d each (%d bytes)\n", - nForwardProtocolDecls, (int)sizeof(ObjcForwardProtocolDecl), - int(nForwardProtocolDecls*sizeof(ObjcForwardProtocolDecl))); + nForwardProtocolDecls, (int)sizeof(ObjCForwardProtocolDecl), + int(nForwardProtocolDecls*sizeof(ObjCForwardProtocolDecl))); fprintf(stderr, " %d category decls, %d each (%d bytes)\n", - nCategoryDecls, (int)sizeof(ObjcCategoryDecl), - int(nCategoryDecls*sizeof(ObjcCategoryDecl))); + nCategoryDecls, (int)sizeof(ObjCCategoryDecl), + int(nCategoryDecls*sizeof(ObjCCategoryDecl))); fprintf(stderr, " %d class implementation decls, %d each (%d bytes)\n", - nObjcImplementationDecls, (int)sizeof(ObjcImplementationDecl), - int(nObjcImplementationDecls*sizeof(ObjcImplementationDecl))); + nObjCImplementationDecls, (int)sizeof(ObjCImplementationDecl), + int(nObjCImplementationDecls*sizeof(ObjCImplementationDecl))); fprintf(stderr, " %d class implementation decls, %d each (%d bytes)\n", - nObjcCategoryImpl, (int)sizeof(ObjcCategoryImplDecl), - int(nObjcCategoryImpl*sizeof(ObjcCategoryImplDecl))); + nObjCCategoryImpl, (int)sizeof(ObjCCategoryImplDecl), + int(nObjCCategoryImpl*sizeof(ObjCCategoryImplDecl))); fprintf(stderr, " %d compatibility alias decls, %d each (%d bytes)\n", - nObjcCompatibleAlias, (int)sizeof(ObjcCompatibleAliasDecl), - int(nObjcCompatibleAlias*sizeof(ObjcCompatibleAliasDecl))); + nObjCCompatibleAlias, (int)sizeof(ObjCCompatibleAliasDecl), + int(nObjCCompatibleAlias*sizeof(ObjCCompatibleAliasDecl))); fprintf(stderr, " %d property decls, %d each (%d bytes)\n", - nObjcPropertyDecl, (int)sizeof(ObjcPropertyDecl), - int(nObjcPropertyDecl*sizeof(ObjcPropertyDecl))); + nObjCPropertyDecl, (int)sizeof(ObjCPropertyDecl), + int(nObjCPropertyDecl*sizeof(ObjCPropertyDecl))); fprintf(stderr, "Total bytes = %d\n", int(nFuncs*sizeof(FunctionDecl)+nBlockVars*sizeof(BlockVarDecl)+ nFileVars*sizeof(FileVarDecl)+nParmVars*sizeof(ParmVarDecl)+ nFieldDecls*sizeof(FieldDecl)+nSUC*sizeof(RecordDecl)+ nEnumDecls*sizeof(EnumDecl)+nEnumConst*sizeof(EnumConstantDecl)+ - nTypedef*sizeof(TypedefDecl)) /* FIXME: add Objc decls */); + nTypedef*sizeof(TypedefDecl)) /* FIXME: add ObjC decls */); } void Decl::addDeclKind(const Kind k) { @@ -190,38 +190,38 @@ void Decl::addDeclKind(const Kind k) { case Enum: nEnumDecls++; break; - case ObjcInterface: + case ObjCInterface: nInterfaceDecls++; break; - case ObjcClass: + case ObjCClass: nClassDecls++; break; - case ObjcMethod: + case ObjCMethod: nMethodDecls++; break; - case ObjcProtocol: + case ObjCProtocol: nProtocolDecls++; break; - case ObjcForwardProtocol: + case ObjCForwardProtocol: nForwardProtocolDecls++; break; - case ObjcCategory: + case ObjCCategory: nCategoryDecls++; break; - case ObjcIvar: + case ObjCIvar: nIvarDecls++; break; - case ObjcImplementation: - nObjcImplementationDecls++; + case ObjCImplementation: + nObjCImplementationDecls++; break; - case ObjcCategoryImpl: - nObjcCategoryImpl++; + case ObjCCategoryImpl: + nObjCCategoryImpl++; break; case CompatibleAlias: - nObjcCompatibleAlias++; + nObjCCompatibleAlias++; break; case PropertyDecl: - nObjcPropertyDecl++; + nObjCPropertyDecl++; break; } } @@ -283,7 +283,7 @@ FieldDecl* RecordDecl::getMember(IdentifierInfo *name) { return 0; } -void ObjcMethodDecl::setMethodParams(ParmVarDecl **NewParamInfo, +void ObjCMethodDecl::setMethodParams(ParmVarDecl **NewParamInfo, unsigned NumParams) { assert(ParamInfo == 0 && "Already has param info!"); @@ -295,103 +295,103 @@ void ObjcMethodDecl::setMethodParams(ParmVarDecl **NewParamInfo, } } -ObjcMethodDecl::~ObjcMethodDecl() { +ObjCMethodDecl::~ObjCMethodDecl() { delete[] ParamInfo; } -/// ObjcAddInstanceVariablesToClass - Inserts instance variables -/// into ObjcInterfaceDecl's fields. +/// ObjCAddInstanceVariablesToClass - Inserts instance variables +/// into ObjCInterfaceDecl's fields. /// -void ObjcInterfaceDecl::addInstanceVariablesToClass(ObjcIvarDecl **ivars, +void ObjCInterfaceDecl::addInstanceVariablesToClass(ObjCIvarDecl **ivars, unsigned numIvars, SourceLocation RBrac) { NumIvars = numIvars; if (numIvars) { - Ivars = new ObjcIvarDecl*[numIvars]; - memcpy(Ivars, ivars, numIvars*sizeof(ObjcIvarDecl*)); + Ivars = new ObjCIvarDecl*[numIvars]; + memcpy(Ivars, ivars, numIvars*sizeof(ObjCIvarDecl*)); } setLocEnd(RBrac); } -/// ObjcAddInstanceVariablesToClassImpl - Checks for correctness of Instance +/// ObjCAddInstanceVariablesToClassImpl - Checks for correctness of Instance /// Variables (Ivars) relative to what declared in @implementation;s class. -/// Ivars into ObjcImplementationDecl's fields. +/// Ivars into ObjCImplementationDecl's fields. /// -void ObjcImplementationDecl::ObjcAddInstanceVariablesToClassImpl( - ObjcIvarDecl **ivars, unsigned numIvars) { +void ObjCImplementationDecl::ObjCAddInstanceVariablesToClassImpl( + ObjCIvarDecl **ivars, unsigned numIvars) { NumIvars = numIvars; if (numIvars) { - Ivars = new ObjcIvarDecl*[numIvars]; - memcpy(Ivars, ivars, numIvars*sizeof(ObjcIvarDecl*)); + Ivars = new ObjCIvarDecl*[numIvars]; + memcpy(Ivars, ivars, numIvars*sizeof(ObjCIvarDecl*)); } } /// addMethods - Insert instance and methods declarations into -/// ObjcInterfaceDecl's InsMethods and ClsMethods fields. +/// ObjCInterfaceDecl's InsMethods and ClsMethods fields. /// -void ObjcInterfaceDecl::addMethods(ObjcMethodDecl **insMethods, +void ObjCInterfaceDecl::addMethods(ObjCMethodDecl **insMethods, unsigned numInsMembers, - ObjcMethodDecl **clsMethods, + ObjCMethodDecl **clsMethods, unsigned numClsMembers, SourceLocation endLoc) { NumInstanceMethods = numInsMembers; if (numInsMembers) { - InstanceMethods = new ObjcMethodDecl*[numInsMembers]; - memcpy(InstanceMethods, insMethods, numInsMembers*sizeof(ObjcMethodDecl*)); + InstanceMethods = new ObjCMethodDecl*[numInsMembers]; + memcpy(InstanceMethods, insMethods, numInsMembers*sizeof(ObjCMethodDecl*)); } NumClassMethods = numClsMembers; if (numClsMembers) { - ClassMethods = new ObjcMethodDecl*[numClsMembers]; - memcpy(ClassMethods, clsMethods, numClsMembers*sizeof(ObjcMethodDecl*)); + ClassMethods = new ObjCMethodDecl*[numClsMembers]; + memcpy(ClassMethods, clsMethods, numClsMembers*sizeof(ObjCMethodDecl*)); } AtEndLoc = endLoc; } /// addMethods - Insert instance and methods declarations into -/// ObjcProtocolDecl's ProtoInsMethods and ProtoClsMethods fields. +/// ObjCProtocolDecl's ProtoInsMethods and ProtoClsMethods fields. /// -void ObjcProtocolDecl::addMethods(ObjcMethodDecl **insMethods, +void ObjCProtocolDecl::addMethods(ObjCMethodDecl **insMethods, unsigned numInsMembers, - ObjcMethodDecl **clsMethods, + ObjCMethodDecl **clsMethods, unsigned numClsMembers, SourceLocation endLoc) { NumInstanceMethods = numInsMembers; if (numInsMembers) { - InstanceMethods = new ObjcMethodDecl*[numInsMembers]; - memcpy(InstanceMethods, insMethods, numInsMembers*sizeof(ObjcMethodDecl*)); + InstanceMethods = new ObjCMethodDecl*[numInsMembers]; + memcpy(InstanceMethods, insMethods, numInsMembers*sizeof(ObjCMethodDecl*)); } NumClassMethods = numClsMembers; if (numClsMembers) { - ClassMethods = new ObjcMethodDecl*[numClsMembers]; - memcpy(ClassMethods, clsMethods, numClsMembers*sizeof(ObjcMethodDecl*)); + ClassMethods = new ObjCMethodDecl*[numClsMembers]; + memcpy(ClassMethods, clsMethods, numClsMembers*sizeof(ObjCMethodDecl*)); } AtEndLoc = endLoc; } /// addMethods - Insert instance and methods declarations into -/// ObjcCategoryDecl's CatInsMethods and CatClsMethods fields. +/// ObjCCategoryDecl's CatInsMethods and CatClsMethods fields. /// -void ObjcCategoryDecl::addMethods(ObjcMethodDecl **insMethods, +void ObjCCategoryDecl::addMethods(ObjCMethodDecl **insMethods, unsigned numInsMembers, - ObjcMethodDecl **clsMethods, + ObjCMethodDecl **clsMethods, unsigned numClsMembers, SourceLocation endLoc) { NumInstanceMethods = numInsMembers; if (numInsMembers) { - InstanceMethods = new ObjcMethodDecl*[numInsMembers]; - memcpy(InstanceMethods, insMethods, numInsMembers*sizeof(ObjcMethodDecl*)); + InstanceMethods = new ObjCMethodDecl*[numInsMembers]; + memcpy(InstanceMethods, insMethods, numInsMembers*sizeof(ObjCMethodDecl*)); } NumClassMethods = numClsMembers; if (numClsMembers) { - ClassMethods = new ObjcMethodDecl*[numClsMembers]; - memcpy(ClassMethods, clsMethods, numClsMembers*sizeof(ObjcMethodDecl*)); + ClassMethods = new ObjCMethodDecl*[numClsMembers]; + memcpy(ClassMethods, clsMethods, numClsMembers*sizeof(ObjCMethodDecl*)); } AtEndLoc = endLoc; } -ObjcIvarDecl *ObjcInterfaceDecl::lookupInstanceVariable( - IdentifierInfo *ID, ObjcInterfaceDecl *&clsDeclared) { - ObjcInterfaceDecl* ClassDecl = this; +ObjCIvarDecl *ObjCInterfaceDecl::lookupInstanceVariable( + IdentifierInfo *ID, ObjCInterfaceDecl *&clsDeclared) { + ObjCInterfaceDecl* ClassDecl = this; while (ClassDecl != NULL) { for (ivar_iterator I = ClassDecl->ivar_begin(), E = ClassDecl->ivar_end(); I != E; ++I) { @@ -407,23 +407,23 @@ ObjcIvarDecl *ObjcInterfaceDecl::lookupInstanceVariable( /// lookupInstanceMethod - This method returns an instance method by looking in /// the class, its categories, and its super classes (using a linear search). -ObjcMethodDecl *ObjcInterfaceDecl::lookupInstanceMethod(Selector Sel) { - ObjcInterfaceDecl* ClassDecl = this; - ObjcMethodDecl *MethodDecl = 0; +ObjCMethodDecl *ObjCInterfaceDecl::lookupInstanceMethod(Selector Sel) { + ObjCInterfaceDecl* ClassDecl = this; + ObjCMethodDecl *MethodDecl = 0; while (ClassDecl != NULL) { if ((MethodDecl = ClassDecl->getInstanceMethod(Sel))) return MethodDecl; // Didn't find one yet - look through protocols. - ObjcProtocolDecl **protocols = ClassDecl->getReferencedProtocols(); + ObjCProtocolDecl **protocols = ClassDecl->getReferencedProtocols(); int numProtocols = ClassDecl->getNumIntfRefProtocols(); for (int pIdx = 0; pIdx < numProtocols; pIdx++) { if ((MethodDecl = protocols[pIdx]->getInstanceMethod(Sel))) return MethodDecl; } // Didn't find one yet - now look through categories. - ObjcCategoryDecl *CatDecl = ClassDecl->getCategoryList(); + ObjCCategoryDecl *CatDecl = ClassDecl->getCategoryList(); while (CatDecl) { if ((MethodDecl = CatDecl->getInstanceMethod(Sel))) return MethodDecl; @@ -436,23 +436,23 @@ ObjcMethodDecl *ObjcInterfaceDecl::lookupInstanceMethod(Selector Sel) { // lookupClassMethod - This method returns a class method by looking in the // class, its categories, and its super classes (using a linear search). -ObjcMethodDecl *ObjcInterfaceDecl::lookupClassMethod(Selector Sel) { - ObjcInterfaceDecl* ClassDecl = this; - ObjcMethodDecl *MethodDecl = 0; +ObjCMethodDecl *ObjCInterfaceDecl::lookupClassMethod(Selector Sel) { + ObjCInterfaceDecl* ClassDecl = this; + ObjCMethodDecl *MethodDecl = 0; while (ClassDecl != NULL) { if ((MethodDecl = ClassDecl->getClassMethod(Sel))) return MethodDecl; // Didn't find one yet - look through protocols. - ObjcProtocolDecl **protocols = ClassDecl->getReferencedProtocols(); + ObjCProtocolDecl **protocols = ClassDecl->getReferencedProtocols(); int numProtocols = ClassDecl->getNumIntfRefProtocols(); for (int pIdx = 0; pIdx < numProtocols; pIdx++) { if ((MethodDecl = protocols[pIdx]->getClassMethod(Sel))) return MethodDecl; } // Didn't find one yet - now look through categories. - ObjcCategoryDecl *CatDecl = ClassDecl->getCategoryList(); + ObjCCategoryDecl *CatDecl = ClassDecl->getCategoryList(); while (CatDecl) { if ((MethodDecl = CatDecl->getClassMethod(Sel))) return MethodDecl; @@ -466,7 +466,7 @@ ObjcMethodDecl *ObjcInterfaceDecl::lookupClassMethod(Selector Sel) { /// lookupInstanceMethod - This method returns an instance method by looking in /// the class implementation. Unlike interfaces, we don't look outside the /// implementation. -ObjcMethodDecl *ObjcImplementationDecl::getInstanceMethod(Selector Sel) { +ObjCMethodDecl *ObjCImplementationDecl::getInstanceMethod(Selector Sel) { for (instmeth_iterator I = instmeth_begin(), E = instmeth_end(); I != E; ++I) if ((*I)->getSelector() == Sel) return *I; @@ -476,7 +476,7 @@ ObjcMethodDecl *ObjcImplementationDecl::getInstanceMethod(Selector Sel) { /// lookupClassMethod - This method returns a class method by looking in /// the class implementation. Unlike interfaces, we don't look outside the /// implementation. -ObjcMethodDecl *ObjcImplementationDecl::getClassMethod(Selector Sel) { +ObjCMethodDecl *ObjCImplementationDecl::getClassMethod(Selector Sel) { for (classmeth_iterator I = classmeth_begin(), E = classmeth_end(); I != E; ++I) if ((*I)->getSelector() == Sel) @@ -487,7 +487,7 @@ ObjcMethodDecl *ObjcImplementationDecl::getClassMethod(Selector Sel) { // lookupInstanceMethod - This method returns an instance method by looking in // the class implementation. Unlike interfaces, we don't look outside the // implementation. -ObjcMethodDecl *ObjcCategoryImplDecl::getInstanceMethod(Selector Sel) { +ObjCMethodDecl *ObjCCategoryImplDecl::getInstanceMethod(Selector Sel) { for (instmeth_iterator I = instmeth_begin(), E = instmeth_end(); I != E; ++I) if ((*I)->getSelector() == Sel) return *I; @@ -497,7 +497,7 @@ ObjcMethodDecl *ObjcCategoryImplDecl::getInstanceMethod(Selector Sel) { // lookupClassMethod - This method returns an instance method by looking in // the class implementation. Unlike interfaces, we don't look outside the // implementation. -ObjcMethodDecl *ObjcCategoryImplDecl::getClassMethod(Selector Sel) { +ObjCMethodDecl *ObjCCategoryImplDecl::getClassMethod(Selector Sel) { for (classmeth_iterator I = classmeth_begin(), E = classmeth_end(); I != E; ++I) if ((*I)->getSelector() == Sel) @@ -507,14 +507,14 @@ ObjcMethodDecl *ObjcCategoryImplDecl::getClassMethod(Selector Sel) { // lookupInstanceMethod - Lookup a instance method in the protocol and protocols // it inherited. -ObjcMethodDecl *ObjcProtocolDecl::lookupInstanceMethod(Selector Sel) { - ObjcMethodDecl *MethodDecl = NULL; +ObjCMethodDecl *ObjCProtocolDecl::lookupInstanceMethod(Selector Sel) { + ObjCMethodDecl *MethodDecl = NULL; if ((MethodDecl = getInstanceMethod(Sel))) return MethodDecl; if (getNumReferencedProtocols() > 0) { - ObjcProtocolDecl **RefPDecl = getReferencedProtocols(); + ObjCProtocolDecl **RefPDecl = getReferencedProtocols(); for (unsigned i = 0; i < getNumReferencedProtocols(); i++) { if ((MethodDecl = RefPDecl[i]->getInstanceMethod(Sel))) @@ -526,14 +526,14 @@ ObjcMethodDecl *ObjcProtocolDecl::lookupInstanceMethod(Selector Sel) { // lookupInstanceMethod - Lookup a class method in the protocol and protocols // it inherited. -ObjcMethodDecl *ObjcProtocolDecl::lookupClassMethod(Selector Sel) { - ObjcMethodDecl *MethodDecl = NULL; +ObjCMethodDecl *ObjCProtocolDecl::lookupClassMethod(Selector Sel) { + ObjCMethodDecl *MethodDecl = NULL; if ((MethodDecl = getClassMethod(Sel))) return MethodDecl; if (getNumReferencedProtocols() > 0) { - ObjcProtocolDecl **RefPDecl = getReferencedProtocols(); + ObjCProtocolDecl **RefPDecl = getReferencedProtocols(); for(unsigned i = 0; i < getNumReferencedProtocols(); i++) { if ((MethodDecl = RefPDecl[i]->getClassMethod(Sel))) @@ -543,16 +543,16 @@ ObjcMethodDecl *ObjcProtocolDecl::lookupClassMethod(Selector Sel) { return NULL; } -ObjcInterfaceDecl *const ObjcMethodDecl::getClassInterface() const { - if (ObjcInterfaceDecl *ID = dyn_cast(MethodContext)) +ObjCInterfaceDecl *const ObjCMethodDecl::getClassInterface() const { + if (ObjCInterfaceDecl *ID = dyn_cast(MethodContext)) return ID; - if (ObjcCategoryDecl *CD = dyn_cast(MethodContext)) + if (ObjCCategoryDecl *CD = dyn_cast(MethodContext)) return CD->getClassInterface(); - if (ObjcImplementationDecl *IMD = - dyn_cast(MethodContext)) + if (ObjCImplementationDecl *IMD = + dyn_cast(MethodContext)) return IMD->getClassInterface(); - if (ObjcCategoryImplDecl *CID = - dyn_cast(MethodContext)) + if (ObjCCategoryImplDecl *CID = + dyn_cast(MethodContext)) return CID->getClassInterface(); assert(false && "unknown method context"); return 0; diff --git a/AST/DeclSerialization.cpp b/AST/DeclSerialization.cpp index 0e0e0ff50b..6baa262602 100644 --- a/AST/DeclSerialization.cpp +++ b/AST/DeclSerialization.cpp @@ -217,7 +217,7 @@ FileVarDecl* FileVarDecl::CreateImpl(Deserializer& D) { void ParmVarDecl::EmitImpl(llvm::Serializer& S) const { VarDecl::EmitImpl(S); - S.EmitInt(getObjcDeclQualifier()); // From ParmVarDecl. + S.EmitInt(getObjCDeclQualifier()); // From ParmVarDecl. } ParmVarDecl* ParmVarDecl::CreateImpl(Deserializer& D) { @@ -225,7 +225,7 @@ ParmVarDecl* ParmVarDecl::CreateImpl(Deserializer& D) { new ParmVarDecl(SourceLocation(),NULL,QualType(),None,NULL); decl->VarDecl::ReadImpl(D); - decl->objcDeclQualifier = static_cast(D.ReadInt()); + decl->objcDeclQualifier = static_cast(D.ReadInt()); return decl; } diff --git a/AST/Expr.cpp b/AST/Expr.cpp index ed6255924b..236c783922 100644 --- a/AST/Expr.cpp +++ b/AST/Expr.cpp @@ -985,7 +985,7 @@ unsigned OCUVectorElementExpr::getEncodedElementAccess() const { // constructor for instance messages. ObjCMessageExpr::ObjCMessageExpr(Expr *receiver, Selector selInfo, - QualType retType, ObjcMethodDecl *mproto, + QualType retType, ObjCMethodDecl *mproto, SourceLocation LBrac, SourceLocation RBrac, Expr **ArgExprs, unsigned nargs) : Expr(ObjCMessageExprClass, retType), SelName(selInfo), @@ -1004,7 +1004,7 @@ ObjCMessageExpr::ObjCMessageExpr(Expr *receiver, Selector selInfo, // constructor for class messages. // FIXME: clsName should be typed to ObjCInterfaceType ObjCMessageExpr::ObjCMessageExpr(IdentifierInfo *clsName, Selector selInfo, - QualType retType, ObjcMethodDecl *mproto, + QualType retType, ObjCMethodDecl *mproto, SourceLocation LBrac, SourceLocation RBrac, Expr **ArgExprs, unsigned nargs) : Expr(ObjCMessageExprClass, retType), SelName(selInfo), diff --git a/AST/Stmt.cpp b/AST/Stmt.cpp index 95d077c2a4..8d4f6133ef 100644 --- a/AST/Stmt.cpp +++ b/AST/Stmt.cpp @@ -183,11 +183,11 @@ Stmt::child_iterator DoStmt::child_end() { return &SubExprs[0]+END_EXPR; } Stmt::child_iterator ForStmt::child_begin() { return &SubExprs[0]; } Stmt::child_iterator ForStmt::child_end() { return &SubExprs[0]+END_EXPR; } -// ObjcForCollectionStmt -Stmt::child_iterator ObjcForCollectionStmt::child_begin() { +// ObjCForCollectionStmt +Stmt::child_iterator ObjCForCollectionStmt::child_begin() { return &SubExprs[0]; } -Stmt::child_iterator ObjcForCollectionStmt::child_end() { +Stmt::child_iterator ObjCForCollectionStmt::child_end() { return &SubExprs[0]+END_EXPR; } @@ -225,27 +225,27 @@ Stmt::child_iterator ReturnStmt::child_end() { Stmt::child_iterator AsmStmt::child_begin() { return child_iterator(); } Stmt::child_iterator AsmStmt::child_end() { return child_iterator(); } -// ObjcAtCatchStmt -Stmt::child_iterator ObjcAtCatchStmt::child_begin() { return &SubExprs[0]; } -Stmt::child_iterator ObjcAtCatchStmt::child_end() { +// ObjCAtCatchStmt +Stmt::child_iterator ObjCAtCatchStmt::child_begin() { return &SubExprs[0]; } +Stmt::child_iterator ObjCAtCatchStmt::child_end() { return &SubExprs[0]+END_EXPR; } -// ObjcAtFinallyStmt -Stmt::child_iterator ObjcAtFinallyStmt::child_begin() { return &AtFinallyStmt; } -Stmt::child_iterator ObjcAtFinallyStmt::child_end() { return &AtFinallyStmt+1; } +// ObjCAtFinallyStmt +Stmt::child_iterator ObjCAtFinallyStmt::child_begin() { return &AtFinallyStmt; } +Stmt::child_iterator ObjCAtFinallyStmt::child_end() { return &AtFinallyStmt+1; } -// ObjcAtTryStmt -Stmt::child_iterator ObjcAtTryStmt::child_begin() { return &SubStmts[0]; } -Stmt::child_iterator ObjcAtTryStmt::child_end() { +// ObjCAtTryStmt +Stmt::child_iterator ObjCAtTryStmt::child_begin() { return &SubStmts[0]; } +Stmt::child_iterator ObjCAtTryStmt::child_end() { return &SubStmts[0]+END_EXPR; } -// ObjcAtThrowStmt -Stmt::child_iterator ObjcAtThrowStmt::child_begin() { +// ObjCAtThrowStmt +Stmt::child_iterator ObjCAtThrowStmt::child_begin() { return &Throw; } -Stmt::child_iterator ObjcAtThrowStmt::child_end() { +Stmt::child_iterator ObjCAtThrowStmt::child_end() { return &Throw+1; } diff --git a/AST/StmtDumper.cpp b/AST/StmtDumper.cpp index 0125dfbbf1..b7a31229c7 100644 --- a/AST/StmtDumper.cpp +++ b/AST/StmtDumper.cpp @@ -284,8 +284,8 @@ void StmtDumper::VisitDeclRefExpr(DeclRefExpr *Node) { case Decl::Union: fprintf(F,"Union"); break; case Decl::Class: fprintf(F,"Class"); break; case Decl::Enum: fprintf(F,"Enum"); break; - case Decl::ObjcInterface: fprintf(F,"ObjcInterface"); break; - case Decl::ObjcClass: fprintf(F,"ObjcClass"); break; + case Decl::ObjCInterface: fprintf(F,"ObjCInterface"); break; + case Decl::ObjCClass: fprintf(F,"ObjCClass"); break; default: fprintf(F,"Decl"); break; } diff --git a/AST/StmtPrinter.cpp b/AST/StmtPrinter.cpp index 099dd286ea..6bfe735211 100644 --- a/AST/StmtPrinter.cpp +++ b/AST/StmtPrinter.cpp @@ -296,7 +296,7 @@ void StmtPrinter::VisitForStmt(ForStmt *Node) { } } -void StmtPrinter::VisitObjcForCollectionStmt(ObjcForCollectionStmt *Node) { +void StmtPrinter::VisitObjCForCollectionStmt(ObjCForCollectionStmt *Node) { Indent() << "for ("; if (DeclStmt *DS = dyn_cast(Node->getElement())) PrintRawDecl(DS->getDecl()); @@ -406,18 +406,18 @@ void StmtPrinter::VisitAsmStmt(AsmStmt *Node) { OS << ");\n"; } -void StmtPrinter::VisitObjcAtTryStmt(ObjcAtTryStmt *Node) { +void StmtPrinter::VisitObjCAtTryStmt(ObjCAtTryStmt *Node) { Indent() << "@try"; if (CompoundStmt *TS = dyn_cast(Node->getTryBody())) { PrintRawCompoundStmt(TS); OS << "\n"; } - for (ObjcAtCatchStmt *catchStmt = - static_cast(Node->getCatchStmts()); + for (ObjCAtCatchStmt *catchStmt = + static_cast(Node->getCatchStmts()); catchStmt; catchStmt = - static_cast(catchStmt->getNextCatchStmt())) { + static_cast(catchStmt->getNextCatchStmt())) { Indent() << "@catch("; if (catchStmt->getCatchParamStmt()) { if (DeclStmt *DS = dyn_cast(catchStmt->getCatchParamStmt())) @@ -431,7 +431,7 @@ void StmtPrinter::VisitObjcAtTryStmt(ObjcAtTryStmt *Node) { } } - if (ObjcAtFinallyStmt *FS =static_cast( + if (ObjCAtFinallyStmt *FS =static_cast( Node->getFinallyStmt())) { Indent() << "@finally"; PrintRawCompoundStmt(dyn_cast(FS->getFinallyBody())); @@ -439,14 +439,14 @@ void StmtPrinter::VisitObjcAtTryStmt(ObjcAtTryStmt *Node) { } } -void StmtPrinter::VisitObjcAtFinallyStmt(ObjcAtFinallyStmt *Node) { +void StmtPrinter::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *Node) { } -void StmtPrinter::VisitObjcAtCatchStmt (ObjcAtCatchStmt *Node) { +void StmtPrinter::VisitObjCAtCatchStmt (ObjCAtCatchStmt *Node) { Indent() << "@catch (...) { /* todo */ } \n"; } -void StmtPrinter::VisitObjcAtThrowStmt (ObjcAtThrowStmt *Node) { +void StmtPrinter::VisitObjCAtThrowStmt (ObjCAtThrowStmt *Node) { Indent() << "@throw"; if (Node->getThrowExpr()) { OS << " "; diff --git a/AST/StmtSerialization.cpp b/AST/StmtSerialization.cpp index 330ebcb717..56d4e2f20c 100644 --- a/AST/StmtSerialization.cpp +++ b/AST/StmtSerialization.cpp @@ -156,23 +156,23 @@ Stmt* Stmt::Create(Deserializer& D) { // Objective C //==--------------------------------------==// - case ObjcAtCatchStmtClass: - return ObjcAtCatchStmt::CreateImpl(D); + case ObjCAtCatchStmtClass: + return ObjCAtCatchStmt::CreateImpl(D); - case ObjcAtFinallyStmtClass: - return ObjcAtFinallyStmt::CreateImpl(D); + case ObjCAtFinallyStmtClass: + return ObjCAtFinallyStmt::CreateImpl(D); - case ObjcAtThrowStmtClass: - return ObjcAtThrowStmt::CreateImpl(D); + case ObjCAtThrowStmtClass: + return ObjCAtThrowStmt::CreateImpl(D); - case ObjcAtTryStmtClass: - return ObjcAtTryStmt::CreateImpl(D); + case ObjCAtTryStmtClass: + return ObjCAtTryStmt::CreateImpl(D); case ObjCEncodeExprClass: return ObjCEncodeExpr::CreateImpl(D); - case ObjcForCollectionStmtClass: - return ObjcForCollectionStmt::CreateImpl(D); + case ObjCForCollectionStmtClass: + return ObjCForCollectionStmt::CreateImpl(D); case ObjCIvarRefExprClass: return ObjCIvarRefExpr::CreateImpl(D); @@ -851,18 +851,18 @@ WhileStmt* WhileStmt::CreateImpl(Deserializer& D) { // Objective C Serialization //===----------------------------------------------------------------------===// -void ObjcAtCatchStmt::EmitImpl(Serializer& S) const { +void ObjCAtCatchStmt::EmitImpl(Serializer& S) const { S.Emit(AtCatchLoc); S.Emit(RParenLoc); S.EmitPtr(NextAtCatchStmt); S.BatchEmitOwnedPtrs((unsigned) END_EXPR,&SubExprs[0]); } -ObjcAtCatchStmt* ObjcAtCatchStmt::CreateImpl(Deserializer& D) { +ObjCAtCatchStmt* ObjCAtCatchStmt::CreateImpl(Deserializer& D) { SourceLocation AtCatchLoc = SourceLocation::ReadVal(D); SourceLocation RParenLoc = SourceLocation::ReadVal(D); - ObjcAtCatchStmt* stmt = new ObjcAtCatchStmt(AtCatchLoc,RParenLoc); + ObjCAtCatchStmt* stmt = new ObjCAtCatchStmt(AtCatchLoc,RParenLoc); D.ReadPtr(stmt->NextAtCatchStmt); // Allows backpatching. D.BatchReadOwnedPtrs((unsigned) END_EXPR, &stmt->SubExprs[0]); @@ -870,36 +870,36 @@ ObjcAtCatchStmt* ObjcAtCatchStmt::CreateImpl(Deserializer& D) { return stmt; } -void ObjcAtFinallyStmt::EmitImpl(Serializer& S) const { +void ObjCAtFinallyStmt::EmitImpl(Serializer& S) const { S.Emit(AtFinallyLoc); S.EmitOwnedPtr(AtFinallyStmt); } -ObjcAtFinallyStmt* ObjcAtFinallyStmt::CreateImpl(Deserializer& D) { +ObjCAtFinallyStmt* ObjCAtFinallyStmt::CreateImpl(Deserializer& D) { SourceLocation Loc = SourceLocation::ReadVal(D); Stmt* AtFinallyStmt = D.ReadOwnedPtr(); - return new ObjcAtFinallyStmt(Loc,AtFinallyStmt); + return new ObjCAtFinallyStmt(Loc,AtFinallyStmt); } -void ObjcAtThrowStmt::EmitImpl(Serializer& S) const { +void ObjCAtThrowStmt::EmitImpl(Serializer& S) const { S.Emit(AtThrowLoc); S.EmitOwnedPtr(Throw); } -ObjcAtThrowStmt* ObjcAtThrowStmt::CreateImpl(Deserializer& D) { +ObjCAtThrowStmt* ObjCAtThrowStmt::CreateImpl(Deserializer& D) { SourceLocation L = SourceLocation::ReadVal(D); Stmt* Throw = D.ReadOwnedPtr(); - return new ObjcAtThrowStmt(L,Throw); + return new ObjCAtThrowStmt(L,Throw); } -void ObjcAtTryStmt::EmitImpl(Serializer& S) const { +void ObjCAtTryStmt::EmitImpl(Serializer& S) const { S.Emit(AtTryLoc); S.BatchEmitOwnedPtrs((unsigned) END_EXPR, &SubStmts[0]); } -ObjcAtTryStmt* ObjcAtTryStmt::CreateImpl(Deserializer& D) { +ObjCAtTryStmt* ObjCAtTryStmt::CreateImpl(Deserializer& D) { SourceLocation L = SourceLocation::ReadVal(D); - ObjcAtTryStmt* stmt = new ObjcAtTryStmt(L,NULL,NULL,NULL); + ObjCAtTryStmt* stmt = new ObjCAtTryStmt(L,NULL,NULL,NULL); D.BatchReadOwnedPtrs((unsigned) END_EXPR, &stmt->SubStmts[0]); return stmt; } @@ -919,18 +919,18 @@ ObjCEncodeExpr* ObjCEncodeExpr::CreateImpl(Deserializer& D) { return new ObjCEncodeExpr(T,ET,AtLoc,RParenLoc); } -void ObjcForCollectionStmt::EmitImpl(Serializer& S) const { +void ObjCForCollectionStmt::EmitImpl(Serializer& S) const { S.Emit(ForLoc); S.BatchEmitOwnedPtrs(getElement(),getCollection(),getBody()); } -ObjcForCollectionStmt* ObjcForCollectionStmt::CreateImpl(Deserializer& D) { +ObjCForCollectionStmt* ObjCForCollectionStmt::CreateImpl(Deserializer& D) { SourceLocation ForLoc = SourceLocation::ReadVal(D); Stmt* Element; Expr* Collection; Stmt* Body; D.BatchReadOwnedPtrs(Element,Collection,Body); - return new ObjcForCollectionStmt(Element,Collection,Body,ForLoc); + return new ObjCForCollectionStmt(Element,Collection,Body,ForLoc); } void ObjCIvarRefExpr::EmitImpl(Serializer& S) const { diff --git a/AST/Type.cpp b/AST/Type.cpp index af96830a9c..610cd8fcab 100644 --- a/AST/Type.cpp +++ b/AST/Type.cpp @@ -434,7 +434,7 @@ bool Type::isScalarType() const { } return isa(CanonicalType) || isa(CanonicalType) || isa(CanonicalType) || - isa(CanonicalType); + isa(CanonicalType); } bool Type::isAggregateType() const { @@ -529,25 +529,25 @@ void FunctionTypeProto::Profile(llvm::FoldingSetNodeID &ID) { Profile(ID, getResultType(), arg_type_begin(), NumArgs, isVariadic()); } -void ObjcQualifiedInterfaceType::Profile(llvm::FoldingSetNodeID &ID, - ObjcProtocolDecl **protocols, +void ObjCQualifiedInterfaceType::Profile(llvm::FoldingSetNodeID &ID, + ObjCProtocolDecl **protocols, unsigned NumProtocols) { for (unsigned i = 0; i != NumProtocols; i++) ID.AddPointer(protocols[i]); } -void ObjcQualifiedInterfaceType::Profile(llvm::FoldingSetNodeID &ID) { +void ObjCQualifiedInterfaceType::Profile(llvm::FoldingSetNodeID &ID) { Profile(ID, &Protocols[0], getNumProtocols()); } -void ObjcQualifiedIdType::Profile(llvm::FoldingSetNodeID &ID, - ObjcProtocolDecl **protocols, +void ObjCQualifiedIdType::Profile(llvm::FoldingSetNodeID &ID, + ObjCProtocolDecl **protocols, unsigned NumProtocols) { for (unsigned i = 0; i != NumProtocols; i++) ID.AddPointer(protocols[i]); } -void ObjcQualifiedIdType::Profile(llvm::FoldingSetNodeID &ID) { +void ObjCQualifiedIdType::Profile(llvm::FoldingSetNodeID &ID) { Profile(ID, &Protocols[0], getNumProtocols()); } @@ -770,42 +770,42 @@ void TypedefType::getAsStringInternal(std::string &InnerString) const { InnerString = getDecl()->getIdentifier()->getName() + InnerString; } -void ObjcInterfaceType::getAsStringInternal(std::string &InnerString) const { +void ObjCInterfaceType::getAsStringInternal(std::string &InnerString) const { if (!InnerString.empty()) // Prefix the basic type, e.g. 'typedefname X'. InnerString = ' ' + InnerString; InnerString = getDecl()->getIdentifier()->getName() + InnerString; } -void ObjcQualifiedInterfaceType::getAsStringInternal( +void ObjCQualifiedInterfaceType::getAsStringInternal( std::string &InnerString) const { if (!InnerString.empty()) // Prefix the basic type, e.g. 'typedefname X'. InnerString = ' ' + InnerString; - std::string ObjcQIString = getDecl()->getName(); - ObjcQIString += '<'; + std::string ObjCQIString = getDecl()->getName(); + ObjCQIString += '<'; int num = getNumProtocols(); for (int i = 0; i < num; i++) { - ObjcQIString += getProtocols(i)->getName(); + ObjCQIString += getProtocols(i)->getName(); if (i < num-1) - ObjcQIString += ','; + ObjCQIString += ','; } - ObjcQIString += '>'; - InnerString = ObjcQIString + InnerString; + ObjCQIString += '>'; + InnerString = ObjCQIString + InnerString; } -void ObjcQualifiedIdType::getAsStringInternal( +void ObjCQualifiedIdType::getAsStringInternal( std::string &InnerString) const { if (!InnerString.empty()) // Prefix the basic type, e.g. 'typedefname X'. InnerString = ' ' + InnerString; - std::string ObjcQIString = "id"; - ObjcQIString += '<'; + std::string ObjCQIString = "id"; + ObjCQIString += '<'; int num = getNumProtocols(); for (int i = 0; i < num; i++) { - ObjcQIString += getProtocols(i)->getName(); + ObjCQIString += getProtocols(i)->getName(); if (i < num-1) - ObjcQIString += ','; + ObjCQIString += ','; } - ObjcQIString += '>'; - InnerString = ObjcQIString + InnerString; + ObjCQIString += '>'; + InnerString = ObjCQIString + InnerString; } void TagType::getAsStringInternal(std::string &InnerString) const { diff --git a/CodeGen/CGExprScalar.cpp b/CodeGen/CGExprScalar.cpp index 023e907499..a76f1e1550 100644 --- a/CodeGen/CGExprScalar.cpp +++ b/CodeGen/CGExprScalar.cpp @@ -1001,7 +1001,7 @@ Value *ScalarExprEmitter::VisitVAArgExpr(VAArgExpr *VE) { Value *ScalarExprEmitter::VisitObjCEncodeExpr(const ObjCEncodeExpr *E) { std::string str; - CGF.getContext().getObjcEncodingForType(E->getEncodedType(), str); + CGF.getContext().getObjCEncodingForType(E->getEncodedType(), str); llvm::Constant *C = llvm::ConstantArray::get(str); C = new llvm::GlobalVariable(C->getType(), true, diff --git a/CodeGen/CodeGenTypes.cpp b/CodeGen/CodeGenTypes.cpp index bd6a06f9b3..0de6dc8b5e 100644 --- a/CodeGen/CodeGenTypes.cpp +++ b/CodeGen/CodeGenTypes.cpp @@ -265,15 +265,15 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) { return llvm::FunctionType::get(ResultType, ArgTys, isVarArg); } - case Type::ObjcInterface: + case Type::ObjCInterface: assert(0 && "FIXME: add missing functionality here"); break; - case Type::ObjcQualifiedInterface: + case Type::ObjCQualifiedInterface: assert(0 && "FIXME: add missing functionality here"); break; - case Type::ObjcQualifiedId: + case Type::ObjCQualifiedId: assert(0 && "FIXME: add missing functionality here"); break; diff --git a/Driver/ASTConsumers.cpp b/Driver/ASTConsumers.cpp index 2a391986f4..1dbfb040d3 100644 --- a/Driver/ASTConsumers.cpp +++ b/Driver/ASTConsumers.cpp @@ -39,13 +39,13 @@ namespace { void PrintDecl(Decl *D); void PrintFunctionDeclStart(FunctionDecl *FD); void PrintTypeDefDecl(TypedefDecl *TD); - void PrintObjcMethodDecl(ObjcMethodDecl *OMD); - void PrintObjcImplementationDecl(ObjcImplementationDecl *OID); - void PrintObjcInterfaceDecl(ObjcInterfaceDecl *OID); - void PrintObjcProtocolDecl(ObjcProtocolDecl *PID); - void PrintObjcCategoryImplDecl(ObjcCategoryImplDecl *PID); - void PrintObjcCategoryDecl(ObjcCategoryDecl *PID); - void PrintObjcCompatibleAliasDecl(ObjcCompatibleAliasDecl *AID); + void PrintObjCMethodDecl(ObjCMethodDecl *OMD); + void PrintObjCImplementationDecl(ObjCImplementationDecl *OID); + void PrintObjCInterfaceDecl(ObjCInterfaceDecl *OID); + void PrintObjCProtocolDecl(ObjCProtocolDecl *PID); + void PrintObjCCategoryImplDecl(ObjCCategoryImplDecl *PID); + void PrintObjCCategoryDecl(ObjCCategoryDecl *PID); + void PrintObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *AID); }; } // end anonymous namespace @@ -58,37 +58,37 @@ void DeclPrinter:: PrintDecl(Decl *D) { FD->getBody()->printPretty(Out); Out << '\n'; } - } else if (isa(D)) { + } else if (isa(D)) { // Do nothing, methods definitions are printed in - // PrintObjcImplementationDecl. + // PrintObjCImplementationDecl. } else if (TypedefDecl *TD = dyn_cast(D)) { PrintTypeDefDecl(TD); - } else if (ObjcInterfaceDecl *OID = dyn_cast(D)) { - PrintObjcInterfaceDecl(OID); - } else if (ObjcProtocolDecl *PID = dyn_cast(D)) { - PrintObjcProtocolDecl(PID); - } else if (ObjcForwardProtocolDecl *OFPD = - dyn_cast(D)) { + } else if (ObjCInterfaceDecl *OID = dyn_cast(D)) { + PrintObjCInterfaceDecl(OID); + } else if (ObjCProtocolDecl *PID = dyn_cast(D)) { + PrintObjCProtocolDecl(PID); + } else if (ObjCForwardProtocolDecl *OFPD = + dyn_cast(D)) { Out << "@protocol "; for (unsigned i = 0, e = OFPD->getNumForwardDecls(); i != e; ++i) { - const ObjcProtocolDecl *D = OFPD->getForwardProtocolDecl(i); + const ObjCProtocolDecl *D = OFPD->getForwardProtocolDecl(i); if (i) Out << ", "; Out << D->getName(); } Out << ";\n"; - } else if (ObjcImplementationDecl *OID = - dyn_cast(D)) { - PrintObjcImplementationDecl(OID); - } else if (ObjcCategoryImplDecl *OID = - dyn_cast(D)) { - PrintObjcCategoryImplDecl(OID); - } else if (ObjcCategoryDecl *OID = - dyn_cast(D)) { - PrintObjcCategoryDecl(OID); - } else if (ObjcCompatibleAliasDecl *OID = - dyn_cast(D)) { - PrintObjcCompatibleAliasDecl(OID); - } else if (isa(D)) { + } else if (ObjCImplementationDecl *OID = + dyn_cast(D)) { + PrintObjCImplementationDecl(OID); + } else if (ObjCCategoryImplDecl *OID = + dyn_cast(D)) { + PrintObjCCategoryImplDecl(OID); + } else if (ObjCCategoryDecl *OID = + dyn_cast(D)) { + PrintObjCCategoryDecl(OID); + } else if (ObjCCompatibleAliasDecl *OID = + dyn_cast(D)) { + PrintObjCCompatibleAliasDecl(OID); + } else if (isa(D)) { Out << "@class [printing todo]\n"; } else if (TagDecl *TD = dyn_cast(D)) { Out << "Read top-level tag decl: '" << TD->getName() << "'\n"; @@ -152,7 +152,7 @@ void DeclPrinter::PrintTypeDefDecl(TypedefDecl *TD) { Out << "typedef " << S << ";\n"; } -void DeclPrinter::PrintObjcMethodDecl(ObjcMethodDecl *OMD) { +void DeclPrinter::PrintObjCMethodDecl(ObjCMethodDecl *OMD) { if (OMD->isInstance()) Out << "\n- "; else @@ -169,19 +169,19 @@ void DeclPrinter::PrintObjcMethodDecl(ObjcMethodDecl *OMD) { } } -void DeclPrinter::PrintObjcImplementationDecl(ObjcImplementationDecl *OID) { +void DeclPrinter::PrintObjCImplementationDecl(ObjCImplementationDecl *OID) { std::string I = OID->getName(); - ObjcInterfaceDecl *SID = OID->getSuperClass(); + ObjCInterfaceDecl *SID = OID->getSuperClass(); if (SID) Out << "@implementation " << I << " : " << SID->getName(); else Out << "@implementation " << I; - for (ObjcImplementationDecl::instmeth_iterator I = OID->instmeth_begin(), + for (ObjCImplementationDecl::instmeth_iterator I = OID->instmeth_begin(), E = OID->instmeth_end(); I != E; ++I) { - ObjcMethodDecl *OMD = *I; - PrintObjcMethodDecl(OMD); + ObjCMethodDecl *OMD = *I; + PrintObjCMethodDecl(OMD); if (OMD->getBody()) { Out << ' '; OMD->getBody()->printPretty(Out); @@ -189,10 +189,10 @@ void DeclPrinter::PrintObjcImplementationDecl(ObjcImplementationDecl *OID) { } } - for (ObjcImplementationDecl::classmeth_iterator I = OID->classmeth_begin(), + for (ObjCImplementationDecl::classmeth_iterator I = OID->classmeth_begin(), E = OID->classmeth_end(); I != E; ++I) { - ObjcMethodDecl *OMD = *I; - PrintObjcMethodDecl(OMD); + ObjCMethodDecl *OMD = *I; + PrintObjCMethodDecl(OMD); if (OMD->getBody()) { Out << ' '; OMD->getBody()->printPretty(Out); @@ -204,9 +204,9 @@ void DeclPrinter::PrintObjcImplementationDecl(ObjcImplementationDecl *OID) { } -void DeclPrinter::PrintObjcInterfaceDecl(ObjcInterfaceDecl *OID) { +void DeclPrinter::PrintObjCInterfaceDecl(ObjCInterfaceDecl *OID) { std::string I = OID->getName(); - ObjcInterfaceDecl *SID = OID->getSuperClass(); + ObjCInterfaceDecl *SID = OID->getSuperClass(); if (SID) Out << "@interface " << I << " : " << SID->getName(); @@ -217,7 +217,7 @@ void DeclPrinter::PrintObjcInterfaceDecl(ObjcInterfaceDecl *OID) { int count = OID->getNumIntfRefProtocols(); if (count > 0) { - ObjcProtocolDecl **refProtocols = OID->getReferencedProtocols(); + ObjCProtocolDecl **refProtocols = OID->getReferencedProtocols(); for (int i = 0; i < count; i++) Out << (i == 0 ? '<' : ',') << refProtocols[i]->getName(); } @@ -229,7 +229,7 @@ void DeclPrinter::PrintObjcInterfaceDecl(ObjcInterfaceDecl *OID) { if (OID->getNumInstanceVariables() > 0) { Out << '{'; - for (ObjcInterfaceDecl::ivar_iterator I = OID->ivar_begin(), + for (ObjCInterfaceDecl::ivar_iterator I = OID->ivar_begin(), E = OID->ivar_end(); I != E; ++I) { Out << '\t' << (*I)->getType().getAsString() << ' ' << (*I)->getName() << ";\n"; @@ -240,55 +240,55 @@ void DeclPrinter::PrintObjcInterfaceDecl(ObjcInterfaceDecl *OID) { int NumProperties = OID->getNumPropertyDecl(); if (NumProperties > 0) { for (int i = 0; i < NumProperties; i++) { - ObjcPropertyDecl *PDecl = OID->getPropertyDecl()[i]; + ObjCPropertyDecl *PDecl = OID->getPropertyDecl()[i]; Out << "@property"; - if (PDecl->getPropertyAttributes() != ObjcPropertyDecl::OBJC_PR_noattr) { + if (PDecl->getPropertyAttributes() != ObjCPropertyDecl::OBJC_PR_noattr) { bool first = true; Out << " ("; - if (PDecl->getPropertyAttributes() & ObjcPropertyDecl::OBJC_PR_readonly) + if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_readonly) { Out << (first ? ' ' : ',') << "readonly"; first = false; } - if (PDecl->getPropertyAttributes() & ObjcPropertyDecl::OBJC_PR_getter) + if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_getter) { Out << (first ? ' ' : ',') << "getter = " << PDecl->getGetterName()->getName(); first = false; } - if (PDecl->getPropertyAttributes() & ObjcPropertyDecl::OBJC_PR_setter) + if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_setter) { Out << (first ? ' ' : ',') << "setter = " << PDecl->getSetterName()->getName(); first = false; } - if (PDecl->getPropertyAttributes() & ObjcPropertyDecl::OBJC_PR_assign) + if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_assign) { Out << (first ? ' ' : ',') << "assign"; first = false; } - if (PDecl->getPropertyAttributes() & ObjcPropertyDecl::OBJC_PR_readwrite) + if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_readwrite) { Out << (first ? ' ' : ',') << "readwrite"; first = false; } - if (PDecl->getPropertyAttributes() & ObjcPropertyDecl::OBJC_PR_retain) + if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_retain) { Out << (first ? ' ' : ',') << "retain"; first = false; } - if (PDecl->getPropertyAttributes() & ObjcPropertyDecl::OBJC_PR_copy) + if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_copy) { Out << (first ? ' ' : ',') << "copy"; first = false; } - if (PDecl->getPropertyAttributes() & ObjcPropertyDecl::OBJC_PR_nonatomic) + if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_nonatomic) { Out << (first ? ' ' : ',') << "nonatomic"; first = false; @@ -296,7 +296,7 @@ void DeclPrinter::PrintObjcInterfaceDecl(ObjcInterfaceDecl *OID) { Out << " )"; } - ObjcIvarDecl **IDecl = PDecl->getPropertyDecls(); + ObjCIvarDecl **IDecl = PDecl->getPropertyDecls(); Out << ' ' << IDecl[0]->getType().getAsString() << ' ' << IDecl[0]->getName(); @@ -312,12 +312,12 @@ void DeclPrinter::PrintObjcInterfaceDecl(ObjcInterfaceDecl *OID) { // FIXME: implement the rest... } -void DeclPrinter::PrintObjcProtocolDecl(ObjcProtocolDecl *PID) { +void DeclPrinter::PrintObjCProtocolDecl(ObjCProtocolDecl *PID) { Out << "@protocol " << PID->getName() << '\n'; // FIXME: implement the rest... } -void DeclPrinter::PrintObjcCategoryImplDecl(ObjcCategoryImplDecl *PID) { +void DeclPrinter::PrintObjCCategoryImplDecl(ObjCCategoryImplDecl *PID) { Out << "@implementation " << PID->getClassInterface()->getName() << '(' << PID->getName() << ");\n"; @@ -325,14 +325,14 @@ void DeclPrinter::PrintObjcCategoryImplDecl(ObjcCategoryImplDecl *PID) { // FIXME: implement the rest... } -void DeclPrinter::PrintObjcCategoryDecl(ObjcCategoryDecl *PID) { +void DeclPrinter::PrintObjCCategoryDecl(ObjCCategoryDecl *PID) { Out << "@interface " << PID->getClassInterface()->getName() << '(' << PID->getName() << ");\n"; // FIXME: implement the rest... } -void DeclPrinter::PrintObjcCompatibleAliasDecl(ObjcCompatibleAliasDecl *AID) { +void DeclPrinter::PrintObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *AID) { Out << "@compatibility_alias " << AID->getName() << ' ' << AID->getClassInterface()->getName() << ";\n"; } @@ -382,15 +382,15 @@ namespace { PrintTypeDefDecl(TD); } else if (ScopedDecl *SD = dyn_cast(D)) { Out << "Read top-level variable decl: '" << SD->getName() << "'\n"; - } else if (ObjcInterfaceDecl *OID = dyn_cast(D)) { + } else if (ObjCInterfaceDecl *OID = dyn_cast(D)) { Out << "Read objc interface '" << OID->getName() << "'\n"; - } else if (ObjcProtocolDecl *OPD = dyn_cast(D)) { + } else if (ObjCProtocolDecl *OPD = dyn_cast(D)) { Out << "Read objc protocol '" << OPD->getName() << "'\n"; - } else if (ObjcCategoryDecl *OCD = dyn_cast(D)) { + } else if (ObjCCategoryDecl *OCD = dyn_cast(D)) { Out << "Read objc category '" << OCD->getName() << "'\n"; - } else if (isa(D)) { + } else if (isa(D)) { Out << "Read objc fwd protocol decl\n"; - } else if (isa(D)) { + } else if (isa(D)) { Out << "Read objc fwd class decl\n"; } else { assert(0 && "Unknown decl type!"); diff --git a/Driver/RewriteTest.cpp b/Driver/RewriteTest.cpp index bec1332ec5..93c9838a91 100644 --- a/Driver/RewriteTest.cpp +++ b/Driver/RewriteTest.cpp @@ -35,11 +35,11 @@ namespace { unsigned MainFileID; const char *MainFileStart, *MainFileEnd; SourceLocation LastIncLoc; - llvm::SmallVector ClassImplementation; - llvm::SmallVector CategoryImplementation; - llvm::SmallPtrSet ObjcSynthesizedStructs; - llvm::SmallPtrSet ObjcForwardDecls; - llvm::DenseMap MethodInternalNames; + llvm::SmallVector ClassImplementation; + llvm::SmallVector CategoryImplementation; + llvm::SmallPtrSet ObjCSynthesizedStructs; + llvm::SmallPtrSet ObjCForwardDecls; + llvm::DenseMap MethodInternalNames; FunctionDecl *MsgSendFunctionDecl; FunctionDecl *MsgSendSuperFunctionDecl; @@ -57,7 +57,7 @@ namespace { RecordDecl *NSStringRecord; // Needed for super. - ObjcMethodDecl *CurMethodDecl; + ObjCMethodDecl *CurMethodDecl; RecordDecl *SuperStructDecl; static const int OBJC_ABI_VERSION =7 ; @@ -137,19 +137,19 @@ namespace { void RewritePrologue(SourceLocation Loc); void RewriteInclude(SourceLocation Loc); void RewriteTabs(); - void RewriteForwardClassDecl(ObjcClassDecl *Dcl); - void RewriteInterfaceDecl(ObjcInterfaceDecl *Dcl); + void RewriteForwardClassDecl(ObjCClassDecl *Dcl); + void RewriteInterfaceDecl(ObjCInterfaceDecl *Dcl); void RewriteImplementationDecl(NamedDecl *Dcl); - void RewriteObjcMethodDecl(ObjcMethodDecl *MDecl, std::string &ResultStr); - void RewriteCategoryDecl(ObjcCategoryDecl *Dcl); - void RewriteProtocolDecl(ObjcProtocolDecl *Dcl); - void RewriteForwardProtocolDecl(ObjcForwardProtocolDecl *Dcl); - void RewriteMethodDeclaration(ObjcMethodDecl *Method); - void RewriteProperties(int nProperties, ObjcPropertyDecl **Properties); + void RewriteObjCMethodDecl(ObjCMethodDecl *MDecl, std::string &ResultStr); + void RewriteCategoryDecl(ObjCCategoryDecl *Dcl); + void RewriteProtocolDecl(ObjCProtocolDecl *Dcl); + void RewriteForwardProtocolDecl(ObjCForwardProtocolDecl *Dcl); + void RewriteMethodDeclaration(ObjCMethodDecl *Method); + void RewriteProperties(int nProperties, ObjCPropertyDecl **Properties); void RewriteFunctionDecl(FunctionDecl *FD); - void RewriteObjcQualifiedInterfaceTypes(Decl *Dcl); + void RewriteObjCQualifiedInterfaceTypes(Decl *Dcl); bool needToScanForQualifiers(QualType T); - ObjcInterfaceDecl *isSuperReceiver(Expr *recExpr); + ObjCInterfaceDecl *isSuperReceiver(Expr *recExpr); QualType getSuperStructType(); // Expression Rewriting. @@ -160,10 +160,10 @@ namespace { Stmt *RewriteMessageExpr(ObjCMessageExpr *Exp); Stmt *RewriteObjCStringLiteral(ObjCStringLiteral *Exp); Stmt *RewriteObjCProtocolExpr(ObjCProtocolExpr *Exp); - Stmt *RewriteObjcTryStmt(ObjcAtTryStmt *S); - Stmt *RewriteObjcCatchStmt(ObjcAtCatchStmt *S); - Stmt *RewriteObjcFinallyStmt(ObjcAtFinallyStmt *S); - Stmt *RewriteObjcThrowStmt(ObjcAtThrowStmt *S); + Stmt *RewriteObjCTryStmt(ObjCAtTryStmt *S); + Stmt *RewriteObjCCatchStmt(ObjCAtCatchStmt *S); + Stmt *RewriteObjCFinallyStmt(ObjCAtFinallyStmt *S); + Stmt *RewriteObjCThrowStmt(ObjCAtThrowStmt *S); CallExpr *SynthesizeCallToFunctionDecl(FunctionDecl *FD, Expr **args, unsigned nargs); void SynthMsgSendFunctionDecl(); @@ -178,29 +178,29 @@ namespace { void SynthGetProtocolFunctionDecl(); // Metadata emission. - void RewriteObjcClassMetaData(ObjcImplementationDecl *IDecl, + void RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl, std::string &Result); - void RewriteObjcCategoryImplDecl(ObjcCategoryImplDecl *CDecl, + void RewriteObjCCategoryImplDecl(ObjCCategoryImplDecl *CDecl, std::string &Result); - typedef ObjcCategoryImplDecl::instmeth_iterator instmeth_iterator; - void RewriteObjcMethodsMetaData(instmeth_iterator MethodBegin, + typedef ObjCCategoryImplDecl::instmeth_iterator instmeth_iterator; + void RewriteObjCMethodsMetaData(instmeth_iterator MethodBegin, instmeth_iterator MethodEnd, bool IsInstanceMethod, const char *prefix, const char *ClassName, std::string &Result); - void RewriteObjcProtocolsMetaData(ObjcProtocolDecl **Protocols, + void RewriteObjCProtocolsMetaData(ObjCProtocolDecl **Protocols, int NumProtocols, const char *prefix, const char *ClassName, std::string &Result); - void SynthesizeObjcInternalStruct(ObjcInterfaceDecl *CDecl, + void SynthesizeObjCInternalStruct(ObjCInterfaceDecl *CDecl, std::string &Result); - void SynthesizeIvarOffsetComputation(ObjcImplementationDecl *IDecl, - ObjcIvarDecl *ivar, + void SynthesizeIvarOffsetComputation(ObjCImplementationDecl *IDecl, + ObjCIvarDecl *ivar, std::string &Result); void RewriteImplementations(std::string &Result); }; @@ -233,14 +233,14 @@ void RewriteTest::HandleTopLevelDecl(Decl *D) { ConstantStringClassReference = FVD; return; } - } else if (ObjcInterfaceDecl *MD = dyn_cast(D)) { + } else if (ObjCInterfaceDecl *MD = dyn_cast(D)) { RewriteInterfaceDecl(MD); - } else if (ObjcCategoryDecl *CD = dyn_cast(D)) { + } else if (ObjCCategoryDecl *CD = dyn_cast(D)) { RewriteCategoryDecl(CD); - } else if (ObjcProtocolDecl *PD = dyn_cast(D)) { + } else if (ObjCProtocolDecl *PD = dyn_cast(D)) { RewriteProtocolDecl(PD); - } else if (ObjcForwardProtocolDecl *FP = - dyn_cast(D)){ + } else if (ObjCForwardProtocolDecl *FP = + dyn_cast(D)){ RewriteForwardProtocolDecl(FP); } // If we have a decl in the main file, see if we should rewrite it. @@ -259,7 +259,7 @@ void RewriteTest::HandleDeclInMainFile(Decl *D) { if (Stmt *Body = FD->getBody()) FD->setBody(RewriteFunctionBodyOrGlobalInitializer(Body)); - if (ObjcMethodDecl *MD = dyn_cast(D)) { + if (ObjCMethodDecl *MD = dyn_cast(D)) { if (Stmt *Body = MD->getBody()) { //Body->dump(); CurMethodDecl = MD; @@ -267,14 +267,14 @@ void RewriteTest::HandleDeclInMainFile(Decl *D) { CurMethodDecl = 0; } } - if (ObjcImplementationDecl *CI = dyn_cast(D)) + if (ObjCImplementationDecl *CI = dyn_cast(D)) ClassImplementation.push_back(CI); - else if (ObjcCategoryImplDecl *CI = dyn_cast(D)) + else if (ObjCCategoryImplDecl *CI = dyn_cast(D)) CategoryImplementation.push_back(CI); - else if (ObjcClassDecl *CD = dyn_cast(D)) + else if (ObjCClassDecl *CD = dyn_cast(D)) RewriteForwardClassDecl(CD); else if (VarDecl *VD = dyn_cast(D)) { - RewriteObjcQualifiedInterfaceTypes(VD); + RewriteObjCQualifiedInterfaceTypes(VD); if (VD->getInit()) RewriteFunctionBodyOrGlobalInitializer(VD->getInit()); } @@ -364,9 +364,9 @@ void RewriteTest::RewriteTabs() { } -void RewriteTest::RewriteForwardClassDecl(ObjcClassDecl *ClassDecl) { +void RewriteTest::RewriteForwardClassDecl(ObjCClassDecl *ClassDecl) { int numDecls = ClassDecl->getNumForwardDecls(); - ObjcInterfaceDecl **ForwardDecls = ClassDecl->getForwardDecls(); + ObjCInterfaceDecl **ForwardDecls = ClassDecl->getForwardDecls(); // Get the start location and compute the semi location. SourceLocation startLoc = ClassDecl->getLocation(); @@ -381,7 +381,7 @@ void RewriteTest::RewriteForwardClassDecl(ObjcClassDecl *ClassDecl) { typedefString.append(startBuf, semiPtr-startBuf+1); typedefString += "\n"; for (int i = 0; i < numDecls; i++) { - ObjcInterfaceDecl *ForwardDecl = ForwardDecls[i]; + ObjCInterfaceDecl *ForwardDecl = ForwardDecls[i]; typedefString += "#ifndef _REWRITER_typedef_"; typedefString += ForwardDecl->getName(); typedefString += "\n"; @@ -398,7 +398,7 @@ void RewriteTest::RewriteForwardClassDecl(ObjcClassDecl *ClassDecl) { typedefString.c_str(), typedefString.size()); } -void RewriteTest::RewriteMethodDeclaration(ObjcMethodDecl *Method) { +void RewriteTest::RewriteMethodDeclaration(ObjCMethodDecl *Method) { SourceLocation LocStart = Method->getLocStart(); SourceLocation LocEnd = Method->getLocEnd(); @@ -410,10 +410,10 @@ void RewriteTest::RewriteMethodDeclaration(ObjcMethodDecl *Method) { } } -void RewriteTest::RewriteProperties(int nProperties, ObjcPropertyDecl **Properties) +void RewriteTest::RewriteProperties(int nProperties, ObjCPropertyDecl **Properties) { for (int i = 0; i < nProperties; i++) { - ObjcPropertyDecl *Property = Properties[i]; + ObjCPropertyDecl *Property = Properties[i]; SourceLocation Loc = Property->getLocation(); Rewrite.ReplaceText(Loc, 0, "// ", 3); @@ -422,16 +422,16 @@ void RewriteTest::RewriteProperties(int nProperties, ObjcPropertyDecl **Properti } } -void RewriteTest::RewriteCategoryDecl(ObjcCategoryDecl *CatDecl) { +void RewriteTest::RewriteCategoryDecl(ObjCCategoryDecl *CatDecl) { SourceLocation LocStart = CatDecl->getLocStart(); // FIXME: handle category headers that are declared across multiple lines. Rewrite.ReplaceText(LocStart, 0, "// ", 3); - for (ObjcCategoryDecl::instmeth_iterator I = CatDecl->instmeth_begin(), + for (ObjCCategoryDecl::instmeth_iterator I = CatDecl->instmeth_begin(), E = CatDecl->instmeth_end(); I != E; ++I) RewriteMethodDeclaration(*I); - for (ObjcCategoryDecl::classmeth_iterator I = CatDecl->classmeth_begin(), + for (ObjCCategoryDecl::classmeth_iterator I = CatDecl->classmeth_begin(), E = CatDecl->classmeth_end(); I != E; ++I) RewriteMethodDeclaration(*I); @@ -439,7 +439,7 @@ void RewriteTest::RewriteCategoryDecl(ObjcCategoryDecl *CatDecl) { Rewrite.ReplaceText(CatDecl->getAtEndLoc(), 0, "// ", 3); } -void RewriteTest::RewriteProtocolDecl(ObjcProtocolDecl *PDecl) { +void RewriteTest::RewriteProtocolDecl(ObjCProtocolDecl *PDecl) { std::pair MainBuf = SM->getBufferData(MainFileID); SourceLocation LocStart = PDecl->getLocStart(); @@ -447,10 +447,10 @@ void RewriteTest::RewriteProtocolDecl(ObjcProtocolDecl *PDecl) { // FIXME: handle protocol headers that are declared across multiple lines. Rewrite.ReplaceText(LocStart, 0, "// ", 3); - for (ObjcProtocolDecl::instmeth_iterator I = PDecl->instmeth_begin(), + for (ObjCProtocolDecl::instmeth_iterator I = PDecl->instmeth_begin(), E = PDecl->instmeth_end(); I != E; ++I) RewriteMethodDeclaration(*I); - for (ObjcProtocolDecl::classmeth_iterator I = PDecl->classmeth_begin(), + for (ObjCProtocolDecl::classmeth_iterator I = PDecl->classmeth_begin(), E = PDecl->classmeth_end(); I != E; ++I) RewriteMethodDeclaration(*I); @@ -479,7 +479,7 @@ void RewriteTest::RewriteProtocolDecl(ObjcProtocolDecl *PDecl) { } } -void RewriteTest::RewriteForwardProtocolDecl(ObjcForwardProtocolDecl *PDecl) { +void RewriteTest::RewriteForwardProtocolDecl(ObjCForwardProtocolDecl *PDecl) { SourceLocation LocStart = PDecl->getLocation(); if (LocStart.isInvalid()) assert(false && "Invalid SourceLocation"); @@ -487,10 +487,10 @@ void RewriteTest::RewriteForwardProtocolDecl(ObjcForwardProtocolDecl *PDecl) { Rewrite.ReplaceText(LocStart, 0, "// ", 3); } -void RewriteTest::RewriteObjcMethodDecl(ObjcMethodDecl *OMD, +void RewriteTest::RewriteObjCMethodDecl(ObjCMethodDecl *OMD, std::string &ResultStr) { ResultStr += "\nstatic "; - if (OMD->getResultType()->isObjcQualifiedIdType()) + if (OMD->getResultType()->isObjCQualifiedIdType()) ResultStr += "id"; else ResultStr += OMD->getResultType().getAsString(); @@ -508,8 +508,8 @@ void RewriteTest::RewriteObjcMethodDecl(ObjcMethodDecl *OMD, NameStr += "_"; NamedDecl *MethodContext = OMD->getMethodContext(); - if (ObjcCategoryImplDecl *CID = - dyn_cast(MethodContext)) { + if (ObjCCategoryImplDecl *CID = + dyn_cast(MethodContext)) { NameStr += CID->getName(); NameStr += "_"; } @@ -534,24 +534,24 @@ void RewriteTest::RewriteObjcMethodDecl(ObjcMethodDecl *OMD, // invisible arguments if (OMD->isInstance()) { - QualType selfTy = Context->getObjcInterfaceType(OMD->getClassInterface()); + QualType selfTy = Context->getObjCInterfaceType(OMD->getClassInterface()); selfTy = Context->getPointerType(selfTy); - if (ObjcSynthesizedStructs.count(OMD->getClassInterface())) + if (ObjCSynthesizedStructs.count(OMD->getClassInterface())) ResultStr += "struct "; ResultStr += selfTy.getAsString(); } else - ResultStr += Context->getObjcIdType().getAsString(); + ResultStr += Context->getObjCIdType().getAsString(); ResultStr += " self, "; - ResultStr += Context->getObjcSelType().getAsString(); + ResultStr += Context->getObjCSelType().getAsString(); ResultStr += " _cmd"; // Method arguments. for (int i = 0; i < OMD->getNumParams(); i++) { ParmVarDecl *PDecl = OMD->getParamDecl(i); ResultStr += ", "; - if (PDecl->getType()->isObjcQualifiedIdType()) + if (PDecl->getType()->isObjCQualifiedIdType()) ResultStr += "id"; else ResultStr += PDecl->getType().getAsString(); @@ -562,20 +562,20 @@ void RewriteTest::RewriteObjcMethodDecl(ObjcMethodDecl *OMD, } void RewriteTest::RewriteImplementationDecl(NamedDecl *OID) { - ObjcImplementationDecl *IMD = dyn_cast(OID); - ObjcCategoryImplDecl *CID = dyn_cast(OID); + ObjCImplementationDecl *IMD = dyn_cast(OID); + ObjCCategoryImplDecl *CID = dyn_cast(OID); if (IMD) Rewrite.InsertText(IMD->getLocStart(), "// ", 3); else Rewrite.InsertText(CID->getLocStart(), "// ", 3); - for (ObjcCategoryImplDecl::instmeth_iterator + for (ObjCCategoryImplDecl::instmeth_iterator I = IMD ? IMD->instmeth_begin() : CID->instmeth_begin(), E = IMD ? IMD->instmeth_end() : CID->instmeth_end(); I != E; ++I) { std::string ResultStr; - ObjcMethodDecl *OMD = *I; - RewriteObjcMethodDecl(OMD, ResultStr); + ObjCMethodDecl *OMD = *I; + RewriteObjCMethodDecl(OMD, ResultStr); SourceLocation LocStart = OMD->getLocStart(); SourceLocation LocEnd = OMD->getBody()->getLocStart(); @@ -585,12 +585,12 @@ void RewriteTest::RewriteImplementationDecl(NamedDecl *OID) { ResultStr.c_str(), ResultStr.size()); } - for (ObjcCategoryImplDecl::classmeth_iterator + for (ObjCCategoryImplDecl::classmeth_iterator I = IMD ? IMD->classmeth_begin() : CID->classmeth_begin(), E = IMD ? IMD->classmeth_end() : CID->classmeth_end(); I != E; ++I) { std::string ResultStr; - ObjcMethodDecl *OMD = *I; - RewriteObjcMethodDecl(OMD, ResultStr); + ObjCMethodDecl *OMD = *I; + RewriteObjCMethodDecl(OMD, ResultStr); SourceLocation LocStart = OMD->getLocStart(); SourceLocation LocEnd = OMD->getBody()->getLocStart(); @@ -605,9 +605,9 @@ void RewriteTest::RewriteImplementationDecl(NamedDecl *OID) { Rewrite.InsertText(CID->getLocEnd(), "// ", 3); } -void RewriteTest::RewriteInterfaceDecl(ObjcInterfaceDecl *ClassDecl) { +void RewriteTest::RewriteInterfaceDecl(ObjCInterfaceDecl *ClassDecl) { std::string ResultStr; - if (!ObjcForwardDecls.count(ClassDecl)) { + if (!ObjCForwardDecls.count(ClassDecl)) { // we haven't seen a forward decl - generate a typedef. ResultStr = "#ifndef _REWRITER_typedef_"; ResultStr += ClassDecl->getName(); @@ -622,16 +622,16 @@ void RewriteTest::RewriteInterfaceDecl(ObjcInterfaceDecl *ClassDecl) { ResultStr += ";\n#endif\n"; // Mark this typedef as having been generated. - ObjcForwardDecls.insert(ClassDecl); + ObjCForwardDecls.insert(ClassDecl); } - SynthesizeObjcInternalStruct(ClassDecl, ResultStr); + SynthesizeObjCInternalStruct(ClassDecl, ResultStr); RewriteProperties(ClassDecl->getNumPropertyDecl(), ClassDecl->getPropertyDecl()); - for (ObjcInterfaceDecl::instmeth_iterator I = ClassDecl->instmeth_begin(), + for (ObjCInterfaceDecl::instmeth_iterator I = ClassDecl->instmeth_begin(), E = ClassDecl->instmeth_end(); I != E; ++I) RewriteMethodDeclaration(*I); - for (ObjcInterfaceDecl::classmeth_iterator I = ClassDecl->classmeth_begin(), + for (ObjCInterfaceDecl::classmeth_iterator I = ClassDecl->classmeth_begin(), E = ClassDecl->classmeth_end(); I != E; ++I) RewriteMethodDeclaration(*I); @@ -640,7 +640,7 @@ void RewriteTest::RewriteInterfaceDecl(ObjcInterfaceDecl *ClassDecl) { } Stmt *RewriteTest::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV) { - ObjcIvarDecl *D = IV->getDecl(); + ObjCIvarDecl *D = IV->getDecl(); if (IV->isFreeIvar()) { Expr *Replacement = new MemberExpr(IV->getBase(), true, D, IV->getLocation()); @@ -656,7 +656,7 @@ Stmt *RewriteTest::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV) { } else { if (CurMethodDecl) { if (const PointerType *pType = IV->getBase()->getType()->getAsPointerType()) { - ObjcInterfaceType *intT = dyn_cast(pType->getPointeeType()); + ObjCInterfaceType *intT = dyn_cast(pType->getPointeeType()); if (CurMethodDecl->getClassInterface() == intT->getDecl()) { IdentifierInfo *II = intT->getDecl()->getIdentifier(); RecordDecl *RD = new RecordDecl(Decl::Struct, SourceLocation(), @@ -729,11 +729,11 @@ Stmt *RewriteTest::RewriteFunctionBodyOrGlobalInitializer(Stmt *S) { return RewriteMessageExpr(MessExpr); } - if (ObjcAtTryStmt *StmtTry = dyn_cast(S)) - return RewriteObjcTryStmt(StmtTry); + if (ObjCAtTryStmt *StmtTry = dyn_cast(S)) + return RewriteObjCTryStmt(StmtTry); - if (ObjcAtThrowStmt *StmtThrow = dyn_cast(S)) - return RewriteObjcThrowStmt(StmtThrow); + if (ObjCAtThrowStmt *StmtThrow = dyn_cast(S)) + return RewriteObjCThrowStmt(StmtThrow); if (ObjCProtocolExpr *ProtocolExp = dyn_cast(S)) return RewriteObjCProtocolExpr(ProtocolExp); @@ -755,7 +755,7 @@ Stmt *RewriteTest::RewriteFunctionBodyOrGlobalInitializer(Stmt *S) { return S; } -Stmt *RewriteTest::RewriteObjcTryStmt(ObjcAtTryStmt *S) { +Stmt *RewriteTest::RewriteObjCTryStmt(ObjCAtTryStmt *S) { // Get the start location and compute the semi location. SourceLocation startLoc = S->getLocStart(); const char *startBuf = SM->getCharacterData(startLoc); @@ -792,7 +792,7 @@ Stmt *RewriteTest::RewriteObjcTryStmt(ObjcAtTryStmt *S) { bool sawIdTypedCatch = false; Stmt *lastCatchBody = 0; - ObjcAtCatchStmt *catchList = S->getCatchStmts(); + ObjCAtCatchStmt *catchList = S->getCatchStmts(); while (catchList) { Stmt *catchStmt = catchList->getCatchParamStmt(); @@ -809,15 +809,15 @@ Stmt *RewriteTest::RewriteObjcTryStmt(ObjcAtTryStmt *S) { if (DeclStmt *declStmt = dyn_cast(catchStmt)) { QualType t = dyn_cast(declStmt->getDecl())->getType(); - if (t == Context->getObjcIdType()) { + if (t == Context->getObjCIdType()) { buf += "1) { "; Rewrite.ReplaceText(startLoc, lParenLoc-startBuf+1, buf.c_str(), buf.size()); sawIdTypedCatch = true; } else if (const PointerType *pType = t->getAsPointerType()) { - ObjcInterfaceType *cls; // Should be a pointer to a class. + ObjCInterfaceType *cls; // Should be a pointer to a class. - cls = dyn_cast(pType->getPointeeType().getTypePtr()); + cls = dyn_cast(pType->getPointeeType().getTypePtr()); if (cls) { buf += "objc_exception_match((struct objc_class *)objc_getClass(\""; buf += cls->getDecl()->getName(); @@ -858,7 +858,7 @@ Stmt *RewriteTest::RewriteObjcTryStmt(ObjcAtTryStmt *S) { // Set lastCurlyLoc lastCurlyLoc = lastCatchBody->getLocEnd(); } - if (ObjcAtFinallyStmt *finalStmt = S->getFinallyStmt()) { + if (ObjCAtFinallyStmt *finalStmt = S->getFinallyStmt()) { startLoc = finalStmt->getLocStart(); startBuf = SM->getCharacterData(startLoc); assert((*startBuf == '@') && "bogus @finally start"); @@ -891,18 +891,18 @@ Stmt *RewriteTest::RewriteObjcTryStmt(ObjcAtTryStmt *S) { return 0; } -Stmt *RewriteTest::RewriteObjcCatchStmt(ObjcAtCatchStmt *S) { +Stmt *RewriteTest::RewriteObjCCatchStmt(ObjCAtCatchStmt *S) { return 0; } -Stmt *RewriteTest::RewriteObjcFinallyStmt(ObjcAtFinallyStmt *S) { +Stmt *RewriteTest::RewriteObjCFinallyStmt(ObjCAtFinallyStmt *S) { return 0; } // This can't be done with Rewrite.ReplaceStmt(S, ThrowExpr), since // the throw expression is typically a message expression that's already // been rewritten! (which implies the SourceLocation's are invalid). -Stmt *RewriteTest::RewriteObjcThrowStmt(ObjcAtThrowStmt *S) { +Stmt *RewriteTest::RewriteObjCThrowStmt(ObjCAtThrowStmt *S) { // Get the start location and compute the semi location. SourceLocation startLoc = S->getLocStart(); const char *startBuf = SM->getCharacterData(startLoc); @@ -925,7 +925,7 @@ Stmt *RewriteTest::RewriteAtEncode(ObjCEncodeExpr *Exp) { // Create a new string expression. QualType StrType = Context->getPointerType(Context->CharTy); std::string StrEncoding; - Context->getObjcEncodingForType(Exp->getEncodedType(), StrEncoding); + Context->getObjCEncodingForType(Exp->getEncodedType(), StrEncoding); Expr *Replacement = new StringLiteral(StrEncoding.c_str(), StrEncoding.length(), false, StrType, SourceLocation(), SourceLocation()); @@ -1012,21 +1012,21 @@ static void scanToNextArgument(const char *&argRef) { bool RewriteTest::needToScanForQualifiers(QualType T) { - if (T == Context->getObjcIdType()) + if (T == Context->getObjCIdType()) return true; - if (T->isObjcQualifiedIdType()) + if (T->isObjCQualifiedIdType()) return true; if (const PointerType *pType = T->getAsPointerType()) { Type *pointeeType = pType->getPointeeType().getTypePtr(); - if (isa(pointeeType)) + if (isa(pointeeType)) return true; // we have "Class *". } return false; } -void RewriteTest::RewriteObjcQualifiedInterfaceTypes(Decl *Dcl) { +void RewriteTest::RewriteObjCQualifiedInterfaceTypes(Decl *Dcl) { SourceLocation Loc; QualType Type; const FunctionTypeProto *proto = 0; @@ -1104,7 +1104,7 @@ void RewriteTest::SynthSelGetUidFunctionDecl() { llvm::SmallVector ArgTys; ArgTys.push_back(Context->getPointerType( Context->CharTy.getQualifiedType(QualType::Const))); - QualType getFuncType = Context->getFunctionType(Context->getObjcSelType(), + QualType getFuncType = Context->getFunctionType(Context->getObjCSelType(), &ArgTys[0], ArgTys.size(), false /*isVariadic*/); SelGetUidFunctionDecl = new FunctionDecl(SourceLocation(), @@ -1118,7 +1118,7 @@ void RewriteTest::SynthGetProtocolFunctionDecl() { llvm::SmallVector ArgTys; ArgTys.push_back(Context->getPointerType( Context->CharTy.getQualifiedType(QualType::Const))); - QualType getFuncType = Context->getFunctionType(Context->getObjcProtoType(), + QualType getFuncType = Context->getFunctionType(Context->getObjCProtoType(), &ArgTys[0], ArgTys.size(), false /*isVariadic*/); GetProtocolFunctionDecl = new FunctionDecl(SourceLocation(), @@ -1132,20 +1132,20 @@ void RewriteTest::RewriteFunctionDecl(FunctionDecl *FD) { SelGetUidFunctionDecl = FD; return; } - RewriteObjcQualifiedInterfaceTypes(FD); + RewriteObjCQualifiedInterfaceTypes(FD); } // SynthMsgSendFunctionDecl - id objc_msgSend(id self, SEL op, ...); void RewriteTest::SynthMsgSendFunctionDecl() { IdentifierInfo *msgSendIdent = &Context->Idents.get("objc_msgSend"); llvm::SmallVector ArgTys; - QualType argT = Context->getObjcIdType(); + QualType argT = Context->getObjCIdType(); assert(!argT.isNull() && "Can't find 'id' type"); ArgTys.push_back(argT); - argT = Context->getObjcSelType(); + argT = Context->getObjCSelType(); assert(!argT.isNull() && "Can't find 'SEL' type"); ArgTys.push_back(argT); - QualType msgSendType = Context->getFunctionType(Context->getObjcIdType(), + QualType msgSendType = Context->getFunctionType(Context->getObjCIdType(), &ArgTys[0], ArgTys.size(), true /*isVariadic*/); MsgSendFunctionDecl = new FunctionDecl(SourceLocation(), @@ -1162,10 +1162,10 @@ void RewriteTest::SynthMsgSendSuperFunctionDecl() { QualType argT = Context->getPointerType(Context->getTagDeclType(RD)); assert(!argT.isNull() && "Can't build 'struct objc_super *' type"); ArgTys.push_back(argT); - argT = Context->getObjcSelType(); + argT = Context->getObjCSelType(); assert(!argT.isNull() && "Can't find 'SEL' type"); ArgTys.push_back(argT); - QualType msgSendType = Context->getFunctionType(Context->getObjcIdType(), + QualType msgSendType = Context->getFunctionType(Context->getObjCIdType(), &ArgTys[0], ArgTys.size(), true /*isVariadic*/); MsgSendSuperFunctionDecl = new FunctionDecl(SourceLocation(), @@ -1177,13 +1177,13 @@ void RewriteTest::SynthMsgSendSuperFunctionDecl() { void RewriteTest::SynthMsgSendStretFunctionDecl() { IdentifierInfo *msgSendIdent = &Context->Idents.get("objc_msgSend_stret"); llvm::SmallVector ArgTys; - QualType argT = Context->getObjcIdType(); + QualType argT = Context->getObjCIdType(); assert(!argT.isNull() && "Can't find 'id' type"); ArgTys.push_back(argT); - argT = Context->getObjcSelType(); + argT = Context->getObjCSelType(); assert(!argT.isNull() && "Can't find 'SEL' type"); ArgTys.push_back(argT); - QualType msgSendType = Context->getFunctionType(Context->getObjcIdType(), + QualType msgSendType = Context->getFunctionType(Context->getObjCIdType(), &ArgTys[0], ArgTys.size(), true /*isVariadic*/); MsgSendStretFunctionDecl = new FunctionDecl(SourceLocation(), @@ -1202,10 +1202,10 @@ void RewriteTest::SynthMsgSendSuperStretFunctionDecl() { QualType argT = Context->getPointerType(Context->getTagDeclType(RD)); assert(!argT.isNull() && "Can't build 'struct objc_super *' type"); ArgTys.push_back(argT); - argT = Context->getObjcSelType(); + argT = Context->getObjCSelType(); assert(!argT.isNull() && "Can't find 'SEL' type"); ArgTys.push_back(argT); - QualType msgSendType = Context->getFunctionType(Context->getObjcIdType(), + QualType msgSendType = Context->getFunctionType(Context->getObjCIdType(), &ArgTys[0], ArgTys.size(), true /*isVariadic*/); MsgSendSuperStretFunctionDecl = new FunctionDecl(SourceLocation(), @@ -1217,13 +1217,13 @@ void RewriteTest::SynthMsgSendSuperStretFunctionDecl() { void RewriteTest::SynthMsgSendFpretFunctionDecl() { IdentifierInfo *msgSendIdent = &Context->Idents.get("objc_msgSend_fpret"); llvm::SmallVector ArgTys; - QualType argT = Context->getObjcIdType(); + QualType argT = Context->getObjCIdType(); assert(!argT.isNull() && "Can't find 'id' type"); ArgTys.push_back(argT); - argT = Context->getObjcSelType(); + argT = Context->getObjCSelType(); assert(!argT.isNull() && "Can't find 'SEL' type"); ArgTys.push_back(argT); - QualType msgSendType = Context->getFunctionType(Context->getObjcIdType(), + QualType msgSendType = Context->getFunctionType(Context->getObjCIdType(), &ArgTys[0], ArgTys.size(), true /*isVariadic*/); MsgSendFpretFunctionDecl = new FunctionDecl(SourceLocation(), @@ -1237,7 +1237,7 @@ void RewriteTest::SynthGetClassFunctionDecl() { llvm::SmallVector ArgTys; ArgTys.push_back(Context->getPointerType( Context->CharTy.getQualifiedType(QualType::Const))); - QualType getClassType = Context->getFunctionType(Context->getObjcIdType(), + QualType getClassType = Context->getFunctionType(Context->getObjCIdType(), &ArgTys[0], ArgTys.size(), false /*isVariadic*/); GetClassFunctionDecl = new FunctionDecl(SourceLocation(), @@ -1251,7 +1251,7 @@ void RewriteTest::SynthGetMetaClassFunctionDecl() { llvm::SmallVector ArgTys; ArgTys.push_back(Context->getPointerType( Context->CharTy.getQualifiedType(QualType::Const))); - QualType getClassType = Context->getFunctionType(Context->getObjcIdType(), + QualType getClassType = Context->getFunctionType(Context->getObjCIdType(), &ArgTys[0], ArgTys.size(), false /*isVariadic*/); GetMetaClassFunctionDecl = new FunctionDecl(SourceLocation(), @@ -1265,7 +1265,7 @@ void RewriteTest::SynthCFStringFunctionDecl() { llvm::SmallVector ArgTys; ArgTys.push_back(Context->getPointerType( Context->CharTy.getQualifiedType(QualType::Const))); - QualType getClassType = Context->getFunctionType(Context->getObjcIdType(), + QualType getClassType = Context->getFunctionType(Context->getObjCIdType(), &ArgTys[0], ArgTys.size(), false /*isVariadic*/); CFStringFunctionDecl = new FunctionDecl(SourceLocation(), @@ -1305,7 +1305,7 @@ Stmt *RewriteTest::RewriteObjCStringLiteral(ObjCStringLiteral *Exp) { QualType expType = Context->getPointerType(ClsRef->getType()); UnaryOperator *Unop = new UnaryOperator(ClsRef, UnaryOperator::AddrOf, expType, SourceLocation()); - CastExpr *cast = new CastExpr(Context->getObjcClassType(), Unop, + CastExpr *cast = new CastExpr(Context->getObjCClassType(), Unop, SourceLocation()); InitExprs.push_back(cast); // set the 'isa'. InitExprs.push_back(Exp->getString()); // set "char *bytes". @@ -1335,7 +1335,7 @@ Stmt *RewriteTest::RewriteObjCStringLiteral(ObjCStringLiteral *Exp) { #endif } -ObjcInterfaceDecl *RewriteTest::isSuperReceiver(Expr *recExpr) { +ObjCInterfaceDecl *RewriteTest::isSuperReceiver(Expr *recExpr) { // check if we are sending a message to 'super' if (CurMethodDecl && CurMethodDecl->isInstance()) { if (CastExpr *CE = dyn_cast(recExpr)) { @@ -1343,11 +1343,11 @@ ObjcInterfaceDecl *RewriteTest::isSuperReceiver(Expr *recExpr) { if (ParmVarDecl *PVD = dyn_cast(DRE->getDecl())) { if (!strcmp(PVD->getName(), "self")) { // is this id type? - if (CE->getType()->isObjcQualifiedIdType()) + if (CE->getType()->isObjCQualifiedIdType()) return 0; if (const PointerType *PT = CE->getType()->getAsPointerType()) { - if (ObjcInterfaceType *IT = - dyn_cast(PT->getPointeeType())) { + if (ObjCInterfaceType *IT = + dyn_cast(PT->getPointeeType())) { if (IT->getDecl() == CurMethodDecl->getClassInterface()->getSuperClass()) return IT->getDecl(); @@ -1369,9 +1369,9 @@ QualType RewriteTest::getSuperStructType() { QualType FieldTypes[2]; // struct objc_object *receiver; - FieldTypes[0] = Context->getObjcIdType(); + FieldTypes[0] = Context->getObjCIdType(); // struct objc_class *super; - FieldTypes[1] = Context->getObjcClassType(); + FieldTypes[1] = Context->getObjCClassType(); // Create fields FieldDecl *FieldDecls[2]; @@ -1405,7 +1405,7 @@ Stmt *RewriteTest::RewriteMessageExpr(ObjCMessageExpr *Exp) { FunctionDecl *MsgSendFlavor = MsgSendFunctionDecl; // May need to use objc_msgSend_stret() as well. FunctionDecl *MsgSendStretFlavor = 0; - if (ObjcMethodDecl *mDecl = Exp->getMethodDecl()) { + if (ObjCMethodDecl *mDecl = Exp->getMethodDecl()) { QualType resultType = mDecl->getResultType(); if (resultType.getCanonicalType()->isStructureType() || resultType.getCanonicalType()->isUnionType()) @@ -1426,14 +1426,14 @@ Stmt *RewriteTest::RewriteMessageExpr(ObjCMessageExpr *Exp) { MsgSendStretFlavor = MsgSendSuperStretFunctionDecl; assert(MsgSendFlavor && "MsgSendFlavor is NULL!"); - ObjcInterfaceDecl *SuperDecl = + ObjCInterfaceDecl *SuperDecl = CurMethodDecl->getClassInterface()->getSuperClass(); llvm::SmallVector InitExprs; // set the receiver to self, the first argument to all methods. InitExprs.push_back(new DeclRefExpr(CurMethodDecl->getSelfDecl(), - Context->getObjcIdType(), + Context->getObjCIdType(), SourceLocation())); llvm::SmallVector ClsExprs; QualType argType = Context->getPointerType(Context->CharTy); @@ -1446,7 +1446,7 @@ Stmt *RewriteTest::RewriteMessageExpr(ObjCMessageExpr *Exp) { ClsExprs.size()); // To turn off a warning, type-cast to 'id' InitExprs.push_back( - new CastExpr(Context->getObjcIdType(), + new CastExpr(Context->getObjCIdType(), Cls, SourceLocation())); // set 'super class', using objc_getClass(). // struct objc_super QualType superType = getSuperStructType(); @@ -1476,7 +1476,7 @@ Stmt *RewriteTest::RewriteMessageExpr(ObjCMessageExpr *Exp) { } else { // instance message. Expr *recExpr = Exp->getReceiver(); - if (ObjcInterfaceDecl *SuperDecl = isSuperReceiver(recExpr)) { + if (ObjCInterfaceDecl *SuperDecl = isSuperReceiver(recExpr)) { MsgSendFlavor = MsgSendSuperFunctionDecl; if (MsgSendStretFlavor) MsgSendStretFlavor = MsgSendSuperStretFunctionDecl; @@ -1485,7 +1485,7 @@ Stmt *RewriteTest::RewriteMessageExpr(ObjCMessageExpr *Exp) { llvm::SmallVector InitExprs; InitExprs.push_back( - new CastExpr(Context->getObjcIdType(), + new CastExpr(Context->getObjCIdType(), recExpr, SourceLocation())); // set the 'receiver'. llvm::SmallVector ClsExprs; @@ -1499,7 +1499,7 @@ Stmt *RewriteTest::RewriteMessageExpr(ObjCMessageExpr *Exp) { ClsExprs.size()); // To turn off a warning, type-cast to 'id' InitExprs.push_back( - new CastExpr(Context->getObjcIdType(), + new CastExpr(Context->getObjCIdType(), Cls, SourceLocation())); // set 'super class', using objc_getClass(). // struct objc_super QualType superType = getSuperStructType(); @@ -1519,7 +1519,7 @@ Stmt *RewriteTest::RewriteMessageExpr(ObjCMessageExpr *Exp) { // Foo *. while (CastExpr *CE = dyn_cast(recExpr)) recExpr = CE->getSubExpr(); - recExpr = new CastExpr(Context->getObjcIdType(), recExpr, SourceLocation()); + recExpr = new CastExpr(Context->getObjCIdType(), recExpr, SourceLocation()); MsgExprs.push_back(recExpr); } } @@ -1540,16 +1540,16 @@ Stmt *RewriteTest::RewriteMessageExpr(ObjCMessageExpr *Exp) { // Make all implicit casts explicit...ICE comes in handy:-) if (ImplicitCastExpr *ICE = dyn_cast(userExpr)) { // Reuse the ICE type, it is exactly what the doctor ordered. - userExpr = new CastExpr(ICE->getType()->isObjcQualifiedIdType() - ? Context->getObjcIdType() + userExpr = new CastExpr(ICE->getType()->isObjCQualifiedIdType() + ? Context->getObjCIdType() : ICE->getType(), userExpr, SourceLocation()); } // Make id cast into an 'id' cast. else if (CastExpr *CE = dyn_cast(userExpr)) { - if (CE->getType()->isObjcQualifiedIdType()) { + if (CE->getType()->isObjCQualifiedIdType()) { while ((CE = dyn_cast(userExpr))) userExpr = CE->getSubExpr(); - userExpr = new CastExpr(Context->getObjcIdType(), + userExpr = new CastExpr(Context->getObjCIdType(), userExpr, SourceLocation()); } } @@ -1567,20 +1567,20 @@ Stmt *RewriteTest::RewriteMessageExpr(ObjCMessageExpr *Exp) { if (MsgSendFlavor == MsgSendSuperFunctionDecl) ArgTypes.push_back(Context->getPointerType(getSuperStructType())); else - ArgTypes.push_back(Context->getObjcIdType()); - ArgTypes.push_back(Context->getObjcSelType()); - if (ObjcMethodDecl *mDecl = Exp->getMethodDecl()) { + ArgTypes.push_back(Context->getObjCIdType()); + ArgTypes.push_back(Context->getObjCSelType()); + if (ObjCMethodDecl *mDecl = Exp->getMethodDecl()) { // Push any user argument types. for (int i = 0; i < mDecl->getNumParams(); i++) { - QualType t = mDecl->getParamDecl(i)->getType()->isObjcQualifiedIdType() - ? Context->getObjcIdType() + QualType t = mDecl->getParamDecl(i)->getType()->isObjCQualifiedIdType() + ? Context->getObjCIdType() : mDecl->getParamDecl(i)->getType(); ArgTypes.push_back(t); } - returnType = mDecl->getResultType()->isObjcQualifiedIdType() - ? Context->getObjcIdType() : mDecl->getResultType(); + returnType = mDecl->getResultType()->isObjCQualifiedIdType() + ? Context->getObjCIdType() : mDecl->getResultType(); } else { - returnType = Context->getObjcIdType(); + returnType = Context->getObjCIdType(); } // Get the type, we will need to reference it in a couple spots. QualType msgSendType = MsgSendFlavor->getType(); @@ -1708,16 +1708,16 @@ Stmt *RewriteTest::RewriteObjCProtocolExpr(ObjCProtocolExpr *Exp) { } -/// SynthesizeObjcInternalStruct - Rewrite one internal struct corresponding to +/// SynthesizeObjCInternalStruct - Rewrite one internal struct corresponding to /// an objective-c class with ivars. -void RewriteTest::SynthesizeObjcInternalStruct(ObjcInterfaceDecl *CDecl, +void RewriteTest::SynthesizeObjCInternalStruct(ObjCInterfaceDecl *CDecl, std::string &Result) { - assert(CDecl && "Class missing in SynthesizeObjcInternalStruct"); - assert(CDecl->getName() && "Name missing in SynthesizeObjcInternalStruct"); + assert(CDecl && "Class missing in SynthesizeObjCInternalStruct"); + assert(CDecl->getName() && "Name missing in SynthesizeObjCInternalStruct"); // Do not synthesize more than once. - if (ObjcSynthesizedStructs.count(CDecl)) + if (ObjCSynthesizedStructs.count(CDecl)) return; - ObjcInterfaceDecl *RCDecl = CDecl->getSuperClass(); + ObjCInterfaceDecl *RCDecl = CDecl->getSuperClass(); int NumIvars = CDecl->getNumInstanceVariables(); SourceLocation LocStart = CDecl->getLocStart(); SourceLocation LocEnd = CDecl->getLocEnd(); @@ -1726,7 +1726,7 @@ void RewriteTest::SynthesizeObjcInternalStruct(ObjcInterfaceDecl *CDecl, const char *endBuf = SM->getCharacterData(LocEnd); // If no ivars and no root or if its root, directly or indirectly, // have no ivars (thus not synthesized) then no need to synthesize this class. - if (NumIvars <= 0 && (!RCDecl || !ObjcSynthesizedStructs.count(RCDecl))) { + if (NumIvars <= 0 && (!RCDecl || !ObjCSynthesizedStructs.count(RCDecl))) { endBuf += Lexer::MeasureTokenLength(LocEnd, *SM); Rewrite.ReplaceText(LocStart, endBuf-startBuf, Result.c_str(), Result.size()); @@ -1734,19 +1734,19 @@ void RewriteTest::SynthesizeObjcInternalStruct(ObjcInterfaceDecl *CDecl, } // FIXME: This has potential of causing problem. If - // SynthesizeObjcInternalStruct is ever called recursively. + // SynthesizeObjCInternalStruct is ever called recursively. Result += "\nstruct "; Result += CDecl->getName(); if (NumIvars > 0) { const char *cursor = strchr(startBuf, '{'); assert((cursor && endBuf) - && "SynthesizeObjcInternalStruct - malformed @interface"); + && "SynthesizeObjCInternalStruct - malformed @interface"); // rewrite the original header *without* disturbing the '{' Rewrite.ReplaceText(LocStart, cursor-startBuf-1, Result.c_str(), Result.size()); - if (RCDecl && ObjcSynthesizedStructs.count(RCDecl)) { + if (RCDecl && ObjCSynthesizedStructs.count(RCDecl)) { Result = "\n struct "; Result += RCDecl->getName(); // Note: We don't name the field decl. This simplifies the "codegen" for @@ -1806,13 +1806,13 @@ void RewriteTest::SynthesizeObjcInternalStruct(ObjcInterfaceDecl *CDecl, Result.c_str(), Result.size()); } // Mark this struct as having been generated. - if (!ObjcSynthesizedStructs.insert(CDecl)) - assert(false && "struct already synthesize- SynthesizeObjcInternalStruct"); + if (!ObjCSynthesizedStructs.insert(CDecl)) + assert(false && "struct already synthesize- SynthesizeObjCInternalStruct"); } -// RewriteObjcMethodsMetaData - Rewrite methods metadata for instance or +// RewriteObjCMethodsMetaData - Rewrite methods metadata for instance or /// class methods. -void RewriteTest::RewriteObjcMethodsMetaData(instmeth_iterator MethodBegin, +void RewriteTest::RewriteObjCMethodsMetaData(instmeth_iterator MethodBegin, instmeth_iterator MethodEnd, bool IsInstanceMethod, const char *prefix, @@ -1861,7 +1861,7 @@ void RewriteTest::RewriteObjcMethodsMetaData(instmeth_iterator MethodBegin, Result += "\t,{{(SEL)\""; Result += (*MethodBegin)->getSelector().getName().c_str(); std::string MethodTypeString; - Context->getObjcEncodingForMethodDecl(*MethodBegin, MethodTypeString); + Context->getObjCEncodingForMethodDecl(*MethodBegin, MethodTypeString); Result += "\", \""; Result += MethodTypeString; Result += "\", "; @@ -1871,7 +1871,7 @@ void RewriteTest::RewriteObjcMethodsMetaData(instmeth_iterator MethodBegin, Result += "\t ,{(SEL)\""; Result += (*MethodBegin)->getSelector().getName().c_str(); std::string MethodTypeString; - Context->getObjcEncodingForMethodDecl(*MethodBegin, MethodTypeString); + Context->getObjCEncodingForMethodDecl(*MethodBegin, MethodTypeString); Result += "\", \""; Result += MethodTypeString; Result += "\", "; @@ -1881,8 +1881,8 @@ void RewriteTest::RewriteObjcMethodsMetaData(instmeth_iterator MethodBegin, Result += "\t }\n};\n"; } -/// RewriteObjcProtocolsMetaData - Rewrite protocols meta-data. -void RewriteTest::RewriteObjcProtocolsMetaData(ObjcProtocolDecl **Protocols, +/// RewriteObjCProtocolsMetaData - Rewrite protocols meta-data. +void RewriteTest::RewriteObjCProtocolsMetaData(ObjCProtocolDecl **Protocols, int NumProtocols, const char *prefix, const char *ClassName, @@ -1890,7 +1890,7 @@ void RewriteTest::RewriteObjcProtocolsMetaData(ObjcProtocolDecl **Protocols, static bool objc_protocol_methods = false; if (NumProtocols > 0) { for (int i = 0; i < NumProtocols; i++) { - ObjcProtocolDecl *PDecl = Protocols[i]; + ObjCProtocolDecl *PDecl = Protocols[i]; // Output struct protocol_methods holder of method selector and type. if (!objc_protocol_methods && (PDecl->getNumInstanceMethods() > 0 @@ -1925,7 +1925,7 @@ void RewriteTest::RewriteObjcProtocolsMetaData(ObjcProtocolDecl **Protocols, "{\n\t" + utostr(NumMethods) + "\n"; // Output instance methods declared in this protocol. - for (ObjcProtocolDecl::instmeth_iterator I = PDecl->instmeth_begin(), + for (ObjCProtocolDecl::instmeth_iterator I = PDecl->instmeth_begin(), E = PDecl->instmeth_end(); I != E; ++I) { if (I == PDecl->instmeth_begin()) Result += "\t ,{{(SEL)\""; @@ -1933,7 +1933,7 @@ void RewriteTest::RewriteObjcProtocolsMetaData(ObjcProtocolDecl **Protocols, Result += "\t ,{(SEL)\""; Result += (*I)->getSelector().getName().c_str(); std::string MethodTypeString; - Context->getObjcEncodingForMethodDecl((*I), MethodTypeString); + Context->getObjCEncodingForMethodDecl((*I), MethodTypeString); Result += "\", \""; Result += MethodTypeString; Result += "\"}\n"; @@ -1953,7 +1953,7 @@ void RewriteTest::RewriteObjcProtocolsMetaData(ObjcProtocolDecl **Protocols, Result += "\n"; // Output instance methods declared in this protocol. - for (ObjcProtocolDecl::classmeth_iterator I = PDecl->classmeth_begin(), + for (ObjCProtocolDecl::classmeth_iterator I = PDecl->classmeth_begin(), E = PDecl->classmeth_end(); I != E; ++I) { if (I == PDecl->classmeth_begin()) Result += "\t ,{{(SEL)\""; @@ -1961,7 +1961,7 @@ void RewriteTest::RewriteObjcProtocolsMetaData(ObjcProtocolDecl **Protocols, Result += "\t ,{(SEL)\""; Result += (*I)->getSelector().getName().c_str(); std::string MethodTypeString; - Context->getObjcEncodingForMethodDecl((*I), MethodTypeString); + Context->getObjCEncodingForMethodDecl((*I), MethodTypeString); Result += "\", \""; Result += MethodTypeString; Result += "\"}\n"; @@ -2039,7 +2039,7 @@ void RewriteTest::RewriteObjcProtocolsMetaData(ObjcProtocolDecl **Protocols, Result += " \n"; for (int i = 1; i < NumProtocols; i++) { - ObjcProtocolDecl *PDecl = Protocols[i]; + ObjCProtocolDecl *PDecl = Protocols[i]; Result += "\t ,&_OBJC_PROTOCOL_"; Result += PDecl->getName(); Result += "\n"; @@ -2048,13 +2048,13 @@ void RewriteTest::RewriteObjcProtocolsMetaData(ObjcProtocolDecl **Protocols, } } -/// RewriteObjcCategoryImplDecl - Rewrite metadata for each category +/// RewriteObjCCategoryImplDecl - Rewrite metadata for each category /// implementation. -void RewriteTest::RewriteObjcCategoryImplDecl(ObjcCategoryImplDecl *IDecl, +void RewriteTest::RewriteObjCCategoryImplDecl(ObjCCategoryImplDecl *IDecl, std::string &Result) { - ObjcInterfaceDecl *ClassDecl = IDecl->getClassInterface(); + ObjCInterfaceDecl *ClassDecl = IDecl->getClassInterface(); // Find category declaration for this implementation. - ObjcCategoryDecl *CDecl; + ObjCCategoryDecl *CDecl; for (CDecl = ClassDecl->getCategoryList(); CDecl; CDecl = CDecl->getNextClassCategory()) if (CDecl->getIdentifier() == IDecl->getIdentifier()) @@ -2065,19 +2065,19 @@ void RewriteTest::RewriteObjcCategoryImplDecl(ObjcCategoryImplDecl *IDecl, FullCategoryName += IDecl->getName(); // Build _objc_method_list for class's instance methods if needed - RewriteObjcMethodsMetaData(IDecl->instmeth_begin(), IDecl->instmeth_end(), + RewriteObjCMethodsMetaData(IDecl->instmeth_begin(), IDecl->instmeth_end(), true, "CATEGORY_", FullCategoryName.c_str(), Result); // Build _objc_method_list for class's class methods if needed - RewriteObjcMethodsMetaData(IDecl->classmeth_begin(), IDecl->classmeth_end(), + RewriteObjCMethodsMetaData(IDecl->classmeth_begin(), IDecl->classmeth_end(), false, "CATEGORY_", FullCategoryName.c_str(), Result); // Protocols referenced in class declaration? // Null CDecl is case of a category implementation with no category interface if (CDecl) - RewriteObjcProtocolsMetaData(CDecl->getReferencedProtocols(), + RewriteObjCProtocolsMetaData(CDecl->getReferencedProtocols(), CDecl->getNumReferencedProtocols(), "CATEGORY", FullCategoryName.c_str(), Result); @@ -2145,8 +2145,8 @@ void RewriteTest::RewriteObjcCategoryImplDecl(ObjcCategoryImplDecl *IDecl, /// SynthesizeIvarOffsetComputation - This rutine synthesizes computation of /// ivar offset. -void RewriteTest::SynthesizeIvarOffsetComputation(ObjcImplementationDecl *IDecl, - ObjcIvarDecl *ivar, +void RewriteTest::SynthesizeIvarOffsetComputation(ObjCImplementationDecl *IDecl, + ObjCIvarDecl *ivar, std::string &Result) { Result += "offsetof(struct "; Result += IDecl->getName(); @@ -2159,15 +2159,15 @@ void RewriteTest::SynthesizeIvarOffsetComputation(ObjcImplementationDecl *IDecl, // Meta Data Emission //===----------------------------------------------------------------------===// -void RewriteTest::RewriteObjcClassMetaData(ObjcImplementationDecl *IDecl, +void RewriteTest::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl, std::string &Result) { - ObjcInterfaceDecl *CDecl = IDecl->getClassInterface(); + ObjCInterfaceDecl *CDecl = IDecl->getClassInterface(); // Explictly declared @interface's are already synthesized. if (CDecl->ImplicitInterfaceDecl()) { // FIXME: Implementation of a class with no @interface (legacy) doese not // produce correct synthesis as yet. - SynthesizeObjcInternalStruct(CDecl, Result); + SynthesizeObjCInternalStruct(CDecl, Result); } // Build _objc_ivar_list metadata for classes ivars if needed @@ -2207,7 +2207,7 @@ void RewriteTest::RewriteObjcClassMetaData(ObjcImplementationDecl *IDecl, Result += utostr(NumIvars); Result += "\n"; - ObjcInterfaceDecl::ivar_iterator IVI, IVE; + ObjCInterfaceDecl::ivar_iterator IVI, IVE; if (IDecl->getImplDeclNumIvars() > 0) { IVI = IDecl->ivar_begin(); IVE = IDecl->ivar_end(); @@ -2219,7 +2219,7 @@ void RewriteTest::RewriteObjcClassMetaData(ObjcImplementationDecl *IDecl, Result += (*IVI)->getName(); Result += "\", \""; std::string StrEncoding; - Context->getObjcEncodingForType((*IVI)->getType(), StrEncoding); + Context->getObjCEncodingForType((*IVI)->getType(), StrEncoding); Result += StrEncoding; Result += "\", "; SynthesizeIvarOffsetComputation(IDecl, *IVI, Result); @@ -2229,7 +2229,7 @@ void RewriteTest::RewriteObjcClassMetaData(ObjcImplementationDecl *IDecl, Result += (*IVI)->getName(); Result += "\", \""; std::string StrEncoding; - Context->getObjcEncodingForType((*IVI)->getType(), StrEncoding); + Context->getObjCEncodingForType((*IVI)->getType(), StrEncoding); Result += StrEncoding; Result += "\", "; SynthesizeIvarOffsetComputation(IDecl, (*IVI), Result); @@ -2240,15 +2240,15 @@ void RewriteTest::RewriteObjcClassMetaData(ObjcImplementationDecl *IDecl, } // Build _objc_method_list for class's instance methods if needed - RewriteObjcMethodsMetaData(IDecl->instmeth_begin(), IDecl->instmeth_end(), + RewriteObjCMethodsMetaData(IDecl->instmeth_begin(), IDecl->instmeth_end(), true, "", IDecl->getName(), Result); // Build _objc_method_list for class's class methods if needed - RewriteObjcMethodsMetaData(IDecl->classmeth_begin(), IDecl->classmeth_end(), + RewriteObjCMethodsMetaData(IDecl->classmeth_begin(), IDecl->classmeth_end(), false, "", IDecl->getName(), Result); // Protocols referenced in class declaration? - RewriteObjcProtocolsMetaData(CDecl->getReferencedProtocols(), + RewriteObjCProtocolsMetaData(CDecl->getReferencedProtocols(), CDecl->getNumIntfRefProtocols(), "CLASS", CDecl->getName(), Result); @@ -2289,8 +2289,8 @@ void RewriteTest::RewriteObjcClassMetaData(ObjcImplementationDecl *IDecl, } // Meta-class metadata generation. - ObjcInterfaceDecl *RootClass = 0; - ObjcInterfaceDecl *SuperClass = CDecl->getSuperClass(); + ObjCInterfaceDecl *RootClass = 0; + ObjCInterfaceDecl *SuperClass = CDecl->getSuperClass(); while (SuperClass) { RootClass = SuperClass; SuperClass = SuperClass->getSuperClass(); @@ -2316,7 +2316,7 @@ void RewriteTest::RewriteObjcClassMetaData(ObjcImplementationDecl *IDecl, Result += CDecl->getName(); Result += "\""; } - // Set 'ivars' field for root class to 0. Objc1 runtime does not use it. + // Set 'ivars' field for root class to 0. ObjC1 runtime does not use it. // 'info' field is initialized to CLS_META(2) for metaclass Result += ", 0,2, sizeof(struct _objc_class), 0"; if (IDecl->getNumClassMethods() > 0) { @@ -2355,7 +2355,7 @@ void RewriteTest::RewriteObjcClassMetaData(ObjcImplementationDecl *IDecl, } // 'info' field is initialized to CLS_CLASS(1) for class Result += ", 0,1"; - if (!ObjcSynthesizedStructs.count(CDecl)) + if (!ObjCSynthesizedStructs.count(CDecl)) Result += ",0"; else { // class has size. Must synthesize its size. @@ -2408,11 +2408,11 @@ void RewriteTest::RewriteImplementations(std::string &Result) { // For each implemented class, write out all its meta data. for (int i = 0; i < ClsDefCount; i++) - RewriteObjcClassMetaData(ClassImplementation[i], Result); + RewriteObjCClassMetaData(ClassImplementation[i], Result); // For each implemented category, write out all its meta data. for (int i = 0; i < CatDefCount; i++) - RewriteObjcCategoryImplDecl(CategoryImplementation[i], Result); + RewriteObjCCategoryImplDecl(CategoryImplementation[i], Result); // Write objc_symtab metadata /* diff --git a/Parse/ParseObjc.cpp b/Parse/ParseObjc.cpp index 2c6a9ceb94..989f1dce17 100644 --- a/Parse/ParseObjc.cpp +++ b/Parse/ParseObjc.cpp @@ -1,4 +1,4 @@ -//===--- ParseObjc.cpp - Objective C Parsing ------------------------------===// +//===--- ParseObjC.cpp - Objective C Parsing ------------------------------===// // // The LLVM Compiler Infrastructure // @@ -298,20 +298,20 @@ void Parser::ParseObjCInterfaceDeclList(DeclTy *interfaceDecl, /// copy /// nonatomic /// -void Parser::ParseObjCPropertyAttribute (ObjcDeclSpec &DS) { +void Parser::ParseObjCPropertyAttribute (ObjCDeclSpec &DS) { SourceLocation loc = ConsumeParen(); // consume '(' while (isObjCPropertyAttribute()) { const IdentifierInfo *II = Tok.getIdentifierInfo(); // getter/setter require extra treatment. - if (II == ObjcPropertyAttrs[objc_getter] || - II == ObjcPropertyAttrs[objc_setter]) { + if (II == ObjCPropertyAttrs[objc_getter] || + II == ObjCPropertyAttrs[objc_setter]) { // skip getter/setter part. SourceLocation loc = ConsumeToken(); if (Tok.is(tok::equal)) { loc = ConsumeToken(); if (Tok.is(tok::identifier)) { - if (II == ObjcPropertyAttrs[objc_setter]) { - DS.setPropertyAttributes(ObjcDeclSpec::DQ_PR_setter); + if (II == ObjCPropertyAttrs[objc_setter]) { + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_setter); DS.setSetterName(Tok.getIdentifierInfo()); loc = ConsumeToken(); // consume method name if (Tok.isNot(tok::colon)) { @@ -321,7 +321,7 @@ void Parser::ParseObjCPropertyAttribute (ObjcDeclSpec &DS) { } } else { - DS.setPropertyAttributes(ObjcDeclSpec::DQ_PR_getter); + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_getter); DS.setGetterName(Tok.getIdentifierInfo()); } } @@ -338,18 +338,18 @@ void Parser::ParseObjCPropertyAttribute (ObjcDeclSpec &DS) { } } - else if (II == ObjcPropertyAttrs[objc_readonly]) - DS.setPropertyAttributes(ObjcDeclSpec::DQ_PR_readonly); - else if (II == ObjcPropertyAttrs[objc_assign]) - DS.setPropertyAttributes(ObjcDeclSpec::DQ_PR_assign); - else if (II == ObjcPropertyAttrs[objc_readwrite]) - DS.setPropertyAttributes(ObjcDeclSpec::DQ_PR_readwrite); - else if (II == ObjcPropertyAttrs[objc_retain]) - DS.setPropertyAttributes(ObjcDeclSpec::DQ_PR_retain); - else if (II == ObjcPropertyAttrs[objc_copy]) - DS.setPropertyAttributes(ObjcDeclSpec::DQ_PR_copy); - else if (II == ObjcPropertyAttrs[objc_nonatomic]) - DS.setPropertyAttributes(ObjcDeclSpec::DQ_PR_nonatomic); + else if (II == ObjCPropertyAttrs[objc_readonly]) + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_readonly); + else if (II == ObjCPropertyAttrs[objc_assign]) + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_assign); + else if (II == ObjCPropertyAttrs[objc_readwrite]) + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_readwrite); + else if (II == ObjCPropertyAttrs[objc_retain]) + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_retain); + else if (II == ObjCPropertyAttrs[objc_copy]) + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_copy); + else if (II == ObjCPropertyAttrs[objc_nonatomic]) + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_nonatomic); ConsumeToken(); // consume last attribute token if (Tok.is(tok::comma)) { @@ -378,7 +378,7 @@ Parser::DeclTy *Parser::ParseObjCPropertyDecl(DeclTy *interfaceDecl, SourceLocation AtLoc) { assert(Tok.isObjCAtKeyword(tok::objc_property) && "ParseObjCPropertyDecl(): Expected @property"); - ObjcDeclSpec DS; + ObjCDeclSpec DS; ConsumeToken(); // the "property" identifier // Parse property attribute list, if any. if (Tok.is(tok::l_paren)) { @@ -394,7 +394,7 @@ Parser::DeclTy *Parser::ParseObjCPropertyDecl(DeclTy *interfaceDecl, Diag(Tok, diag::err_expected_semi_decl_list); SkipUntil(tok::r_brace, true, true); } - return Actions.ActOnAddObjcProperties(AtLoc, + return Actions.ActOnAddObjCProperties(AtLoc, &PropertyDecls[0], PropertyDecls.size(), DS); } @@ -486,7 +486,7 @@ bool Parser::isObjCPropertyAttribute() { if (Tok.is(tok::identifier)) { const IdentifierInfo *II = Tok.getIdentifierInfo(); for (unsigned i = 0; i < objc_NumAttrs; ++i) - if (II == ObjcPropertyAttrs[i]) return true; + if (II == ObjCPropertyAttrs[i]) return true; } return false; } @@ -501,7 +501,7 @@ bool Parser::isTokIdentifier_in() const { Tok.getIdentifierInfo() == ObjCForCollectionInKW); } -/// ParseObjcTypeQualifierList - This routine parses the objective-c's type +/// ParseObjCTypeQualifierList - This routine parses the objective-c's type /// qualifier list and builds their bitmask representation in the input /// argument. /// @@ -509,27 +509,27 @@ bool Parser::isTokIdentifier_in() const { /// objc-type-qualifier /// objc-type-qualifiers objc-type-qualifier /// -void Parser::ParseObjcTypeQualifierList(ObjcDeclSpec &DS) { +void Parser::ParseObjCTypeQualifierList(ObjCDeclSpec &DS) { while (1) { if (Tok.isNot(tok::identifier)) return; const IdentifierInfo *II = Tok.getIdentifierInfo(); for (unsigned i = 0; i != objc_NumQuals; ++i) { - if (II != ObjcTypeQuals[i]) + if (II != ObjCTypeQuals[i]) continue; - ObjcDeclSpec::ObjcDeclQualifier Qual; + ObjCDeclSpec::ObjCDeclQualifier Qual; switch (i) { default: assert(0 && "Unknown decl qualifier"); - case objc_in: Qual = ObjcDeclSpec::DQ_In; break; - case objc_out: Qual = ObjcDeclSpec::DQ_Out; break; - case objc_inout: Qual = ObjcDeclSpec::DQ_Inout; break; - case objc_oneway: Qual = ObjcDeclSpec::DQ_Oneway; break; - case objc_bycopy: Qual = ObjcDeclSpec::DQ_Bycopy; break; - case objc_byref: Qual = ObjcDeclSpec::DQ_Byref; break; + case objc_in: Qual = ObjCDeclSpec::DQ_In; break; + case objc_out: Qual = ObjCDeclSpec::DQ_Out; break; + case objc_inout: Qual = ObjCDeclSpec::DQ_Inout; break; + case objc_oneway: Qual = ObjCDeclSpec::DQ_Oneway; break; + case objc_bycopy: Qual = ObjCDeclSpec::DQ_Bycopy; break; + case objc_byref: Qual = ObjCDeclSpec::DQ_Byref; break; } - DS.setObjcDeclQualifier(Qual); + DS.setObjCDeclQualifier(Qual); ConsumeToken(); II = 0; break; @@ -544,14 +544,14 @@ void Parser::ParseObjcTypeQualifierList(ObjcDeclSpec &DS) { /// '(' objc-type-qualifiers[opt] type-name ')' /// '(' objc-type-qualifiers[opt] ')' /// -Parser::TypeTy *Parser::ParseObjCTypeName(ObjcDeclSpec &DS) { +Parser::TypeTy *Parser::ParseObjCTypeName(ObjCDeclSpec &DS) { assert(Tok.is(tok::l_paren) && "expected ("); SourceLocation LParenLoc = ConsumeParen(), RParenLoc; TypeTy *Ty = 0; // Parse type qualifiers, in, inout, etc. - ParseObjcTypeQualifierList(DS); + ParseObjCTypeQualifierList(DS); if (isTypeSpecifierQualifier()) { Ty = ParseTypeName(); @@ -601,7 +601,7 @@ Parser::DeclTy *Parser::ParseObjCMethodDecl(SourceLocation mLoc, { // Parse the return type. TypeTy *ReturnType = 0; - ObjcDeclSpec DSRet; + ObjCDeclSpec DSRet; if (Tok.is(tok::l_paren)) ReturnType = ParseObjCTypeName(DSRet); SourceLocation selLoc; @@ -626,7 +626,7 @@ Parser::DeclTy *Parser::ParseObjCMethodDecl(SourceLocation mLoc, llvm::SmallVector KeyIdents; llvm::SmallVector KeyTypes; - llvm::SmallVector ArgTypeQuals; + llvm::SmallVector ArgTypeQuals; llvm::SmallVector ArgNames; Action::TypeTy *TypeInfo; @@ -639,7 +639,7 @@ Parser::DeclTy *Parser::ParseObjCMethodDecl(SourceLocation mLoc, break; } ConsumeToken(); // Eat the ':'. - ObjcDeclSpec DSType; + ObjCDeclSpec DSType; if (Tok.is(tok::l_paren)) { // Parse the argument type. TypeInfo = ParseObjCTypeName(DSType); } @@ -960,7 +960,7 @@ Parser::DeclTy *Parser::ParseObjCAtImplementationDeclaration( DeclTy *ImplCatType = Actions.ActOnStartCategoryImplementation( atLoc, nameId, nameLoc, categoryId, categoryLoc); - ObjcImpDecl = ImplCatType; + ObjCImpDecl = ImplCatType; return 0; } // We have a class implementation @@ -982,7 +982,7 @@ Parser::DeclTy *Parser::ParseObjCAtImplementationDeclaration( if (Tok.is(tok::l_brace)) // we have ivars ParseObjCClassInstanceVariables(ImplClsType/*FIXME*/, atLoc); - ObjcImpDecl = ImplClsType; + ObjCImpDecl = ImplClsType; return 0; } @@ -991,14 +991,14 @@ Parser::DeclTy *Parser::ParseObjCAtEndDeclaration(SourceLocation atLoc) { assert(Tok.isObjCAtKeyword(tok::objc_end) && "ParseObjCAtEndDeclaration(): Expected @end"); ConsumeToken(); // the "end" identifier - if (ObjcImpDecl) { + if (ObjCImpDecl) { // Checking is not necessary except that a parse error might have caused - // @implementation not to have been parsed to completion and ObjcImpDecl + // @implementation not to have been parsed to completion and ObjCImpDecl // could be 0. - Actions.ActOnAtEnd(atLoc, ObjcImpDecl); + Actions.ActOnAtEnd(atLoc, ObjCImpDecl); } - return ObjcImpDecl; + return ObjCImpDecl; } /// compatibility-alias-decl: @@ -1109,7 +1109,7 @@ Parser::StmtResult Parser::ParseObjCThrowStmt(SourceLocation atLoc) { } } ConsumeToken(); // consume ';' - return Actions.ActOnObjcAtThrowStmt(atLoc, Res.Val); + return Actions.ActOnObjCAtThrowStmt(atLoc, Res.Val); } /// objc-try-catch-statement: @@ -1160,7 +1160,7 @@ Parser::StmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) { StmtResult CatchBody = ParseCompoundStatementBody(); if (CatchBody.isInvalid) CatchBody = Actions.ActOnNullStmt(Tok.getLocation()); - CatchStmts = Actions.ActOnObjcAtCatchStmt(AtCatchFinallyLoc, RParenLoc, + CatchStmts = Actions.ActOnObjCAtCatchStmt(AtCatchFinallyLoc, RParenLoc, FirstPart, CatchBody.Val, CatchStmts.Val); ExitScope(); } @@ -1176,7 +1176,7 @@ Parser::StmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) { StmtResult FinallyBody = ParseCompoundStatementBody(); if (FinallyBody.isInvalid) FinallyBody = Actions.ActOnNullStmt(Tok.getLocation()); - FinallyStmt = Actions.ActOnObjcAtFinallyStmt(AtCatchFinallyLoc, + FinallyStmt = Actions.ActOnObjCAtFinallyStmt(AtCatchFinallyLoc, FinallyBody.Val); catch_or_finally_seen = true; break; @@ -1186,14 +1186,14 @@ Parser::StmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) { Diag(atLoc, diag::err_missing_catch_finally); return true; } - return Actions.ActOnObjcAtTryStmt(atLoc, TryBody.Val, CatchStmts.Val, + return Actions.ActOnObjCAtTryStmt(atLoc, TryBody.Val, CatchStmts.Val, FinallyStmt.Val); } /// objc-method-def: objc-method-proto ';'[opt] '{' body '}' /// Parser::DeclTy *Parser::ParseObjCMethodDefinition() { - DeclTy *MDecl = ParseObjCMethodPrototype(ObjcImpDecl); + DeclTy *MDecl = ParseObjCMethodPrototype(ObjCImpDecl); // parse optional ';' if (Tok.is(tok::semi)) ConsumeToken(); @@ -1216,7 +1216,7 @@ Parser::DeclTy *Parser::ParseObjCMethodDefinition() { // Tell the actions module that we have entered a method definition with the // specified Declarator for the method. - Actions.ObjcActOnStartOfMethodDef(CurScope, MDecl); + Actions.ObjCActOnStartOfMethodDef(CurScope, MDecl); StmtResult FnBody = ParseCompoundStatementBody(); diff --git a/Parse/ParseStmt.cpp b/Parse/ParseStmt.cpp index 8cccf23888..688cfe792e 100644 --- a/Parse/ParseStmt.cpp +++ b/Parse/ParseStmt.cpp @@ -846,7 +846,7 @@ Parser::StmtResult Parser::ParseForStatement() { return Actions.ActOnForStmt(ForLoc, LParenLoc, FirstPart, SecondPart, ThirdPart, RParenLoc, Body.Val); else - return Actions.ActOnObjcForCollectionStmt(ForLoc, LParenLoc, FirstPart, + return Actions.ActOnObjCForCollectionStmt(ForLoc, LParenLoc, FirstPart, SecondPart, RParenLoc, Body.Val); } diff --git a/Parse/Parser.cpp b/Parse/Parser.cpp index 4bcbfc7c21..cc2c5d90c9 100644 --- a/Parse/Parser.cpp +++ b/Parse/Parser.cpp @@ -22,7 +22,7 @@ Parser::Parser(Preprocessor &pp, Action &actions) CurScope = 0; NumCachedScopes = 0; ParenCount = BracketCount = BraceCount = 0; - ObjcImpDecl = 0; + ObjCImpDecl = 0; } /// Out-of-line virtual destructor to provide home for Action class. @@ -234,25 +234,25 @@ void Parser::Initialize() { Diag(Tok, diag::ext_empty_source_file); // Initialization for Objective-C context sensitive keywords recognition. - // Referenced in Parser::ParseObjcTypeQualifierList. + // Referenced in Parser::ParseObjCTypeQualifierList. if (getLang().ObjC1) { - ObjcTypeQuals[objc_in] = &PP.getIdentifierTable().get("in"); - ObjcTypeQuals[objc_out] = &PP.getIdentifierTable().get("out"); - ObjcTypeQuals[objc_inout] = &PP.getIdentifierTable().get("inout"); - ObjcTypeQuals[objc_oneway] = &PP.getIdentifierTable().get("oneway"); - ObjcTypeQuals[objc_bycopy] = &PP.getIdentifierTable().get("bycopy"); - ObjcTypeQuals[objc_byref] = &PP.getIdentifierTable().get("byref"); + ObjCTypeQuals[objc_in] = &PP.getIdentifierTable().get("in"); + ObjCTypeQuals[objc_out] = &PP.getIdentifierTable().get("out"); + ObjCTypeQuals[objc_inout] = &PP.getIdentifierTable().get("inout"); + ObjCTypeQuals[objc_oneway] = &PP.getIdentifierTable().get("oneway"); + ObjCTypeQuals[objc_bycopy] = &PP.getIdentifierTable().get("bycopy"); + ObjCTypeQuals[objc_byref] = &PP.getIdentifierTable().get("byref"); } if (getLang().ObjC2) { - ObjcPropertyAttrs[objc_readonly] = &PP.getIdentifierTable().get("readonly"); - ObjcPropertyAttrs[objc_getter] = &PP.getIdentifierTable().get("getter"); - ObjcPropertyAttrs[objc_setter] = &PP.getIdentifierTable().get("setter"); - ObjcPropertyAttrs[objc_assign] = &PP.getIdentifierTable().get("assign"); - ObjcPropertyAttrs[objc_readwrite] = + ObjCPropertyAttrs[objc_readonly] = &PP.getIdentifierTable().get("readonly"); + ObjCPropertyAttrs[objc_getter] = &PP.getIdentifierTable().get("getter"); + ObjCPropertyAttrs[objc_setter] = &PP.getIdentifierTable().get("setter"); + ObjCPropertyAttrs[objc_assign] = &PP.getIdentifierTable().get("assign"); + ObjCPropertyAttrs[objc_readwrite] = &PP.getIdentifierTable().get("readwrite"); - ObjcPropertyAttrs[objc_retain] = &PP.getIdentifierTable().get("retain"); - ObjcPropertyAttrs[objc_copy] = &PP.getIdentifierTable().get("copy"); - ObjcPropertyAttrs[objc_nonatomic] = + ObjCPropertyAttrs[objc_retain] = &PP.getIdentifierTable().get("retain"); + ObjCPropertyAttrs[objc_copy] = &PP.getIdentifierTable().get("copy"); + ObjCPropertyAttrs[objc_nonatomic] = &PP.getIdentifierTable().get("nonatomic"); ObjCForCollectionInKW = &PP.getIdentifierTable().get("in"); } diff --git a/Sema/Sema.cpp b/Sema/Sema.cpp index b33e782077..a51b0751f5 100644 --- a/Sema/Sema.cpp +++ b/Sema/Sema.cpp @@ -20,24 +20,24 @@ using namespace clang; -bool Sema::isBuiltinObjcType(TypedefDecl *TD) { +bool Sema::isBuiltinObjCType(TypedefDecl *TD) { const char *typeName = TD->getIdentifier()->getName(); return strcmp(typeName, "id") == 0 || strcmp(typeName, "Class") == 0 || strcmp(typeName, "SEL") == 0 || strcmp(typeName, "Protocol") == 0; } -bool Sema::isObjcObjectPointerType(QualType type) const { - if (!type->isPointerType() && !type->isObjcQualifiedIdType()) +bool Sema::isObjCObjectPointerType(QualType type) const { + if (!type->isPointerType() && !type->isObjCQualifiedIdType()) return false; - if (type == Context.getObjcIdType() || type == Context.getObjcClassType() || - type->isObjcQualifiedIdType()) + if (type == Context.getObjCIdType() || type == Context.getObjCClassType() || + type->isObjCQualifiedIdType()) return true; if (type->isPointerType()) { PointerType *pointerType = static_cast(type.getTypePtr()); type = pointerType->getPointeeType(); } - return (type->isObjcInterfaceType() || type->isObjcQualifiedIdType()); + return (type->isObjCInterfaceType() || type->isObjCQualifiedIdType()); } void Sema::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) { @@ -46,17 +46,17 @@ void Sema::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) { TypedefType *t; // Add the built-in ObjC types. - t = dyn_cast(Context.getObjcIdType().getTypePtr()); + t = dyn_cast(Context.getObjCIdType().getTypePtr()); t->getDecl()->getIdentifier()->setFETokenInfo(t->getDecl()); TUScope->AddDecl(t->getDecl()); - t = dyn_cast(Context.getObjcClassType().getTypePtr()); + t = dyn_cast(Context.getObjCClassType().getTypePtr()); t->getDecl()->getIdentifier()->setFETokenInfo(t->getDecl()); TUScope->AddDecl(t->getDecl()); - ObjcInterfaceType *it = dyn_cast(Context.getObjcProtoType()); - ObjcInterfaceDecl *IDecl = it->getDecl(); + ObjCInterfaceType *it = dyn_cast(Context.getObjCProtoType()); + ObjCInterfaceDecl *IDecl = it->getDecl(); IDecl->getIdentifier()->setFETokenInfo(IDecl); TUScope->AddDecl(IDecl); - t = dyn_cast(Context.getObjcSelType().getTypePtr()); + t = dyn_cast(Context.getObjCSelType().getTypePtr()); t->getDecl()->getIdentifier()->setFETokenInfo(t->getDecl()); TUScope->AddDecl(t->getDecl()); } @@ -88,24 +88,24 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt) TypedefDecl *ClassTypedef = new TypedefDecl(SourceLocation(), &Context.Idents.get("Class"), ClassT, 0); - Context.setObjcClassType(ClassTypedef); + Context.setObjCClassType(ClassTypedef); // Synthesize "@class Protocol; - ObjcInterfaceDecl *ProtocolDecl = new ObjcInterfaceDecl(SourceLocation(), 0, + ObjCInterfaceDecl *ProtocolDecl = new ObjCInterfaceDecl(SourceLocation(), 0, &Context.Idents.get("Protocol"), true); - Context.setObjcProtoType(Context.getObjcInterfaceType(ProtocolDecl)); + Context.setObjCProtoType(Context.getObjCInterfaceType(ProtocolDecl)); // Synthesize "typedef struct objc_object { Class isa; } *id;" RecordDecl *ObjectTag = new RecordDecl(Decl::Struct, SourceLocation(), &IT.get("objc_object"), 0); FieldDecl *IsaDecl = new FieldDecl(SourceLocation(), 0, - Context.getObjcClassType()); + Context.getObjCClassType()); ObjectTag->defineBody(&IsaDecl, 1); QualType ObjT = Context.getPointerType(Context.getTagDeclType(ObjectTag)); TypedefDecl *IdTypedef = new TypedefDecl(SourceLocation(), &Context.Idents.get("id"), ObjT, 0); - Context.setObjcIdType(IdTypedef); + Context.setObjCIdType(IdTypedef); // Synthesize "typedef struct objc_selector *SEL;" RecordDecl *SelTag = new RecordDecl(Decl::Struct, SourceLocation(), @@ -114,7 +114,7 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt) TypedefDecl *SelTypedef = new TypedefDecl(SourceLocation(), &Context.Idents.get("SEL"), SelT, 0); - Context.setObjcSelType(SelTypedef); + Context.setObjCSelType(SelTypedef); } TUScope = 0; diff --git a/Sema/Sema.h b/Sema/Sema.h index bc74fd171b..27885372db 100644 --- a/Sema/Sema.h +++ b/Sema/Sema.h @@ -48,13 +48,13 @@ namespace clang { class SwitchStmt; class OCUVectorType; class TypedefDecl; - class ObjcInterfaceDecl; - class ObjcProtocolDecl; - class ObjcImplementationDecl; - class ObjcCategoryImplDecl; - class ObjcCategoryDecl; - class ObjcIvarDecl; - class ObjcMethodDecl; + class ObjCInterfaceDecl; + class ObjCProtocolDecl; + class ObjCImplementationDecl; + class ObjCCategoryImplDecl; + class ObjCCategoryDecl; + class ObjCIvarDecl; + class ObjCMethodDecl; /// Sema - This implements semantic analysis and AST building for C. class Sema : public Action { @@ -68,7 +68,7 @@ class Sema : public Action { /// CurMethodDecl - If inside of a method body, this contains a pointer to /// the method decl for the method being parsed. - ObjcMethodDecl *CurMethodDecl; + ObjCMethodDecl *CurMethodDecl; /// LabelMap - This is a mapping from label identifiers to the LabelStmt for /// it (which acts like the label decl in some ways). Forward referenced @@ -82,14 +82,14 @@ class Sema : public Action { /// This is only necessary for issuing pretty diagnostics. llvm::SmallVector OCUVectorDecls; - /// ObjcImplementations - Keep track of all of the classes with + /// ObjCImplementations - Keep track of all of the classes with /// @implementation's, so that we can emit errors on duplicates. - llvm::DenseMap ObjcImplementations; + llvm::DenseMap ObjCImplementations; - /// ObjcProtocols - Keep track of all protocol declarations declared + /// ObjCProtocols - Keep track of all protocol declarations declared /// with @protocol keyword, so that we can emit errors on duplicates and /// find the declarations when needed. - llvm::DenseMap ObjcProtocols; + llvm::DenseMap ObjCProtocols; // Enum values used by KnownFunctionIDs (see below). enum { @@ -118,15 +118,15 @@ class Sema : public Action { Scope *TUScope; /// ObjCMethodList - a linked list of methods with different signatures. - struct ObjcMethodList { - ObjcMethodDecl *Method; - ObjcMethodList *Next; + struct ObjCMethodList { + ObjCMethodDecl *Method; + ObjCMethodList *Next; - ObjcMethodList() { + ObjCMethodList() { Method = 0; Next = 0; } - ObjcMethodList(ObjcMethodDecl *M, ObjcMethodList *C) { + ObjCMethodList(ObjCMethodDecl *M, ObjCMethodList *C) { Method = M; Next = C; } @@ -135,8 +135,8 @@ class Sema : public Action { /// messages to "id". We need to maintain a list, since selectors can have /// differing signatures across classes. In Cocoa, this happens to be /// extremely uncommon (only 1% of selectors are "overloaded"). - llvm::DenseMap InstanceMethodPool; - llvm::DenseMap FactoryMethodPool; + llvm::DenseMap InstanceMethodPool; + llvm::DenseMap FactoryMethodPool; public: Sema(Preprocessor &pp, ASTContext &ctxt); @@ -173,7 +173,7 @@ public: // QualType GetTypeForDeclarator(Declarator &D, Scope *S); - QualType ObjcGetTypeForMethodDefinition(DeclTy *D); + QualType ObjCGetTypeForMethodDefinition(DeclTy *D); virtual TypeResult ActOnTypeName(Scope *S, Declarator &D); @@ -189,7 +189,7 @@ private: virtual DeclTy *FinalizeDeclaratorGroup(Scope *S, DeclTy *Group); virtual DeclTy *ActOnStartOfFunctionDef(Scope *S, Declarator &D); - virtual void ObjcActOnStartOfMethodDef(Scope *S, DeclTy *D); + virtual void ObjCActOnStartOfMethodDef(Scope *S, DeclTy *D); virtual DeclTy *ActOnFinishFunctionBody(DeclTy *Decl, StmtTy *Body); @@ -233,7 +233,7 @@ private: ScopedDecl *LookupScopedDecl(IdentifierInfo *II, unsigned NSI, SourceLocation IdLoc, Scope *S); ScopedDecl *LookupInterfaceDecl(IdentifierInfo *II); - ObjcInterfaceDecl *getObjCInterfaceDecl(IdentifierInfo *Id); + ObjCInterfaceDecl *getObjCInterfaceDecl(IdentifierInfo *Id); ScopedDecl *LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID, Scope *S); ScopedDecl *ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II, Scope *S); @@ -257,47 +257,47 @@ private: /// CheckProtocolMethodDefs - This routine checks unimpletented methods /// Declared in protocol, and those referenced by it. - void CheckProtocolMethodDefs(ObjcProtocolDecl *PDecl, + void CheckProtocolMethodDefs(ObjCProtocolDecl *PDecl, bool& IncompleteImpl, const llvm::DenseSet &InsMap, const llvm::DenseSet &ClsMap); /// CheckImplementationIvars - This routine checks if the instance variables /// listed in the implelementation match those listed in the interface. - void CheckImplementationIvars(ObjcImplementationDecl *ImpDecl, - ObjcIvarDecl **Fields, unsigned nIvars, + void CheckImplementationIvars(ObjCImplementationDecl *ImpDecl, + ObjCIvarDecl **Fields, unsigned nIvars, SourceLocation Loc); /// ImplMethodsVsClassMethods - This is main routine to warn if any method /// remains unimplemented in the @implementation class. - void ImplMethodsVsClassMethods(ObjcImplementationDecl* IMPDecl, - ObjcInterfaceDecl* IDecl); + void ImplMethodsVsClassMethods(ObjCImplementationDecl* IMPDecl, + ObjCInterfaceDecl* IDecl); /// ImplCategoryMethodsVsIntfMethods - Checks that methods declared in the /// category interface is implemented in the category @implementation. - void ImplCategoryMethodsVsIntfMethods(ObjcCategoryImplDecl *CatImplDecl, - ObjcCategoryDecl *CatClassDecl); + void ImplCategoryMethodsVsIntfMethods(ObjCCategoryImplDecl *CatImplDecl, + ObjCCategoryDecl *CatClassDecl); /// MatchTwoMethodDeclarations - Checks if two methods' type match and returns /// true, or false, accordingly. - bool MatchTwoMethodDeclarations(const ObjcMethodDecl *Method, - const ObjcMethodDecl *PrevMethod); + bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method, + const ObjCMethodDecl *PrevMethod); - /// isBuiltinObjcType - Returns true of the type is "id", "SEL", "Class" + /// isBuiltinObjCType - Returns true of the type is "id", "SEL", "Class" /// or "Protocol". - bool isBuiltinObjcType(TypedefDecl *TD); + bool isBuiltinObjCType(TypedefDecl *TD); - /// isObjcObjectPointerType - Returns true if type is an objective-c pointer + /// isObjCObjectPointerType - Returns true if type is an objective-c pointer /// to an object type; such as "id", "Class", Intf*, id

, etc. - bool isObjcObjectPointerType(QualType type) const; + bool isObjCObjectPointerType(QualType type) const; /// AddInstanceMethodToGlobalPool - All instance methods in a translation /// unit are added to a global pool. This allows us to efficiently associate /// a selector with a method declaraation for purposes of typechecking /// messages sent to "id" (where the class of the object is unknown). - void AddInstanceMethodToGlobalPool(ObjcMethodDecl *Method); + void AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method); /// AddFactoryMethodToGlobalPool - Same as above, but for factory methods. - void AddFactoryMethodToGlobalPool(ObjcMethodDecl *Method); + void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method); //===--------------------------------------------------------------------===// // Statement Parsing Callbacks: SemaStmt.cpp. public: @@ -331,7 +331,7 @@ public: SourceLocation LParenLoc, StmtTy *First, ExprTy *Second, ExprTy *Third, SourceLocation RParenLoc, StmtTy *Body); - virtual StmtResult ActOnObjcForCollectionStmt(SourceLocation ForColLoc, + virtual StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, SourceLocation LParenLoc, StmtTy *First, ExprTy *Second, SourceLocation RParenLoc, StmtTy *Body); @@ -361,18 +361,18 @@ public: ExprTy **Clobbers, SourceLocation RParenLoc); - virtual StmtResult ActOnObjcAtCatchStmt(SourceLocation AtLoc, + virtual StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, StmtTy *Parm, StmtTy *Body, StmtTy *CatchList); - virtual StmtResult ActOnObjcAtFinallyStmt(SourceLocation AtLoc, + virtual StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, StmtTy *Body); - virtual StmtResult ActOnObjcAtTryStmt(SourceLocation AtLoc, + virtual StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, StmtTy *Try, StmtTy *Catch, StmtTy *Finally); - virtual StmtResult ActOnObjcAtThrowStmt(SourceLocation AtLoc, + virtual StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc, StmtTy *Throw); //===--------------------------------------------------------------------===// @@ -559,20 +559,20 @@ public: DeclTy **allMethods = 0, unsigned allNum = 0, DeclTy **allProperties = 0, unsigned pNum = 0); - virtual DeclTy *ActOnAddObjcProperties(SourceLocation AtLoc, + virtual DeclTy *ActOnAddObjCProperties(SourceLocation AtLoc, DeclTy **allProperties, unsigned NumProperties, - ObjcDeclSpec &DS); + ObjCDeclSpec &DS); virtual DeclTy *ActOnMethodDeclaration( SourceLocation BeginLoc, // location of the + or -. SourceLocation EndLoc, // location of the ; or {. tok::TokenKind MethodType, - DeclTy *ClassDecl, ObjcDeclSpec &ReturnQT, TypeTy *ReturnType, + DeclTy *ClassDecl, ObjCDeclSpec &ReturnQT, TypeTy *ReturnType, Selector Sel, // optional arguments. The number of types/arguments is obtained // from the Sel.getNumArgs(). - ObjcDeclSpec *ArgQT, TypeTy **ArgTypes, IdentifierInfo **ArgNames, + ObjCDeclSpec *ArgQT, TypeTy **ArgTypes, IdentifierInfo **ArgNames, AttributeList *AttrList, tok::ObjCKeywordKind MethodImplKind, bool isVariadic = false); @@ -746,7 +746,7 @@ private: // returns true if there were any incompatible arguments. bool CheckMessageArgumentTypes(Expr **Args, unsigned NumArgs, - ObjcMethodDecl *Method); + ObjCMethodDecl *Method); /// ConvertIntegerToTypeWarnOnOverflow - Convert the specified APInt to have /// the specified width and sign. If an overflow occurs, detect it and emit diff --git a/Sema/SemaChecking.cpp b/Sema/SemaChecking.cpp index bd9ef0cbf7..61c67f02fe 100644 --- a/Sema/SemaChecking.cpp +++ b/Sema/SemaChecking.cpp @@ -560,7 +560,7 @@ Sema::CheckReturnStackAddr(Expr *RetValExp, QualType lhsType, static DeclRefExpr* EvalAddr(Expr *E) { // We should only be called for evaluating pointer expressions. assert((E->getType()->isPointerType() || - E->getType()->isObjcQualifiedIdType()) && + E->getType()->isObjCQualifiedIdType()) && "EvalAddr only works on pointers"); // Our "symbolic interpreter" is just a dispatch off the currently @@ -621,7 +621,7 @@ static DeclRefExpr* EvalAddr(Expr *E) { Expr* SubExpr = IE->getSubExpr(); if (SubExpr->getType()->isPointerType() || - SubExpr->getType()->isObjcQualifiedIdType()) + SubExpr->getType()->isObjCQualifiedIdType()) return EvalAddr(SubExpr); else return EvalVal(SubExpr); diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp index 07b3d71368..94c65ac935 100644 --- a/Sema/SemaDecl.cpp +++ b/Sema/SemaDecl.cpp @@ -33,10 +33,10 @@ Sema::DeclTy *Sema::isTypeName(const IdentifierInfo &II, Scope *S) const { IIDecl = cast(IIDecl)->getNext(); if (!IIDecl) return 0; - if (isa(IIDecl) || isa(IIDecl)) + if (isa(IIDecl) || isa(IIDecl)) return IIDecl; - if (ObjcCompatibleAliasDecl *ADecl = - dyn_cast(IIDecl)) + if (ObjCCompatibleAliasDecl *ADecl = + dyn_cast(IIDecl)) return ADecl->getClassInterface(); return 0; } @@ -98,17 +98,17 @@ ScopedDecl *Sema::LookupInterfaceDecl(IdentifierInfo *ClassName) { if (IDecl->getIdentifierNamespace() == Decl::IDNS_Ordinary) break; - if (ObjcCompatibleAliasDecl *ADecl = - dyn_cast_or_null(IDecl)) + if (ObjCCompatibleAliasDecl *ADecl = + dyn_cast_or_null(IDecl)) return ADecl->getClassInterface(); return IDecl; } -/// getObjcInterfaceDecl - Look up a for a class declaration in the scope. +/// getObjCInterfaceDecl - Look up a for a class declaration in the scope. /// return 0 if one not found. -ObjcInterfaceDecl *Sema::getObjCInterfaceDecl(IdentifierInfo *Id) { +ObjCInterfaceDecl *Sema::getObjCInterfaceDecl(IdentifierInfo *Id) { ScopedDecl *IdDecl = LookupInterfaceDecl(Id); - return cast_or_null(IdDecl); + return cast_or_null(IdDecl); } /// LookupScopedDecl - Look up the inner-most declaration in the specified @@ -208,7 +208,7 @@ TypedefDecl *Sema::MergeTypeDefDecl(TypedefDecl *New, ScopedDecl *OldD) { // Allow multiple definitions for ObjC built-in typedefs. // FIXME: Verify the underlying types are equivalent! - if (getLangOptions().ObjC1 && isBuiltinObjcType(New)) + if (getLangOptions().ObjC1 && isBuiltinObjCType(New)) return Old; // TODO: CHECK FOR CONFLICTS, multiple decls with same name in one scope. @@ -697,7 +697,7 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) { } New = NewFD; } else { - if (R.getTypePtr()->isObjcInterfaceType()) { + if (R.getTypePtr()->isObjCInterfaceType()) { Diag(D.getIdentifierLoc(), diag::err_statically_allocated_object, D.getIdentifier()->getName()); InvalidDecl = true; @@ -983,7 +983,7 @@ Sema::DeclTy *Sema::ActOnFinishFunctionBody(DeclTy *D, StmtTy *Body) { FD->setBody((Stmt*)Body); assert(FD == CurFunctionDecl && "Function parsing confused"); CurFunctionDecl = 0; - } else if (ObjcMethodDecl *MD = dyn_cast(dcl)) { + } else if (ObjCMethodDecl *MD = dyn_cast(dcl)) { MD->setBody((Stmt*)Body); CurMethodDecl = 0; } @@ -1204,14 +1204,14 @@ Sema::DeclTy *Sema::ActOnField(Scope *S, DeclTy *TagDecl, if (isa(static_cast(TagDecl))) NewFD = new FieldDecl(Loc, II, T, BitWidth); - else if (isa(static_cast(TagDecl)) || - isa(static_cast(TagDecl)) || - isa(static_cast(TagDecl)) || + else if (isa(static_cast(TagDecl)) || + isa(static_cast(TagDecl)) || + isa(static_cast(TagDecl)) || // FIXME: ivars are currently used to model properties, and // properties can appear within a protocol. - // See corresponding FIXME in DeclObjC.h:ObjcPropertyDecl. - isa(static_cast(TagDecl))) - NewFD = new ObjcIvarDecl(Loc, II, T); + // See corresponding FIXME in DeclObjC.h:ObjCPropertyDecl. + isa(static_cast(TagDecl))) + NewFD = new ObjCIvarDecl(Loc, II, T); else assert(0 && "Sema::ActOnField(): Unknown TagDecl"); @@ -1222,13 +1222,13 @@ Sema::DeclTy *Sema::ActOnField(Scope *S, DeclTy *TagDecl, /// TranslateIvarVisibility - Translate visibility from a token ID to an /// AST enum value. -static ObjcIvarDecl::AccessControl +static ObjCIvarDecl::AccessControl TranslateIvarVisibility(tok::ObjCKeywordKind ivarVisibility) { switch (ivarVisibility) { - case tok::objc_private: return ObjcIvarDecl::Private; - case tok::objc_public: return ObjcIvarDecl::Public; - case tok::objc_protected: return ObjcIvarDecl::Protected; - case tok::objc_package: return ObjcIvarDecl::Package; + case tok::objc_private: return ObjCIvarDecl::Private; + case tok::objc_public: return ObjCIvarDecl::Public; + case tok::objc_protected: return ObjCIvarDecl::Protected; + case tok::objc_package: return ObjCIvarDecl::Package; default: assert(false && "Unknown visitibility kind"); } } @@ -1271,7 +1271,7 @@ void Sema::ActOnFields(Scope* S, // If we have visibility info, make sure the AST is set accordingly. if (visibility) - cast(FD)->setAccessControl( + cast(FD)->setAccessControl( TranslateIvarVisibility(visibility[i])); // C99 6.7.2.1p2 - A field may not be a function type. @@ -1337,7 +1337,7 @@ void Sema::ActOnFields(Scope* S, } } /// A field cannot be an Objective-c object - if (FDTy->isObjcInterfaceType()) { + if (FDTy->isObjCInterfaceType()) { Diag(FD->getLocation(), diag::err_statically_allocated_object, FD->getName()); FD->setInvalidDecl(); @@ -1371,16 +1371,16 @@ void Sema::ActOnFields(Scope* S, if (Record) Record->defineBody(&RecFields[0], RecFields.size()); else { - ObjcIvarDecl **ClsFields = - reinterpret_cast(&RecFields[0]); - if (isa(static_cast(RecDecl))) - cast(static_cast(RecDecl))-> + ObjCIvarDecl **ClsFields = + reinterpret_cast(&RecFields[0]); + if (isa(static_cast(RecDecl))) + cast(static_cast(RecDecl))-> addInstanceVariablesToClass(ClsFields, RecFields.size(), RBrac); - else if (isa(static_cast(RecDecl))) { - ObjcImplementationDecl* IMPDecl = - cast(static_cast(RecDecl)); - assert(IMPDecl && "ActOnFields - missing ObjcImplementationDecl"); - IMPDecl->ObjcAddInstanceVariablesToClassImpl(ClsFields, RecFields.size()); + else if (isa(static_cast(RecDecl))) { + ObjCImplementationDecl* IMPDecl = + cast(static_cast(RecDecl)); + assert(IMPDecl && "ActOnFields - missing ObjCImplementationDecl"); + IMPDecl->ObjCAddInstanceVariablesToClassImpl(ClsFields, RecFields.size()); CheckImplementationIvars(IMPDecl, ClsFields, RecFields.size(), RBrac); } } diff --git a/Sema/SemaDeclObjC.cpp b/Sema/SemaDeclObjC.cpp index e74408958f..89b7611d86 100644 --- a/Sema/SemaDeclObjC.cpp +++ b/Sema/SemaDeclObjC.cpp @@ -18,11 +18,11 @@ using namespace clang; -/// ObjcActOnStartOfMethodDef - This routine sets up parameters; invisible +/// ObjCActOnStartOfMethodDef - This routine sets up parameters; invisible /// and user declared, in the method definition's AST. -void Sema::ObjcActOnStartOfMethodDef(Scope *FnBodyScope, DeclTy *D) { +void Sema::ObjCActOnStartOfMethodDef(Scope *FnBodyScope, DeclTy *D) { assert(CurFunctionDecl == 0 && "Method parsing confused"); - ObjcMethodDecl *MDecl = dyn_cast(static_cast(D)); + ObjCMethodDecl *MDecl = dyn_cast(static_cast(D)); assert(MDecl != 0 && "Not a method declarator!"); // Allow the rest of sema to find private method decl implementations. @@ -43,15 +43,15 @@ void Sema::ObjcActOnStartOfMethodDef(Scope *FnBodyScope, DeclTy *D) { PI.IdentLoc = SourceLocation(); // synthesized vars have a null location. PI.InvalidType = false; if (MDecl->isInstance()) { - QualType selfTy = Context.getObjcInterfaceType(MDecl->getClassInterface()); + QualType selfTy = Context.getObjCInterfaceType(MDecl->getClassInterface()); selfTy = Context.getPointerType(selfTy); PI.TypeInfo = selfTy.getAsOpaquePtr(); } else - PI.TypeInfo = Context.getObjcIdType().getAsOpaquePtr(); + PI.TypeInfo = Context.getObjCIdType().getAsOpaquePtr(); CurMethodDecl->setSelfDecl(ActOnParamDeclarator(PI, FnBodyScope)); PI.Ident = &Context.Idents.get("_cmd"); - PI.TypeInfo = Context.getObjcSelType().getAsOpaquePtr(); + PI.TypeInfo = Context.getObjCSelType().getAsOpaquePtr(); ActOnParamDeclarator(PI, FnBodyScope); for (int i = 0; i < MDecl->getNumParams(); i++) { @@ -73,13 +73,13 @@ Sema::DeclTy *Sema::ActOnStartClassInterface( // Check for another declaration kind with the same name. ScopedDecl *PrevDecl = LookupInterfaceDecl(ClassName); - if (PrevDecl && !isa(PrevDecl)) { + if (PrevDecl && !isa(PrevDecl)) { Diag(ClassLoc, diag::err_redefinition_different_kind, ClassName->getName()); Diag(PrevDecl->getLocation(), diag::err_previous_definition); } - ObjcInterfaceDecl* IDecl = dyn_cast_or_null(PrevDecl); + ObjCInterfaceDecl* IDecl = dyn_cast_or_null(PrevDecl); if (IDecl) { // Class already seen. Is it a forward declaration? if (!IDecl->isForwardDecl()) @@ -91,7 +91,7 @@ Sema::DeclTy *Sema::ActOnStartClassInterface( } } else { - IDecl = new ObjcInterfaceDecl(AtInterfaceLoc, NumProtocols, ClassName); + IDecl = new ObjCInterfaceDecl(AtInterfaceLoc, NumProtocols, ClassName); // Chain & install the interface decl into the identifier. IDecl->setNext(ClassName->getFETokenInfo()); @@ -102,17 +102,17 @@ Sema::DeclTy *Sema::ActOnStartClassInterface( } if (SuperName) { - ObjcInterfaceDecl* SuperClassEntry = 0; + ObjCInterfaceDecl* SuperClassEntry = 0; // Check if a different kind of symbol declared in this scope. PrevDecl = LookupInterfaceDecl(SuperName); - if (PrevDecl && !isa(PrevDecl)) { + if (PrevDecl && !isa(PrevDecl)) { Diag(SuperLoc, diag::err_redefinition_different_kind, SuperName->getName()); Diag(PrevDecl->getLocation(), diag::err_previous_definition); } else { // Check that super class is previously defined - SuperClassEntry = dyn_cast_or_null(PrevDecl); + SuperClassEntry = dyn_cast_or_null(PrevDecl); if (!SuperClassEntry || SuperClassEntry->isForwardDecl()) { Diag(AtInterfaceLoc, diag::err_undef_superclass, @@ -130,7 +130,7 @@ Sema::DeclTy *Sema::ActOnStartClassInterface( /// Check then save referenced protocols if (NumProtocols) { for (unsigned int i = 0; i != NumProtocols; i++) { - ObjcProtocolDecl* RefPDecl = ObjcProtocols[ProtocolNames[i]]; + ObjCProtocolDecl* RefPDecl = ObjCProtocols[ProtocolNames[i]]; if (!RefPDecl || RefPDecl->isForwardDecl()) Diag(ClassLoc, diag::warn_undef_protocolref, ProtocolNames[i]->getName(), @@ -152,7 +152,7 @@ Sema::DeclTy *Sema::ActOnCompatiblityAlias( ScopedDecl *ADecl = LookupScopedDecl(AliasName, Decl::IDNS_Ordinary, AliasLocation, TUScope); if (ADecl) { - if (isa(ADecl)) { + if (isa(ADecl)) { Diag(AliasLocation, diag::warn_previous_alias_decl); Diag(ADecl->getLocation(), diag::warn_previous_declaration); } @@ -166,7 +166,7 @@ Sema::DeclTy *Sema::ActOnCompatiblityAlias( // Check for class declaration ScopedDecl *CDecl = LookupScopedDecl(ClassName, Decl::IDNS_Ordinary, ClassLocation, TUScope); - if (!CDecl || !isa(CDecl)) { + if (!CDecl || !isa(CDecl)) { Diag(ClassLocation, diag::warn_undef_interface, ClassName->getName()); if (CDecl) @@ -174,10 +174,10 @@ Sema::DeclTy *Sema::ActOnCompatiblityAlias( return 0; } // Everything checked out, instantiate a new alias declaration ast - ObjcCompatibleAliasDecl *AliasDecl = - new ObjcCompatibleAliasDecl(AtCompatibilityAliasLoc, + ObjCCompatibleAliasDecl *AliasDecl = + new ObjCCompatibleAliasDecl(AtCompatibilityAliasLoc, AliasName, - dyn_cast(CDecl)); + dyn_cast(CDecl)); // Chain & install the interface decl into the identifier. AliasDecl->setNext(AliasName->getFETokenInfo()); @@ -191,7 +191,7 @@ Sema::DeclTy *Sema::ActOnStartProtocolInterface( IdentifierInfo **ProtoRefNames, unsigned NumProtoRefs, SourceLocation EndProtoLoc) { assert(ProtocolName && "Missing protocol identifier"); - ObjcProtocolDecl *PDecl = ObjcProtocols[ProtocolName]; + ObjCProtocolDecl *PDecl = ObjCProtocols[ProtocolName]; if (PDecl) { // Protocol already seen. Better be a forward protocol declaration if (!PDecl->isForwardDecl()) @@ -203,15 +203,15 @@ Sema::DeclTy *Sema::ActOnStartProtocolInterface( } } else { - PDecl = new ObjcProtocolDecl(AtProtoInterfaceLoc, NumProtoRefs, + PDecl = new ObjCProtocolDecl(AtProtoInterfaceLoc, NumProtoRefs, ProtocolName); - ObjcProtocols[ProtocolName] = PDecl; + ObjCProtocols[ProtocolName] = PDecl; } if (NumProtoRefs) { /// Check then save referenced protocols for (unsigned int i = 0; i != NumProtoRefs; i++) { - ObjcProtocolDecl* RefPDecl = ObjcProtocols[ProtoRefNames[i]]; + ObjCProtocolDecl* RefPDecl = ObjCProtocols[ProtoRefNames[i]]; if (!RefPDecl || RefPDecl->isForwardDecl()) Diag(ProtocolLoc, diag::warn_undef_protocolref, ProtoRefNames[i]->getName(), @@ -232,7 +232,7 @@ Sema::FindProtocolDeclaration(SourceLocation TypeLoc, unsigned NumProtocols, llvm::SmallVector &Protocols) { for (unsigned i = 0; i != NumProtocols; ++i) { - ObjcProtocolDecl *PDecl = ObjcProtocols[ProtocolId[i]]; + ObjCProtocolDecl *PDecl = ObjCProtocols[ProtocolId[i]]; if (!PDecl) Diag(TypeLoc, diag::err_undeclared_protocol, ProtocolId[i]->getName()); @@ -245,20 +245,20 @@ Sema::FindProtocolDeclaration(SourceLocation TypeLoc, Action::DeclTy * Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc, IdentifierInfo **IdentList, unsigned NumElts) { - llvm::SmallVector Protocols; + llvm::SmallVector Protocols; for (unsigned i = 0; i != NumElts; ++i) { IdentifierInfo *P = IdentList[i]; - ObjcProtocolDecl *PDecl = ObjcProtocols[P]; + ObjCProtocolDecl *PDecl = ObjCProtocols[P]; if (!PDecl) { // Not already seen? // FIXME: Pass in the location of the identifier! - PDecl = new ObjcProtocolDecl(AtProtocolLoc, 0, P, true); - ObjcProtocols[P] = PDecl; + PDecl = new ObjCProtocolDecl(AtProtocolLoc, 0, P, true); + ObjCProtocols[P] = PDecl; } Protocols.push_back(PDecl); } - return new ObjcForwardProtocolDecl(AtProtocolLoc, + return new ObjCForwardProtocolDecl(AtProtocolLoc, &Protocols[0], Protocols.size()); } @@ -268,18 +268,18 @@ Sema::DeclTy *Sema::ActOnStartCategoryInterface( IdentifierInfo *CategoryName, SourceLocation CategoryLoc, IdentifierInfo **ProtoRefNames, unsigned NumProtoRefs, SourceLocation EndProtoLoc) { - ObjcInterfaceDecl *IDecl = getObjCInterfaceDecl(ClassName); + ObjCInterfaceDecl *IDecl = getObjCInterfaceDecl(ClassName); /// Check that class of this category is already completely declared. if (!IDecl || IDecl->isForwardDecl()) { Diag(ClassLoc, diag::err_undef_interface, ClassName->getName()); return 0; } - ObjcCategoryDecl *CDecl = new ObjcCategoryDecl(AtInterfaceLoc, NumProtoRefs, + ObjCCategoryDecl *CDecl = new ObjCCategoryDecl(AtInterfaceLoc, NumProtoRefs, CategoryName); CDecl->setClassInterface(IDecl); /// Check for duplicate interface declaration for this category - ObjcCategoryDecl *CDeclChain; + ObjCCategoryDecl *CDeclChain; for (CDeclChain = IDecl->getCategoryList(); CDeclChain; CDeclChain = CDeclChain->getNextClassCategory()) { if (CDeclChain->getIdentifier() == CategoryName) { @@ -294,7 +294,7 @@ Sema::DeclTy *Sema::ActOnStartCategoryInterface( if (NumProtoRefs) { /// Check then save referenced protocols for (unsigned int i = 0; i != NumProtoRefs; i++) { - ObjcProtocolDecl* RefPDecl = ObjcProtocols[ProtoRefNames[i]]; + ObjCProtocolDecl* RefPDecl = ObjCProtocols[ProtoRefNames[i]]; if (!RefPDecl || RefPDecl->isForwardDecl()) { Diag(CategoryLoc, diag::warn_undef_protocolref, ProtoRefNames[i]->getName(), @@ -308,14 +308,14 @@ Sema::DeclTy *Sema::ActOnStartCategoryInterface( } /// ActOnStartCategoryImplementation - Perform semantic checks on the -/// category implementation declaration and build an ObjcCategoryImplDecl +/// category implementation declaration and build an ObjCCategoryImplDecl /// object. Sema::DeclTy *Sema::ActOnStartCategoryImplementation( SourceLocation AtCatImplLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *CatName, SourceLocation CatLoc) { - ObjcInterfaceDecl *IDecl = getObjCInterfaceDecl(ClassName); - ObjcCategoryImplDecl *CDecl = new ObjcCategoryImplDecl(AtCatImplLoc, + ObjCInterfaceDecl *IDecl = getObjCInterfaceDecl(ClassName); + ObjCCategoryImplDecl *CDecl = new ObjCCategoryImplDecl(AtCatImplLoc, CatName, IDecl); /// Check that class of this category is already completely declared. if (!IDecl || IDecl->isForwardDecl()) @@ -331,33 +331,33 @@ Sema::DeclTy *Sema::ActOnStartClassImplementation( IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *SuperClassname, SourceLocation SuperClassLoc) { - ObjcInterfaceDecl* IDecl = 0; + ObjCInterfaceDecl* IDecl = 0; // Check for another declaration kind with the same name. ScopedDecl *PrevDecl = LookupInterfaceDecl(ClassName); - if (PrevDecl && !isa(PrevDecl)) { + if (PrevDecl && !isa(PrevDecl)) { Diag(ClassLoc, diag::err_redefinition_different_kind, ClassName->getName()); Diag(PrevDecl->getLocation(), diag::err_previous_definition); } else { // Is there an interface declaration of this class; if not, warn! - IDecl = dyn_cast_or_null(PrevDecl); + IDecl = dyn_cast_or_null(PrevDecl); if (!IDecl) Diag(ClassLoc, diag::warn_undef_interface, ClassName->getName()); } // Check that super class name is valid class name - ObjcInterfaceDecl* SDecl = 0; + ObjCInterfaceDecl* SDecl = 0; if (SuperClassname) { // Check if a different kind of symbol declared in this scope. PrevDecl = LookupInterfaceDecl(SuperClassname); - if (PrevDecl && !isa(PrevDecl)) { + if (PrevDecl && !isa(PrevDecl)) { Diag(SuperClassLoc, diag::err_redefinition_different_kind, SuperClassname->getName()); Diag(PrevDecl->getLocation(), diag::err_previous_definition); } else { - SDecl = dyn_cast_or_null(PrevDecl); + SDecl = dyn_cast_or_null(PrevDecl); if (!SDecl) Diag(SuperClassLoc, diag::err_undef_superclass, SuperClassname->getName(), ClassName->getName()); @@ -374,7 +374,7 @@ Sema::DeclTy *Sema::ActOnStartClassImplementation( if (!IDecl) { // Legacy case of @implementation with no corresponding @interface. // Build, chain & install the interface decl into the identifier. - IDecl = new ObjcInterfaceDecl(AtClassImplLoc, 0, ClassName, + IDecl = new ObjCInterfaceDecl(AtClassImplLoc, 0, ClassName, false, true); IDecl->setNext(ClassName->getFETokenInfo()); ClassName->setFETokenInfo(IDecl); @@ -385,22 +385,22 @@ Sema::DeclTy *Sema::ActOnStartClassImplementation( TUScope->AddDecl(IDecl); } - ObjcImplementationDecl* IMPDecl = - new ObjcImplementationDecl(AtClassImplLoc, ClassName, IDecl, SDecl); + ObjCImplementationDecl* IMPDecl = + new ObjCImplementationDecl(AtClassImplLoc, ClassName, IDecl, SDecl); // Check that there is no duplicate implementation of this class. - if (ObjcImplementations[ClassName]) + if (ObjCImplementations[ClassName]) Diag(ClassLoc, diag::err_dup_implementation_class, ClassName->getName()); else // add it to the list. - ObjcImplementations[ClassName] = IMPDecl; + ObjCImplementations[ClassName] = IMPDecl; return IMPDecl; } -void Sema::CheckImplementationIvars(ObjcImplementationDecl *ImpDecl, - ObjcIvarDecl **ivars, unsigned numIvars, +void Sema::CheckImplementationIvars(ObjCImplementationDecl *ImpDecl, + ObjCIvarDecl **ivars, unsigned numIvars, SourceLocation RBrace) { assert(ImpDecl && "missing implementation decl"); - ObjcInterfaceDecl* IDecl = getObjCInterfaceDecl(ImpDecl->getIdentifier()); + ObjCInterfaceDecl* IDecl = getObjCInterfaceDecl(ImpDecl->getIdentifier()); if (!IDecl) return; /// Check case of non-existing @interface decl. @@ -420,11 +420,11 @@ void Sema::CheckImplementationIvars(ObjcImplementationDecl *ImpDecl, // names and types must match. // unsigned j = 0; - ObjcInterfaceDecl::ivar_iterator + ObjCInterfaceDecl::ivar_iterator IVI = IDecl->ivar_begin(), IVE = IDecl->ivar_end(); for (; numIvars > 0 && IVI != IVE; ++IVI) { - ObjcIvarDecl* ImplIvar = ivars[j++]; - ObjcIvarDecl* ClsIvar = *IVI; + ObjCIvarDecl* ImplIvar = ivars[j++]; + ObjCIvarDecl* ClsIvar = *IVI; assert (ImplIvar && "missing implementation ivar"); assert (ClsIvar && "missing class ivar"); if (ImplIvar->getCanonicalType() != ClsIvar->getCanonicalType()) { @@ -453,49 +453,49 @@ void Sema::CheckImplementationIvars(ObjcImplementationDecl *ImpDecl, /// CheckProtocolMethodDefs - This routine checks unimpletented methods /// Declared in protocol, and those referenced by it. -void Sema::CheckProtocolMethodDefs(ObjcProtocolDecl *PDecl, +void Sema::CheckProtocolMethodDefs(ObjCProtocolDecl *PDecl, bool& IncompleteImpl, const llvm::DenseSet &InsMap, const llvm::DenseSet &ClsMap) { // check unimplemented instance methods. - for (ObjcProtocolDecl::instmeth_iterator I = PDecl->instmeth_begin(), + for (ObjCProtocolDecl::instmeth_iterator I = PDecl->instmeth_begin(), E = PDecl->instmeth_end(); I != E; ++I) { - ObjcMethodDecl *method = *I; + ObjCMethodDecl *method = *I; if (!InsMap.count(method->getSelector()) && - method->getImplementationControl() != ObjcMethodDecl::Optional) { + method->getImplementationControl() != ObjCMethodDecl::Optional) { Diag(method->getLocation(), diag::warn_undef_method_impl, method->getSelector().getName()); IncompleteImpl = true; } } // check unimplemented class methods - for (ObjcProtocolDecl::classmeth_iterator I = PDecl->classmeth_begin(), + for (ObjCProtocolDecl::classmeth_iterator I = PDecl->classmeth_begin(), E = PDecl->classmeth_end(); I != E; ++I) { - ObjcMethodDecl *method = *I; + ObjCMethodDecl *method = *I; if (!ClsMap.count(method->getSelector()) && - method->getImplementationControl() != ObjcMethodDecl::Optional) { + method->getImplementationControl() != ObjCMethodDecl::Optional) { Diag(method->getLocation(), diag::warn_undef_method_impl, method->getSelector().getName()); IncompleteImpl = true; } } // Check on this protocols's referenced protocols, recursively - ObjcProtocolDecl** RefPDecl = PDecl->getReferencedProtocols(); + ObjCProtocolDecl** RefPDecl = PDecl->getReferencedProtocols(); for (unsigned i = 0; i < PDecl->getNumReferencedProtocols(); i++) CheckProtocolMethodDefs(RefPDecl[i], IncompleteImpl, InsMap, ClsMap); } -void Sema::ImplMethodsVsClassMethods(ObjcImplementationDecl* IMPDecl, - ObjcInterfaceDecl* IDecl) { +void Sema::ImplMethodsVsClassMethods(ObjCImplementationDecl* IMPDecl, + ObjCInterfaceDecl* IDecl) { llvm::DenseSet InsMap; // Check and see if instance methods in class interface have been // implemented in the implementation class. - for (ObjcImplementationDecl::instmeth_iterator I = IMPDecl->instmeth_begin(), + for (ObjCImplementationDecl::instmeth_iterator I = IMPDecl->instmeth_begin(), E = IMPDecl->instmeth_end(); I != E; ++I) InsMap.insert((*I)->getSelector()); bool IncompleteImpl = false; - for (ObjcInterfaceDecl::instmeth_iterator I = IDecl->instmeth_begin(), + for (ObjCInterfaceDecl::instmeth_iterator I = IDecl->instmeth_begin(), E = IDecl->instmeth_end(); I != E; ++I) if (!InsMap.count((*I)->getSelector())) { Diag((*I)->getLocation(), diag::warn_undef_method_impl, @@ -506,11 +506,11 @@ void Sema::ImplMethodsVsClassMethods(ObjcImplementationDecl* IMPDecl, llvm::DenseSet ClsMap; // Check and see if class methods in class interface have been // implemented in the implementation class. - for (ObjcImplementationDecl::classmeth_iterator I =IMPDecl->classmeth_begin(), + for (ObjCImplementationDecl::classmeth_iterator I =IMPDecl->classmeth_begin(), E = IMPDecl->classmeth_end(); I != E; ++I) ClsMap.insert((*I)->getSelector()); - for (ObjcInterfaceDecl::classmeth_iterator I = IDecl->classmeth_begin(), + for (ObjCInterfaceDecl::classmeth_iterator I = IDecl->classmeth_begin(), E = IDecl->classmeth_end(); I != E; ++I) if (!ClsMap.count((*I)->getSelector())) { Diag((*I)->getLocation(), diag::warn_undef_method_impl, @@ -520,7 +520,7 @@ void Sema::ImplMethodsVsClassMethods(ObjcImplementationDecl* IMPDecl, // Check the protocol list for unimplemented methods in the @implementation // class. - ObjcProtocolDecl** protocols = IDecl->getReferencedProtocols(); + ObjCProtocolDecl** protocols = IDecl->getReferencedProtocols(); for (unsigned i = 0; i < IDecl->getNumIntfRefProtocols(); i++) CheckProtocolMethodDefs(protocols[i], IncompleteImpl, InsMap, ClsMap); @@ -531,17 +531,17 @@ void Sema::ImplMethodsVsClassMethods(ObjcImplementationDecl* IMPDecl, /// ImplCategoryMethodsVsIntfMethods - Checks that methods declared in the /// category interface is implemented in the category @implementation. -void Sema::ImplCategoryMethodsVsIntfMethods(ObjcCategoryImplDecl *CatImplDecl, - ObjcCategoryDecl *CatClassDecl) { +void Sema::ImplCategoryMethodsVsIntfMethods(ObjCCategoryImplDecl *CatImplDecl, + ObjCCategoryDecl *CatClassDecl) { llvm::DenseSet InsMap; // Check and see if instance methods in category interface have been // implemented in its implementation class. - for (ObjcCategoryImplDecl::instmeth_iterator I =CatImplDecl->instmeth_begin(), + for (ObjCCategoryImplDecl::instmeth_iterator I =CatImplDecl->instmeth_begin(), E = CatImplDecl->instmeth_end(); I != E; ++I) InsMap.insert((*I)->getSelector()); bool IncompleteImpl = false; - for (ObjcCategoryDecl::instmeth_iterator I = CatClassDecl->instmeth_begin(), + for (ObjCCategoryDecl::instmeth_iterator I = CatClassDecl->instmeth_begin(), E = CatClassDecl->instmeth_end(); I != E; ++I) if (!InsMap.count((*I)->getSelector())) { Diag((*I)->getLocation(), diag::warn_undef_method_impl, @@ -551,12 +551,12 @@ void Sema::ImplCategoryMethodsVsIntfMethods(ObjcCategoryImplDecl *CatImplDecl, llvm::DenseSet ClsMap; // Check and see if class methods in category interface have been // implemented in its implementation class. - for (ObjcCategoryImplDecl::classmeth_iterator + for (ObjCCategoryImplDecl::classmeth_iterator I = CatImplDecl->classmeth_begin(), E = CatImplDecl->classmeth_end(); I != E; ++I) ClsMap.insert((*I)->getSelector()); - for (ObjcCategoryDecl::classmeth_iterator I = CatClassDecl->classmeth_begin(), + for (ObjCCategoryDecl::classmeth_iterator I = CatClassDecl->classmeth_begin(), E = CatClassDecl->classmeth_end(); I != E; ++I) if (!ClsMap.count((*I)->getSelector())) { Diag((*I)->getLocation(), diag::warn_undef_method_impl, @@ -566,9 +566,9 @@ void Sema::ImplCategoryMethodsVsIntfMethods(ObjcCategoryImplDecl *CatImplDecl, // Check the protocol list for unimplemented methods in the @implementation // class. - ObjcProtocolDecl** protocols = CatClassDecl->getReferencedProtocols(); + ObjCProtocolDecl** protocols = CatClassDecl->getReferencedProtocols(); for (unsigned i = 0; i < CatClassDecl->getNumReferencedProtocols(); i++) { - ObjcProtocolDecl* PDecl = protocols[i]; + ObjCProtocolDecl* PDecl = protocols[i]; CheckProtocolMethodDefs(PDecl, IncompleteImpl, InsMap, ClsMap); } if (IncompleteImpl) @@ -581,19 +581,19 @@ Action::DeclTy * Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc, IdentifierInfo **IdentList, unsigned NumElts) { - llvm::SmallVector Interfaces; + llvm::SmallVector Interfaces; for (unsigned i = 0; i != NumElts; ++i) { // Check for another declaration kind with the same name. ScopedDecl *PrevDecl = LookupInterfaceDecl(IdentList[i]); - if (PrevDecl && !isa(PrevDecl)) { + if (PrevDecl && !isa(PrevDecl)) { Diag(AtClassLoc, diag::err_redefinition_different_kind, IdentList[i]->getName()); Diag(PrevDecl->getLocation(), diag::err_previous_definition); } - ObjcInterfaceDecl *IDecl = dyn_cast_or_null(PrevDecl); + ObjCInterfaceDecl *IDecl = dyn_cast_or_null(PrevDecl); if (!IDecl) { // Not already seen? Make a forward decl. - IDecl = new ObjcInterfaceDecl(AtClassLoc, 0, IdentList[i], true); + IDecl = new ObjCInterfaceDecl(AtClassLoc, 0, IdentList[i], true); // Chain & install the interface decl into the identifier. IDecl->setNext(IdentList[i]->getFETokenInfo()); IdentList[i]->setFETokenInfo(IDecl); @@ -605,15 +605,15 @@ Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc, Interfaces.push_back(IDecl); } - return new ObjcClassDecl(AtClassLoc, &Interfaces[0], Interfaces.size()); + return new ObjCClassDecl(AtClassLoc, &Interfaces[0], Interfaces.size()); } /// MatchTwoMethodDeclarations - Checks that two methods have matching type and /// returns true, or false, accordingly. /// TODO: Handle protocol list; such as id in type comparisons -bool Sema::MatchTwoMethodDeclarations(const ObjcMethodDecl *Method, - const ObjcMethodDecl *PrevMethod) { +bool Sema::MatchTwoMethodDeclarations(const ObjCMethodDecl *Method, + const ObjCMethodDecl *PrevMethod) { if (Method->getResultType().getCanonicalType() != PrevMethod->getResultType().getCanonicalType()) return false; @@ -626,8 +626,8 @@ bool Sema::MatchTwoMethodDeclarations(const ObjcMethodDecl *Method, return true; } -void Sema::AddInstanceMethodToGlobalPool(ObjcMethodDecl *Method) { - ObjcMethodList &FirstMethod = InstanceMethodPool[Method->getSelector()]; +void Sema::AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method) { + ObjCMethodList &FirstMethod = InstanceMethodPool[Method->getSelector()]; if (!FirstMethod.Method) { // Haven't seen a method with this selector name yet - add it. FirstMethod.Method = Method; @@ -636,21 +636,21 @@ void Sema::AddInstanceMethodToGlobalPool(ObjcMethodDecl *Method) { // We've seen a method with this name, now check the type signature(s). bool match = MatchTwoMethodDeclarations(Method, FirstMethod.Method); - for (ObjcMethodList *Next = FirstMethod.Next; !match && Next; + for (ObjCMethodList *Next = FirstMethod.Next; !match && Next; Next = Next->Next) match = MatchTwoMethodDeclarations(Method, Next->Method); if (!match) { // We have a new signature for an existing method - add it. // This is extremely rare. Only 1% of Cocoa selectors are "overloaded". - struct ObjcMethodList *OMI = new ObjcMethodList(Method, FirstMethod.Next); + struct ObjCMethodList *OMI = new ObjCMethodList(Method, FirstMethod.Next); FirstMethod.Next = OMI; } } } -void Sema::AddFactoryMethodToGlobalPool(ObjcMethodDecl *Method) { - ObjcMethodList &FirstMethod = FactoryMethodPool[Method->getSelector()]; +void Sema::AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method) { + ObjCMethodList &FirstMethod = FactoryMethodPool[Method->getSelector()]; if (!FirstMethod.Method) { // Haven't seen a method with this selector name yet - add it. FirstMethod.Method = Method; @@ -659,14 +659,14 @@ void Sema::AddFactoryMethodToGlobalPool(ObjcMethodDecl *Method) { // We've seen a method with this name, now check the type signature(s). bool match = MatchTwoMethodDeclarations(Method, FirstMethod.Method); - for (ObjcMethodList *Next = FirstMethod.Next; !match && Next; + for (ObjCMethodList *Next = FirstMethod.Next; !match && Next; Next = Next->Next) match = MatchTwoMethodDeclarations(Method, Next->Method); if (!match) { // We have a new signature for an existing method - add it. // This is extremely rare. Only 1% of Cocoa selectors are "overloaded". - struct ObjcMethodList *OMI = new ObjcMethodList(Method, FirstMethod.Next); + struct ObjCMethodList *OMI = new ObjCMethodList(Method, FirstMethod.Next); FirstMethod.Next = OMI; } } @@ -685,33 +685,33 @@ void Sema::ActOnAtEnd(SourceLocation AtEndLoc, DeclTy *classDecl, if (!ClassDecl) return; - llvm::SmallVector insMethods; - llvm::SmallVector clsMethods; + llvm::SmallVector insMethods; + llvm::SmallVector clsMethods; - llvm::DenseMap InsMap; - llvm::DenseMap ClsMap; + llvm::DenseMap InsMap; + llvm::DenseMap ClsMap; bool isInterfaceDeclKind = - (isa(ClassDecl) || isa(ClassDecl) - || isa(ClassDecl)); - bool checkIdenticalMethods = isa(ClassDecl); + (isa(ClassDecl) || isa(ClassDecl) + || isa(ClassDecl)); + bool checkIdenticalMethods = isa(ClassDecl); // TODO: property declaration in category and protocols. - if (pNum != 0 && isa(ClassDecl)) { - ObjcPropertyDecl **properties = new ObjcPropertyDecl*[pNum]; - memcpy(properties, allProperties, pNum*sizeof(ObjcPropertyDecl*)); - dyn_cast(ClassDecl)->setPropertyDecls(properties); - dyn_cast(ClassDecl)->setNumPropertyDecl(pNum); + if (pNum != 0 && isa(ClassDecl)) { + ObjCPropertyDecl **properties = new ObjCPropertyDecl*[pNum]; + memcpy(properties, allProperties, pNum*sizeof(ObjCPropertyDecl*)); + dyn_cast(ClassDecl)->setPropertyDecls(properties); + dyn_cast(ClassDecl)->setNumPropertyDecl(pNum); } for (unsigned i = 0; i < allNum; i++ ) { - ObjcMethodDecl *Method = - cast_or_null(static_cast(allMethods[i])); + ObjCMethodDecl *Method = + cast_or_null(static_cast(allMethods[i])); if (!Method) continue; // Already issued a diagnostic. if (Method->isInstance()) { /// Check for instance method of the same name with incompatible types - const ObjcMethodDecl *&PrevMethod = InsMap[Method->getSelector()]; + const ObjCMethodDecl *&PrevMethod = InsMap[Method->getSelector()]; bool match = PrevMethod ? MatchTwoMethodDeclarations(Method, PrevMethod) : false; if (isInterfaceDeclKind && PrevMethod && !match @@ -728,7 +728,7 @@ void Sema::ActOnAtEnd(SourceLocation AtEndLoc, DeclTy *classDecl, } else { /// Check for class method of the same name with incompatible types - const ObjcMethodDecl *&PrevMethod = ClsMap[Method->getSelector()]; + const ObjCMethodDecl *&PrevMethod = ClsMap[Method->getSelector()]; bool match = PrevMethod ? MatchTwoMethodDeclarations(Method, PrevMethod) : false; if (isInterfaceDeclKind && PrevMethod && !match @@ -745,30 +745,30 @@ void Sema::ActOnAtEnd(SourceLocation AtEndLoc, DeclTy *classDecl, } } - if (ObjcInterfaceDecl *I = dyn_cast(ClassDecl)) { + if (ObjCInterfaceDecl *I = dyn_cast(ClassDecl)) { I->addMethods(&insMethods[0], insMethods.size(), &clsMethods[0], clsMethods.size(), AtEndLoc); - } else if (ObjcProtocolDecl *P = dyn_cast(ClassDecl)) { + } else if (ObjCProtocolDecl *P = dyn_cast(ClassDecl)) { P->addMethods(&insMethods[0], insMethods.size(), &clsMethods[0], clsMethods.size(), AtEndLoc); } - else if (ObjcCategoryDecl *C = dyn_cast(ClassDecl)) { + else if (ObjCCategoryDecl *C = dyn_cast(ClassDecl)) { C->addMethods(&insMethods[0], insMethods.size(), &clsMethods[0], clsMethods.size(), AtEndLoc); } - else if (ObjcImplementationDecl *IC = - dyn_cast(ClassDecl)) { + else if (ObjCImplementationDecl *IC = + dyn_cast(ClassDecl)) { IC->setLocEnd(AtEndLoc); - if (ObjcInterfaceDecl* IDecl = getObjCInterfaceDecl(IC->getIdentifier())) + if (ObjCInterfaceDecl* IDecl = getObjCInterfaceDecl(IC->getIdentifier())) ImplMethodsVsClassMethods(IC, IDecl); } else { - ObjcCategoryImplDecl* CatImplClass = cast(ClassDecl); + ObjCCategoryImplDecl* CatImplClass = cast(ClassDecl); CatImplClass->setLocEnd(AtEndLoc); - ObjcInterfaceDecl* IDecl = CatImplClass->getClassInterface(); + ObjCInterfaceDecl* IDecl = CatImplClass->getClassInterface(); // Find category interface decl and then check that all methods declared // in this interface is implemented in the category @implementation. if (IDecl) { - for (ObjcCategoryDecl *Categories = IDecl->getCategoryList(); + for (ObjCCategoryDecl *Categories = IDecl->getCategoryList(); Categories; Categories = Categories->getNextClassCategory()) { if (Categories->getIdentifier() == CatImplClass->getIdentifier()) { ImplCategoryMethodsVsIntfMethods(CatImplClass, Categories); @@ -782,21 +782,21 @@ void Sema::ActOnAtEnd(SourceLocation AtEndLoc, DeclTy *classDecl, /// CvtQTToAstBitMask - utility routine to produce an AST bitmask for /// objective-c's type qualifier from the parser version of the same info. -static Decl::ObjcDeclQualifier -CvtQTToAstBitMask(ObjcDeclSpec::ObjcDeclQualifier PQTVal) { - Decl::ObjcDeclQualifier ret = Decl::OBJC_TQ_None; - if (PQTVal & ObjcDeclSpec::DQ_In) - ret = (Decl::ObjcDeclQualifier)(ret | Decl::OBJC_TQ_In); - if (PQTVal & ObjcDeclSpec::DQ_Inout) - ret = (Decl::ObjcDeclQualifier)(ret | Decl::OBJC_TQ_Inout); - if (PQTVal & ObjcDeclSpec::DQ_Out) - ret = (Decl::ObjcDeclQualifier)(ret | Decl::OBJC_TQ_Out); - if (PQTVal & ObjcDeclSpec::DQ_Bycopy) - ret = (Decl::ObjcDeclQualifier)(ret | Decl::OBJC_TQ_Bycopy); - if (PQTVal & ObjcDeclSpec::DQ_Byref) - ret = (Decl::ObjcDeclQualifier)(ret | Decl::OBJC_TQ_Byref); - if (PQTVal & ObjcDeclSpec::DQ_Oneway) - ret = (Decl::ObjcDeclQualifier)(ret | Decl::OBJC_TQ_Oneway); +static Decl::ObjCDeclQualifier +CvtQTToAstBitMask(ObjCDeclSpec::ObjCDeclQualifier PQTVal) { + Decl::ObjCDeclQualifier ret = Decl::OBJC_TQ_None; + if (PQTVal & ObjCDeclSpec::DQ_In) + ret = (Decl::ObjCDeclQualifier)(ret | Decl::OBJC_TQ_In); + if (PQTVal & ObjCDeclSpec::DQ_Inout) + ret = (Decl::ObjCDeclQualifier)(ret | Decl::OBJC_TQ_Inout); + if (PQTVal & ObjCDeclSpec::DQ_Out) + ret = (Decl::ObjCDeclQualifier)(ret | Decl::OBJC_TQ_Out); + if (PQTVal & ObjCDeclSpec::DQ_Bycopy) + ret = (Decl::ObjCDeclQualifier)(ret | Decl::OBJC_TQ_Bycopy); + if (PQTVal & ObjCDeclSpec::DQ_Byref) + ret = (Decl::ObjCDeclQualifier)(ret | Decl::OBJC_TQ_Byref); + if (PQTVal & ObjCDeclSpec::DQ_Oneway) + ret = (Decl::ObjCDeclQualifier)(ret | Decl::OBJC_TQ_Oneway); return ret; } @@ -804,11 +804,11 @@ CvtQTToAstBitMask(ObjcDeclSpec::ObjcDeclQualifier PQTVal) { Sema::DeclTy *Sema::ActOnMethodDeclaration( SourceLocation MethodLoc, SourceLocation EndLoc, tok::TokenKind MethodType, DeclTy *ClassDecl, - ObjcDeclSpec &ReturnQT, TypeTy *ReturnType, + ObjCDeclSpec &ReturnQT, TypeTy *ReturnType, Selector Sel, // optional arguments. The number of types/arguments is obtained // from the Sel.getNumArgs(). - ObjcDeclSpec *ArgQT, TypeTy **ArgTypes, IdentifierInfo **ArgNames, + ObjCDeclSpec *ArgQT, TypeTy **ArgTypes, IdentifierInfo **ArgNames, AttributeList *AttrList, tok::ObjCKeywordKind MethodDeclKind, bool isVariadic) { llvm::SmallVector Params; @@ -820,11 +820,11 @@ Sema::DeclTy *Sema::ActOnMethodDeclaration( if (ArgTypes[i]) argType = QualType::getFromOpaquePtr(ArgTypes[i]); else - argType = Context.getObjcIdType(); + argType = Context.getObjCIdType(); ParmVarDecl* Param = new ParmVarDecl(SourceLocation(/*FIXME*/), ArgNames[i], argType, VarDecl::None, 0); - Param->setObjcDeclQualifier( - CvtQTToAstBitMask(ArgQT[i].getObjcDeclQualifier())); + Param->setObjCDeclQualifier( + CvtQTToAstBitMask(ArgQT[i].getObjCDeclQualifier())); Params.push_back(Param); } QualType resultDeclType; @@ -832,91 +832,91 @@ Sema::DeclTy *Sema::ActOnMethodDeclaration( if (ReturnType) resultDeclType = QualType::getFromOpaquePtr(ReturnType); else // get the type for "id". - resultDeclType = Context.getObjcIdType(); + resultDeclType = Context.getObjCIdType(); Decl *CDecl = static_cast(ClassDecl); - ObjcMethodDecl* ObjcMethod = new ObjcMethodDecl(MethodLoc, EndLoc, Sel, + ObjCMethodDecl* ObjCMethod = new ObjCMethodDecl(MethodLoc, EndLoc, Sel, resultDeclType, CDecl, 0, -1, AttrList, MethodType == tok::minus, isVariadic, MethodDeclKind == tok::objc_optional ? - ObjcMethodDecl::Optional : - ObjcMethodDecl::Required); - ObjcMethod->setMethodParams(&Params[0], Sel.getNumArgs()); - ObjcMethod->setObjcDeclQualifier( - CvtQTToAstBitMask(ReturnQT.getObjcDeclQualifier())); - const ObjcMethodDecl *PrevMethod = 0; + ObjCMethodDecl::Optional : + ObjCMethodDecl::Required); + ObjCMethod->setMethodParams(&Params[0], Sel.getNumArgs()); + ObjCMethod->setObjCDeclQualifier( + CvtQTToAstBitMask(ReturnQT.getObjCDeclQualifier())); + const ObjCMethodDecl *PrevMethod = 0; // For implementations (which can be very "coarse grain"), we add the // method now. This allows the AST to implement lookup methods that work // incrementally (without waiting until we parse the @end). It also allows // us to flag multiple declaration errors as they occur. - if (ObjcImplementationDecl *ImpDecl = - dyn_cast(CDecl)) { + if (ObjCImplementationDecl *ImpDecl = + dyn_cast(CDecl)) { if (MethodType == tok::minus) { PrevMethod = ImpDecl->getInstanceMethod(Sel); - ImpDecl->addInstanceMethod(ObjcMethod); + ImpDecl->addInstanceMethod(ObjCMethod); } else { PrevMethod = ImpDecl->getClassMethod(Sel); - ImpDecl->addClassMethod(ObjcMethod); + ImpDecl->addClassMethod(ObjCMethod); } } - else if (ObjcCategoryImplDecl *CatImpDecl = - dyn_cast(CDecl)) { + else if (ObjCCategoryImplDecl *CatImpDecl = + dyn_cast(CDecl)) { if (MethodType == tok::minus) { PrevMethod = CatImpDecl->getInstanceMethod(Sel); - CatImpDecl->addInstanceMethod(ObjcMethod); + CatImpDecl->addInstanceMethod(ObjCMethod); } else { PrevMethod = CatImpDecl->getClassMethod(Sel); - CatImpDecl->addClassMethod(ObjcMethod); + CatImpDecl->addClassMethod(ObjCMethod); } } if (PrevMethod) { // You can never have two method definitions with the same name. - Diag(ObjcMethod->getLocation(), diag::error_duplicate_method_decl, - ObjcMethod->getSelector().getName()); + Diag(ObjCMethod->getLocation(), diag::error_duplicate_method_decl, + ObjCMethod->getSelector().getName()); Diag(PrevMethod->getLocation(), diag::err_previous_declaration); } - return ObjcMethod; + return ObjCMethod; } -Sema::DeclTy *Sema::ActOnAddObjcProperties(SourceLocation AtLoc, - DeclTy **allProperties, unsigned NumProperties, ObjcDeclSpec &DS) { - ObjcPropertyDecl *PDecl = new ObjcPropertyDecl(AtLoc); +Sema::DeclTy *Sema::ActOnAddObjCProperties(SourceLocation AtLoc, + DeclTy **allProperties, unsigned NumProperties, ObjCDeclSpec &DS) { + ObjCPropertyDecl *PDecl = new ObjCPropertyDecl(AtLoc); - if(DS.getPropertyAttributes() & ObjcDeclSpec::DQ_PR_readonly) - PDecl->setPropertyAttributes(ObjcPropertyDecl::OBJC_PR_readonly); + if(DS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_readonly) + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_readonly); - if(DS.getPropertyAttributes() & ObjcDeclSpec::DQ_PR_getter) { - PDecl->setPropertyAttributes(ObjcPropertyDecl::OBJC_PR_getter); + if(DS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_getter) { + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_getter); PDecl->setGetterName(DS.getGetterName()); } - if(DS.getPropertyAttributes() & ObjcDeclSpec::DQ_PR_setter) { - PDecl->setPropertyAttributes(ObjcPropertyDecl::OBJC_PR_setter); + if(DS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_setter) { + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_setter); PDecl->setSetterName(DS.getSetterName()); } - if(DS.getPropertyAttributes() & ObjcDeclSpec::DQ_PR_assign) - PDecl->setPropertyAttributes(ObjcPropertyDecl::OBJC_PR_assign); + if(DS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_assign) + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_assign); - if(DS.getPropertyAttributes() & ObjcDeclSpec::DQ_PR_readwrite) - PDecl->setPropertyAttributes(ObjcPropertyDecl::OBJC_PR_readwrite); + if(DS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_readwrite) + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_readwrite); - if(DS.getPropertyAttributes() & ObjcDeclSpec::DQ_PR_retain) - PDecl->setPropertyAttributes(ObjcPropertyDecl::OBJC_PR_retain); + if(DS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_retain) + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_retain); - if(DS.getPropertyAttributes() & ObjcDeclSpec::DQ_PR_copy) - PDecl->setPropertyAttributes(ObjcPropertyDecl::OBJC_PR_copy); + if(DS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_copy) + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_copy); - if(DS.getPropertyAttributes() & ObjcDeclSpec::DQ_PR_nonatomic) - PDecl->setPropertyAttributes(ObjcPropertyDecl::OBJC_PR_nonatomic); + if(DS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_nonatomic) + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_nonatomic); PDecl->setNumPropertyDecls(NumProperties); if (NumProperties != 0) { - ObjcIvarDecl **properties = new ObjcIvarDecl*[NumProperties]; - memcpy(properties, allProperties, NumProperties*sizeof(ObjcIvarDecl*)); + ObjCIvarDecl **properties = new ObjCIvarDecl*[NumProperties]; + memcpy(properties, allProperties, NumProperties*sizeof(ObjCIvarDecl*)); PDecl->setPropertyDecls(properties); } return PDecl; diff --git a/Sema/SemaExpr.cpp b/Sema/SemaExpr.cpp index d0ade1bea4..cff4908ede 100644 --- a/Sema/SemaExpr.cpp +++ b/Sema/SemaExpr.cpp @@ -81,9 +81,9 @@ Sema::ExprResult Sema::ActOnIdentifierExpr(Scope *S, SourceLocation Loc, D = ImplicitlyDefineFunction(Loc, II, S); else { if (CurMethodDecl) { - ObjcInterfaceDecl *IFace = CurMethodDecl->getClassInterface(); - ObjcInterfaceDecl *clsDeclared; - if (ObjcIvarDecl *IV = IFace->lookupInstanceVariable(&II, clsDeclared)) { + ObjCInterfaceDecl *IFace = CurMethodDecl->getClassInterface(); + ObjCInterfaceDecl *clsDeclared; + if (ObjCIvarDecl *IV = IFace->lookupInstanceVariable(&II, clsDeclared)) { IdentifierInfo &II = Context.Idents.get("self"); ExprResult SelfExpr = ActOnIdentifierExpr(S, Loc, II, false); return new ObjCIvarRefExpr(IV, IV->getType(), Loc, @@ -103,7 +103,7 @@ Sema::ExprResult Sema::ActOnIdentifierExpr(Scope *S, SourceLocation Loc, } if (isa(D)) return Diag(Loc, diag::err_unexpected_typedef, II.getName()); - if (isa(D)) + if (isa(D)) return Diag(Loc, diag::err_unexpected_interface, II.getName()); assert(0 && "Invalid decl"); @@ -535,14 +535,14 @@ ActOnMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc, if (ret.isNull()) return true; return new OCUVectorElementExpr(ret, BaseExpr, Member, MemberLoc); - } else if (BaseType->isObjcInterfaceType()) { - ObjcInterfaceDecl *IFace; - if (isa(BaseType.getCanonicalType())) - IFace = dyn_cast(BaseType)->getDecl(); + } else if (BaseType->isObjCInterfaceType()) { + ObjCInterfaceDecl *IFace; + if (isa(BaseType.getCanonicalType())) + IFace = dyn_cast(BaseType)->getDecl(); else - IFace = dyn_cast(BaseType)->getDecl(); - ObjcInterfaceDecl *clsDeclared; - if (ObjcIvarDecl *IV = IFace->lookupInstanceVariable(&Member, clsDeclared)) + IFace = dyn_cast(BaseType)->getDecl(); + ObjCInterfaceDecl *clsDeclared; + if (ObjCIvarDecl *IV = IFace->lookupInstanceVariable(&Member, clsDeclared)) return new ObjCIvarRefExpr(IV, IV->getType(), MemberLoc, BaseExpr, OpKind==tok::arrow); } @@ -1109,9 +1109,9 @@ Sema::CheckAssignmentConstraints(QualType lhsType, QualType rhsType) { return Incompatible; } - if (lhsType->isObjcQualifiedIdType() - || rhsType->isObjcQualifiedIdType()) { - if (Context.ObjcQualifiedIdTypesAreCompatible(lhsType, rhsType)) + if (lhsType->isObjCQualifiedIdType() + || rhsType->isObjCQualifiedIdType()) { + if (Context.ObjCQualifiedIdTypesAreCompatible(lhsType, rhsType)) return Compatible; return Incompatible; } @@ -1172,7 +1172,7 @@ Sema::AssignConvertType Sema::CheckSingleAssignmentConstraints(QualType lhsType, Expr *&rExpr) { // C99 6.5.16.1p1: the left operand is a pointer and the right is // a null pointer constant. - if ((lhsType->isPointerType() || lhsType->isObjcQualifiedIdType()) + if ((lhsType->isPointerType() || lhsType->isObjCQualifiedIdType()) && rExpr->isNullPointerConstant(Context)) { promoteExprToType(rExpr, lhsType); return Compatible; @@ -1428,8 +1428,8 @@ inline QualType Sema::CheckCompareOperands( // C99 6.5.8 promoteExprToType(rex, lType); // promote the pointer to pointer return Context.IntTy; } - if ((lType->isObjcQualifiedIdType() || rType->isObjcQualifiedIdType()) - && Context.ObjcQualifiedIdTypesAreCompatible(lType, rType, true)) { + if ((lType->isObjCQualifiedIdType() || rType->isObjCQualifiedIdType()) + && Context.ObjCQualifiedIdTypesAreCompatible(lType, rType, true)) { promoteExprToType(rex, lType); return Context.IntTy; } diff --git a/Sema/SemaExprObjC.cpp b/Sema/SemaExprObjC.cpp index a82f6fb493..125a4c4f9d 100644 --- a/Sema/SemaExprObjC.cpp +++ b/Sema/SemaExprObjC.cpp @@ -48,19 +48,19 @@ Sema::ExprResult Sema::ParseObjCStringLiteral(SourceLocation *AtLocs, if (CheckBuiltinCFStringArgument(S)) return true; - if (Context.getObjcConstantStringInterface().isNull()) { + if (Context.getObjCConstantStringInterface().isNull()) { // Initialize the constant string interface lazily. This assumes // the NSConstantString interface is seen in this translation unit. IdentifierInfo *NSIdent = &Context.Idents.get("NSConstantString"); ScopedDecl *IFace = LookupScopedDecl(NSIdent, Decl::IDNS_Ordinary, SourceLocation(), TUScope); - ObjcInterfaceDecl *strIFace = dyn_cast_or_null(IFace); + ObjCInterfaceDecl *strIFace = dyn_cast_or_null(IFace); if (!strIFace) return Diag(S->getLocStart(), diag::err_undef_interface, NSIdent->getName()); - Context.setObjcConstantStringInterface(strIFace); + Context.setObjCConstantStringInterface(strIFace); } - QualType t = Context.getObjcConstantStringInterface(); + QualType t = Context.getObjCConstantStringInterface(); t = Context.getPointerType(t); return new ObjCStringLiteral(S, t, AtLoc); } @@ -81,7 +81,7 @@ Sema::ExprResult Sema::ParseObjCSelectorExpression(Selector Sel, SourceLocation SelLoc, SourceLocation LParenLoc, SourceLocation RParenLoc) { - QualType t = Context.getObjcSelType(); + QualType t = Context.getObjCSelType(); return new ObjCSelectorExpr(t, Sel, AtLoc, RParenLoc); } @@ -90,13 +90,13 @@ Sema::ExprResult Sema::ParseObjCProtocolExpression(IdentifierInfo *ProtocolId, SourceLocation ProtoLoc, SourceLocation LParenLoc, SourceLocation RParenLoc) { - ObjcProtocolDecl* PDecl = ObjcProtocols[ProtocolId]; + ObjCProtocolDecl* PDecl = ObjCProtocols[ProtocolId]; if (!PDecl) { Diag(ProtoLoc, diag::err_undeclared_protocol, ProtocolId->getName()); return true; } - QualType t = Context.getObjcProtoType(); + QualType t = Context.getObjCProtoType(); if (t.isNull()) return true; t = Context.getPointerType(t); @@ -104,7 +104,7 @@ Sema::ExprResult Sema::ParseObjCProtocolExpression(IdentifierInfo *ProtocolId, } bool Sema::CheckMessageArgumentTypes(Expr **Args, unsigned NumArgs, - ObjcMethodDecl *Method) { + ObjCMethodDecl *Method) { bool anyIncompatibleArgs = false; for (unsigned i = 0; i < NumArgs; i++) { @@ -143,7 +143,7 @@ Sema::ExprResult Sema::ActOnClassMessage( assert(receiverName && "missing receiver class name"); Expr **ArgExprs = reinterpret_cast(Args); - ObjcInterfaceDecl* ClassDecl = 0; + ObjCInterfaceDecl* ClassDecl = 0; if (!strcmp(receiverName->getName(), "super") && CurMethodDecl) { ClassDecl = CurMethodDecl->getClassInterface()->getSuperClass(); if (ClassDecl && CurMethodDecl->isInstance()) { @@ -151,7 +151,7 @@ Sema::ExprResult Sema::ActOnClassMessage( // represent super without creating a special expression node. IdentifierInfo &II = Context.Idents.get("self"); ExprResult ReceiverExpr = ActOnIdentifierExpr(S, lbrac, II, false); - QualType superTy = Context.getObjcInterfaceType(ClassDecl); + QualType superTy = Context.getObjCInterfaceType(ClassDecl); superTy = Context.getPointerType(superTy); ReceiverExpr = ActOnCastExpr(SourceLocation(), superTy.getAsOpaquePtr(), SourceLocation(), ReceiverExpr.Val); @@ -165,7 +165,7 @@ Sema::ExprResult Sema::ActOnClassMessage( ClassDecl = getObjCInterfaceDecl(receiverName); // FIXME: can ClassDecl ever be null? - ObjcMethodDecl *Method = ClassDecl->lookupClassMethod(Sel); + ObjCMethodDecl *Method = ClassDecl->lookupClassMethod(Sel); QualType returnType; // Before we give up, check if the selector is an instance method. @@ -174,7 +174,7 @@ Sema::ExprResult Sema::ActOnClassMessage( if (!Method) { Diag(lbrac, diag::warn_method_not_found, std::string("+"), Sel.getName(), SourceRange(lbrac, rbrac)); - returnType = Context.getObjcIdType(); + returnType = Context.getObjCIdType(); } else { returnType = Method->getResultType(); if (Sel.getNumArgs()) { @@ -199,17 +199,17 @@ Sema::ExprResult Sema::ActOnInstanceMessage( Expr *RExpr = static_cast(receiver); QualType receiverType = RExpr->getType(); QualType returnType; - ObjcMethodDecl *Method = 0; + ObjCMethodDecl *Method = 0; - if (receiverType == Context.getObjcIdType() || - receiverType == Context.getObjcClassType()) { + if (receiverType == Context.getObjCIdType() || + receiverType == Context.getObjCClassType()) { Method = InstanceMethodPool[Sel].Method; if (!Method) Method = FactoryMethodPool[Sel].Method; if (!Method) { Diag(lbrac, diag::warn_method_not_found, std::string("-"), Sel.getName(), SourceRange(lbrac, rbrac)); - returnType = Context.getObjcIdType(); + returnType = Context.getObjCIdType(); } else { returnType = Method->getResultType(); if (Sel.getNumArgs()) @@ -217,7 +217,7 @@ Sema::ExprResult Sema::ActOnInstanceMessage( return true; } } else { - bool receiverIsQualId = isa(receiverType); + bool receiverIsQualId = isa(receiverType); // FIXME (snaroff): checking in this code from Patrick. Needs to be // revisited. how do we get the ClassDecl from the receiver expression? if (!receiverIsQualId) @@ -226,15 +226,15 @@ Sema::ExprResult Sema::ActOnInstanceMessage( static_cast(receiverType.getTypePtr()); receiverType = pointerType->getPointeeType(); } - ObjcInterfaceDecl* ClassDecl = 0; - if (ObjcQualifiedInterfaceType *QIT = - dyn_cast(receiverType)) { + ObjCInterfaceDecl* ClassDecl = 0; + if (ObjCQualifiedInterfaceType *QIT = + dyn_cast(receiverType)) { ClassDecl = QIT->getDecl(); Method = ClassDecl->lookupInstanceMethod(Sel); if (!Method) { // search protocols for (unsigned i = 0; i < QIT->getNumProtocols(); i++) { - ObjcProtocolDecl *PDecl = QIT->getProtocols(i); + ObjCProtocolDecl *PDecl = QIT->getProtocols(i); if (PDecl && (Method = PDecl->lookupInstanceMethod(Sel))) break; } @@ -244,11 +244,11 @@ Sema::ExprResult Sema::ActOnInstanceMessage( std::string("-"), Sel.getName(), SourceRange(lbrac, rbrac)); } - else if (ObjcQualifiedIdType *QIT = - dyn_cast(receiverType)) { + else if (ObjCQualifiedIdType *QIT = + dyn_cast(receiverType)) { // search protocols for (unsigned i = 0; i < QIT->getNumProtocols(); i++) { - ObjcProtocolDecl *PDecl = QIT->getProtocols(i); + ObjCProtocolDecl *PDecl = QIT->getProtocols(i); if (PDecl && (Method = PDecl->lookupInstanceMethod(Sel))) break; } @@ -258,9 +258,9 @@ Sema::ExprResult Sema::ActOnInstanceMessage( SourceRange(lbrac, rbrac)); } else { - assert(ObjcInterfaceType::classof(receiverType.getTypePtr()) && + assert(ObjCInterfaceType::classof(receiverType.getTypePtr()) && "bad receiver type"); - ClassDecl = static_cast( + ClassDecl = static_cast( receiverType.getTypePtr())->getDecl(); // FIXME: consider using InstanceMethodPool, since it will be faster // than the following method (which can do *many* linear searches). The @@ -270,8 +270,8 @@ Sema::ExprResult Sema::ActOnInstanceMessage( if (!Method) { // If we have an implementation in scope, check "private" methods. if (ClassDecl) - if (ObjcImplementationDecl *ImpDecl = - ObjcImplementations[ClassDecl->getIdentifier()]) + if (ObjCImplementationDecl *ImpDecl = + ObjCImplementations[ClassDecl->getIdentifier()]) Method = ImpDecl->getInstanceMethod(Sel); // If we still haven't found a method, look in the global pool. This // behavior isn't very desirable, however we need it for GCC @@ -282,7 +282,7 @@ Sema::ExprResult Sema::ActOnInstanceMessage( if (!Method) { Diag(lbrac, diag::warn_method_not_found, std::string("-"), Sel.getName(), SourceRange(lbrac, rbrac)); - returnType = Context.getObjcIdType(); + returnType = Context.getObjCIdType(); } else { returnType = Method->getResultType(); if (Sel.getNumArgs()) diff --git a/Sema/SemaStmt.cpp b/Sema/SemaStmt.cpp index 7219db2621..7f540d4611 100644 --- a/Sema/SemaStmt.cpp +++ b/Sema/SemaStmt.cpp @@ -531,7 +531,7 @@ Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, } Action::StmtResult -Sema::ActOnObjcForCollectionStmt(SourceLocation ForColLoc, +Sema::ActOnObjCForCollectionStmt(SourceLocation ForColLoc, SourceLocation LParenLoc, StmtTy *first, ExprTy *second, SourceLocation RParenLoc, StmtTy *body) { @@ -552,17 +552,17 @@ Sema::ActOnObjcForCollectionStmt(SourceLocation ForColLoc, } else FirstType = static_cast(first)->getType(); - if (!isObjcObjectPointerType(FirstType)) + if (!isObjCObjectPointerType(FirstType)) Diag(ForColLoc, diag::err_selector_element_type, FirstType.getAsString(), First->getSourceRange()); if (Second) { DefaultFunctionArrayConversion(Second); QualType SecondType = Second->getType(); - if (!isObjcObjectPointerType(SecondType)) + if (!isObjCObjectPointerType(SecondType)) Diag(ForColLoc, diag::err_collection_expr_type, SecondType.getAsString(), Second->getSourceRange()); } - return new ObjcForCollectionStmt(First, Second, Body, ForColLoc); + return new ObjCForCollectionStmt(First, Second, Body, ForColLoc); } Action::StmtResult @@ -764,34 +764,34 @@ Sema::StmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc, } Action::StmtResult -Sema::ActOnObjcAtCatchStmt(SourceLocation AtLoc, +Sema::ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, StmtTy *Parm, StmtTy *Body, StmtTy *CatchList) { - ObjcAtCatchStmt *CS = new ObjcAtCatchStmt(AtLoc, RParen, + ObjCAtCatchStmt *CS = new ObjCAtCatchStmt(AtLoc, RParen, static_cast(Parm), static_cast(Body), static_cast(CatchList)); return CatchList ? CatchList : CS; } Action::StmtResult -Sema::ActOnObjcAtFinallyStmt(SourceLocation AtLoc, StmtTy *Body) { - ObjcAtFinallyStmt *FS = new ObjcAtFinallyStmt(AtLoc, +Sema::ActOnObjCAtFinallyStmt(SourceLocation AtLoc, StmtTy *Body) { + ObjCAtFinallyStmt *FS = new ObjCAtFinallyStmt(AtLoc, static_cast(Body)); return FS; } Action::StmtResult -Sema::ActOnObjcAtTryStmt(SourceLocation AtLoc, +Sema::ActOnObjCAtTryStmt(SourceLocation AtLoc, StmtTy *Try, StmtTy *Catch, StmtTy *Finally) { - ObjcAtTryStmt *TS = new ObjcAtTryStmt(AtLoc, static_cast(Try), + ObjCAtTryStmt *TS = new ObjCAtTryStmt(AtLoc, static_cast(Try), static_cast(Catch), static_cast(Finally)); return TS; } Action::StmtResult -Sema::ActOnObjcAtThrowStmt(SourceLocation AtLoc, StmtTy *Throw) { - ObjcAtThrowStmt *TS = new ObjcAtThrowStmt(AtLoc, static_cast(Throw)); +Sema::ActOnObjCAtThrowStmt(SourceLocation AtLoc, StmtTy *Throw) { + ObjCAtThrowStmt *TS = new ObjCAtThrowStmt(AtLoc, static_cast(Throw)); return TS; } diff --git a/Sema/SemaType.cpp b/Sema/SemaType.cpp index 5e9bb3cd82..c4a9c0feaf 100644 --- a/Sema/SemaType.cpp +++ b/Sema/SemaType.cpp @@ -104,22 +104,22 @@ static QualType ConvertDeclSpecToType(const DeclSpec &DS, ASTContext &Ctx) { "Can't handle qualifiers on typedef names yet!"); // FIXME: Adding a TST_objcInterface clause doesn't seem ideal, so // we have this "hack" for now... - if (ObjcInterfaceDecl *ObjcIntDecl = dyn_cast(D)) { + if (ObjCInterfaceDecl *ObjCIntDecl = dyn_cast(D)) { if (DS.getProtocolQualifiers() == 0) - return Ctx.getObjcInterfaceType(ObjcIntDecl); + return Ctx.getObjCInterfaceType(ObjCIntDecl); Action::DeclTy **PPDecl = &(*DS.getProtocolQualifiers())[0]; - return Ctx.getObjcQualifiedInterfaceType(ObjcIntDecl, - reinterpret_cast(PPDecl), + return Ctx.getObjCQualifiedInterfaceType(ObjCIntDecl, + reinterpret_cast(PPDecl), DS.NumProtocolQualifiers()); } else if (TypedefDecl *typeDecl = dyn_cast(D)) { - if (Ctx.getObjcIdType() == Ctx.getTypedefType(typeDecl) + if (Ctx.getObjCIdType() == Ctx.getTypedefType(typeDecl) && DS.getProtocolQualifiers()) { // id Action::DeclTy **PPDecl = &(*DS.getProtocolQualifiers())[0]; - return Ctx.getObjcQualifiedIdType(typeDecl->getUnderlyingType(), - reinterpret_cast(PPDecl), + return Ctx.getObjCQualifiedIdType(typeDecl->getUnderlyingType(), + reinterpret_cast(PPDecl), DS.NumProtocolQualifiers()); } } @@ -346,22 +346,22 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S) { return T; } -/// ObjcGetTypeForMethodDefinition - Builds the type for a method definition +/// ObjCGetTypeForMethodDefinition - Builds the type for a method definition /// declarator -QualType Sema::ObjcGetTypeForMethodDefinition(DeclTy *D) { - ObjcMethodDecl *MDecl = dyn_cast(static_cast(D)); +QualType Sema::ObjCGetTypeForMethodDefinition(DeclTy *D) { + ObjCMethodDecl *MDecl = dyn_cast(static_cast(D)); QualType T = MDecl->getResultType(); llvm::SmallVector ArgTys; // Add the first two invisible argument types for self and _cmd. if (MDecl->isInstance()) { - QualType selfTy = Context.getObjcInterfaceType(MDecl->getClassInterface()); + QualType selfTy = Context.getObjCInterfaceType(MDecl->getClassInterface()); selfTy = Context.getPointerType(selfTy); ArgTys.push_back(selfTy); } else - ArgTys.push_back(Context.getObjcIdType()); - ArgTys.push_back(Context.getObjcSelType()); + ArgTys.push_back(Context.getObjCIdType()); + ArgTys.push_back(Context.getObjCSelType()); for (int i = 0; i < MDecl->getNumParams(); i++) { ParmVarDecl *PDecl = MDecl->getParamDecl(i); diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index f4a8378b4b..be185c38ac 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -41,8 +41,8 @@ class ASTContext { llvm::FoldingSet VectorTypes; llvm::FoldingSet FunctionTypeNoProtos; llvm::FoldingSet FunctionTypeProtos; - llvm::FoldingSet ObjcQualifiedInterfaceTypes; - llvm::FoldingSet ObjcQualifiedIdTypes; + llvm::FoldingSet ObjCQualifiedInterfaceTypes; + llvm::FoldingSet ObjCQualifiedIdTypes; /// ASTRecordLayouts - A cache mapping from RecordDecls to ASTRecordLayouts. /// This is lazily created. This is intentionally not serialized. llvm::DenseMap ASTRecordLayouts; @@ -52,23 +52,23 @@ class ASTContext { /// a builtin that takes a valist is encountered. QualType BuiltinVaListType; - /// ObjcIdType - a psuedo built-in typedef type (set by Sema). - QualType ObjcIdType; + /// ObjCIdType - a psuedo built-in typedef type (set by Sema). + QualType ObjCIdType; const RecordType *IdStructType; - /// ObjcSelType - another psuedo built-in typedef type (set by Sema). - QualType ObjcSelType; + /// ObjCSelType - another psuedo built-in typedef type (set by Sema). + QualType ObjCSelType; const RecordType *SelStructType; - /// ObjcProtoType - another psuedo built-in typedef type (set by Sema). - QualType ObjcProtoType; + /// ObjCProtoType - another psuedo built-in typedef type (set by Sema). + QualType ObjCProtoType; const RecordType *ProtoStructType; - /// ObjcClassType - another psuedo built-in typedef type (set by Sema). - QualType ObjcClassType; + /// ObjCClassType - another psuedo built-in typedef type (set by Sema). + QualType ObjCClassType; const RecordType *ClassStructType; - QualType ObjcConstantStringType; + QualType ObjCConstantStringType; RecordDecl *CFConstantStringTypeDecl; SourceManager &SourceMgr; @@ -162,18 +162,18 @@ public: /// getTypedefType - Return the unique reference to the type for the /// specified typename decl. QualType getTypedefType(TypedefDecl *Decl); - QualType getObjcInterfaceType(ObjcInterfaceDecl *Decl); + QualType getObjCInterfaceType(ObjCInterfaceDecl *Decl); - /// getObjcQualifiedInterfaceType - Return a - /// ObjcQualifiedInterfaceType type for the given interface decl and + /// getObjCQualifiedInterfaceType - Return a + /// ObjCQualifiedInterfaceType type for the given interface decl and /// the conforming protocol list. - QualType getObjcQualifiedInterfaceType(ObjcInterfaceDecl *Decl, - ObjcProtocolDecl **ProtocolList, unsigned NumProtocols); + QualType getObjCQualifiedInterfaceType(ObjCInterfaceDecl *Decl, + ObjCProtocolDecl **ProtocolList, unsigned NumProtocols); - /// getObjcQualifiedIdType - Return an ObjcQualifiedIdType for a + /// getObjCQualifiedIdType - Return an ObjCQualifiedIdType for a /// given 'id' and conforming protocol list. - QualType getObjcQualifiedIdType(QualType idType, - ObjcProtocolDecl **ProtocolList, + QualType getObjCQualifiedIdType(QualType idType, + ObjCProtocolDecl **ProtocolList, unsigned NumProtocols); @@ -198,39 +198,39 @@ public: QualType getCFConstantStringType(); // This setter/getter represents the ObjC type for an NSConstantString. - void setObjcConstantStringInterface(ObjcInterfaceDecl *Decl); - QualType getObjcConstantStringInterface() const { - return ObjcConstantStringType; + void setObjCConstantStringInterface(ObjCInterfaceDecl *Decl); + QualType getObjCConstantStringInterface() const { + return ObjCConstantStringType; } // Return the ObjC type encoding for a given type. - void getObjcEncodingForType(QualType t, std::string &S) const; + void getObjCEncodingForType(QualType t, std::string &S) const; // Put the string version of type qualifiers into S. - void getObjcEncodingForTypeQualifier(Decl::ObjcDeclQualifier QT, + void getObjCEncodingForTypeQualifier(Decl::ObjCDeclQualifier QT, std::string &S) const; - /// getObjcEncodingForMethodDecl - Return the encoded type for this method + /// getObjCEncodingForMethodDecl - Return the encoded type for this method /// declaration. - void getObjcEncodingForMethodDecl(ObjcMethodDecl *Decl, std::string &S); + void getObjCEncodingForMethodDecl(ObjCMethodDecl *Decl, std::string &S); - /// getObjcEncodingTypeSize returns size of type for objective-c encoding + /// getObjCEncodingTypeSize returns size of type for objective-c encoding /// purpose. - int getObjcEncodingTypeSize(QualType t); + int getObjCEncodingTypeSize(QualType t); // This setter/getter repreents the ObjC 'id' type. It is setup lazily, by // Sema. - void setObjcIdType(TypedefDecl *Decl); - QualType getObjcIdType() const { return ObjcIdType; } + void setObjCIdType(TypedefDecl *Decl); + QualType getObjCIdType() const { return ObjCIdType; } - void setObjcSelType(TypedefDecl *Decl); - QualType getObjcSelType() const { return ObjcSelType; } + void setObjCSelType(TypedefDecl *Decl); + QualType getObjCSelType() const { return ObjCSelType; } - void setObjcProtoType(QualType QT); - QualType getObjcProtoType() const { return ObjcProtoType; } + void setObjCProtoType(QualType QT); + QualType getObjCProtoType() const { return ObjCProtoType; } - void setObjcClassType(TypedefDecl *Decl); - QualType getObjcClassType() const { return ObjcClassType; } + void setObjCClassType(TypedefDecl *Decl); + QualType getObjCClassType() const { return ObjCClassType; } void setBuiltinVaListType(QualType T); QualType getBuiltinVaListType() const { return BuiltinVaListType; } @@ -295,20 +295,20 @@ public: bool vectorTypesAreCompatible(QualType, QualType); bool QualifiedInterfaceTypesAreCompatible(QualType, QualType); - bool ObjcQualifiedIdTypesAreCompatible(QualType, QualType, bool = false); + bool ObjCQualifiedIdTypesAreCompatible(QualType, QualType, bool = false); bool objcTypesAreCompatible(QualType, QualType); - bool isObjcIdType(QualType T) const { + bool isObjCIdType(QualType T) const { if (!IdStructType) // ObjC isn't enabled return false; return T->getAsStructureType() == IdStructType; } - bool isObjcClassType(QualType T) const { + bool isObjCClassType(QualType T) const { if (!ClassStructType) // ObjC isn't enabled return false; return T->getAsStructureType() == ClassStructType; } - bool isObjcSelType(QualType T) const { - assert(SelStructType && "isObjcSelType used before 'SEL' type is built"); + bool isObjCSelType(QualType T) const { + assert(SelStructType && "isObjCSelType used before 'SEL' type is built"); return T->getAsStructureType() == SelStructType; } diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index 04b80a1cc3..321eb4b70c 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -43,16 +43,16 @@ public: // Decl // NamedDecl Field, - ObjcIvar, - ObjcCategory, - ObjcCategoryImpl, - ObjcImplementation, - ObjcProtocol, + ObjCIvar, + ObjCCategory, + ObjCCategoryImpl, + ObjCImplementation, + ObjCProtocol, PropertyDecl, // ScopedDecl CompatibleAlias, // TypeDecl - ObjcInterface, + ObjCInterface, Typedef, // TagDecl Enum, @@ -67,16 +67,16 @@ public: BlockVar, FileVar, ParmVar, - ObjcMethod, - ObjcClass, - ObjcForwardProtocol, + ObjCMethod, + ObjCClass, + ObjCForwardProtocol, // For each non-leaf class, we now define a mapping to the first/last member // of the class, to allow efficient classof. NamedFirst = Field, NamedLast = ParmVar, - FieldFirst = Field, FieldLast = ObjcIvar, + FieldFirst = Field, FieldLast = ObjCIvar, ScopedFirst = CompatibleAlias, ScopedLast = ParmVar, - TypeFirst = ObjcInterface, TypeLast = Class, + TypeFirst = ObjCInterface, TypeLast = Class, TagFirst = Enum , TagLast = Class, RecordFirst = Struct , RecordLast = Class, ValueFirst = EnumConstant , ValueLast = ParmVar, @@ -92,10 +92,10 @@ public: IDNS_Ordinary }; - /// ObjcDeclQualifier - Qualifier used on types in method declarations + /// ObjCDeclQualifier - Qualifier used on types in method declarations /// for remote messaging. They are meant for the arguments though and - /// applied to the Decls (ObjcMethodDecl and ParmVarDecl). - enum ObjcDeclQualifier { + /// applied to the Decls (ObjCMethodDecl and ParmVarDecl). + enum ObjCDeclQualifier { OBJC_TQ_None = 0x0, OBJC_TQ_In = 0x1, OBJC_TQ_Inout = 0x2, @@ -143,7 +143,7 @@ public: case FileVar: case ParmVar: case EnumConstant: - case ObjcInterface: + case ObjCInterface: case CompatibleAlias: return IDNS_Ordinary; case Struct: @@ -180,7 +180,7 @@ protected: }; /// NamedDecl - This represents a decl with an identifier for a name. Many -/// decls have names, but not ObjcMethodDecl, @class, etc. +/// decls have names, but not ObjCMethodDecl, @class, etc. class NamedDecl : public Decl { /// Identifier - The identifier for this declaration (e.g. the name for the /// variable, the tag for a struct). @@ -396,8 +396,8 @@ public: : VarDecl(ParmVar, L, Id, T, S, PrevDecl, A), objcDeclQualifier(OBJC_TQ_None) {} - ObjcDeclQualifier getObjcDeclQualifier() const { return objcDeclQualifier; } - void setObjcDeclQualifier(ObjcDeclQualifier QTVal) + ObjCDeclQualifier getObjCDeclQualifier() const { return objcDeclQualifier; } + void setObjCDeclQualifier(ObjCDeclQualifier QTVal) { objcDeclQualifier = QTVal; } // Implement isa/cast/dyncast/etc. @@ -407,7 +407,7 @@ public: private: /// FIXME: Also can be paced into the bitfields in Decl. /// in, inout, etc. - ObjcDeclQualifier objcDeclQualifier : 6; + ObjCDeclQualifier objcDeclQualifier : 6; protected: /// EmitImpl - Serialize this ParmVarDecl. Called by Decl::Emit. diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h index 12d827d9d5..34abdb06a8 100644 --- a/include/clang/AST/DeclObjC.h +++ b/include/clang/AST/DeclObjC.h @@ -22,13 +22,13 @@ class Expr; class Stmt; class FunctionDecl; class AttributeList; -class ObjcIvarDecl; -class ObjcMethodDecl; -class ObjcProtocolDecl; -class ObjcCategoryDecl; -class ObjcPropertyDecl; +class ObjCIvarDecl; +class ObjCMethodDecl; +class ObjCProtocolDecl; +class ObjCCategoryDecl; +class ObjCPropertyDecl; -/// ObjcMethodDecl - Represents an instance or class method declaration. +/// ObjCMethodDecl - Represents an instance or class method declaration. /// ObjC methods can be declared within 4 contexts: class interfaces, /// categories, protocols, and class implementations. While C++ member /// functions leverage C syntax, Objective-C method syntax is modeled after @@ -48,7 +48,7 @@ class ObjcPropertyDecl; /// A selector represents a unique name for a method. The selector names for /// the above methods are setMenu:, menu, replaceSubview:with:, and defaultMenu. /// -class ObjcMethodDecl : public Decl { +class ObjCMethodDecl : public Decl { public: enum ImplementationControl { None, Required, Optional }; private: @@ -62,7 +62,7 @@ private: ImplementationControl DeclImplementation : 2; /// in, inout, etc. - ObjcDeclQualifier objcDeclQualifier : 6; + ObjCDeclQualifier objcDeclQualifier : 6; // Context this method is declared in. NamedDecl *MethodContext; @@ -87,7 +87,7 @@ private: Stmt *Body; ParmVarDecl *SelfDecl; public: - ObjcMethodDecl(SourceLocation beginLoc, SourceLocation endLoc, + ObjCMethodDecl(SourceLocation beginLoc, SourceLocation endLoc, Selector SelInfo, QualType T, Decl *contextDecl, ParmVarDecl **paramInfo = 0, int numParams=-1, @@ -95,17 +95,17 @@ public: bool isVariadic = false, ImplementationControl impControl = None, Decl *PrevDecl = 0) - : Decl(ObjcMethod, beginLoc), + : Decl(ObjCMethod, beginLoc), IsInstance(isInstance), IsVariadic(isVariadic), DeclImplementation(impControl), objcDeclQualifier(OBJC_TQ_None), MethodContext(static_cast(contextDecl)), SelName(SelInfo), MethodDeclType(T), ParamInfo(paramInfo), NumMethodParams(numParams), MethodAttrs(M), EndLoc(endLoc), Body(0), SelfDecl(0) {} - virtual ~ObjcMethodDecl(); + virtual ~ObjCMethodDecl(); - ObjcDeclQualifier getObjcDeclQualifier() const { return objcDeclQualifier; } - void setObjcDeclQualifier(ObjcDeclQualifier QV) { objcDeclQualifier = QV; } + ObjCDeclQualifier getObjCDeclQualifier() const { return objcDeclQualifier; } + void setObjCDeclQualifier(ObjCDeclQualifier QV) { objcDeclQualifier = QV; } // Location information, modeled after the Stmt API. SourceLocation getLocStart() const { return getLocation(); } @@ -113,7 +113,7 @@ public: NamedDecl *getMethodContext() const { return MethodContext; } - ObjcInterfaceDecl *const getClassInterface() const; + ObjCInterfaceDecl *const getClassInterface() const; Selector getSelector() const { return SelName; } QualType getResultType() const { return MethodDeclType; } @@ -154,11 +154,11 @@ public: void setSelfDecl(ParmVarDecl *PVD) { SelfDecl = PVD; } // Implement isa/cast/dyncast/etc. - static bool classof(const Decl *D) { return D->getKind() == ObjcMethod; } - static bool classof(const ObjcMethodDecl *D) { return true; } + static bool classof(const Decl *D) { return D->getKind() == ObjCMethod; } + static bool classof(const ObjCMethodDecl *D) { return true; } }; -/// ObjcInterfaceDecl - Represents an ObjC class declaration. For example: +/// ObjCInterfaceDecl - Represents an ObjC class declaration. For example: /// /// // MostPrimitive declares no super class (not particularly useful). /// @interface MostPrimitive @@ -167,7 +167,7 @@ public: /// /// // NSResponder inherits from NSObject & implements NSCoding (a protocol). /// @interface NSResponder : NSObject -/// { // instance variables are represented by ObjcIvarDecl. +/// { // instance variables are represented by ObjCIvarDecl. /// id nextResponder; // nextResponder instance variable. /// } /// - (NSResponder *)nextResponder; // return a pointer to NSResponder. @@ -179,32 +179,32 @@ public: /// Unlike C++, ObjC is a single-rooted class model. In Cocoa, classes /// typically inherit from NSObject (an exception is NSProxy). /// -class ObjcInterfaceDecl : public TypeDecl { +class ObjCInterfaceDecl : public TypeDecl { /// Class's super class. - ObjcInterfaceDecl *SuperClass; + ObjCInterfaceDecl *SuperClass; /// Protocols referenced in interface header declaration - ObjcProtocolDecl **ReferencedProtocols; // Null if none + ObjCProtocolDecl **ReferencedProtocols; // Null if none unsigned NumReferencedProtocols; // 0 if none /// Ivars/NumIvars - This is a new[]'d array of pointers to Decls. - ObjcIvarDecl **Ivars; // Null if not defined. + ObjCIvarDecl **Ivars; // Null if not defined. int NumIvars; // -1 if not defined. /// instance methods - ObjcMethodDecl **InstanceMethods; // Null if not defined + ObjCMethodDecl **InstanceMethods; // Null if not defined int NumInstanceMethods; // -1 if not defined /// class methods - ObjcMethodDecl **ClassMethods; // Null if not defined + ObjCMethodDecl **ClassMethods; // Null if not defined int NumClassMethods; // -1 if not defined /// List of categories defined for this class. - ObjcCategoryDecl *CategoryList; + ObjCCategoryDecl *CategoryList; /// class properties - ObjcPropertyDecl **PropertyDecl; // Null if no property + ObjCPropertyDecl **PropertyDecl; // Null if no property int NumPropertyDecl; // -1 if no property bool ForwardDecl:1; // declared with @class. @@ -213,10 +213,10 @@ class ObjcInterfaceDecl : public TypeDecl { SourceLocation EndLoc; // marks the '>', '}', or identifier. SourceLocation AtEndLoc; // marks the end of the entire interface. public: - ObjcInterfaceDecl(SourceLocation atLoc, unsigned numRefProtos, + ObjCInterfaceDecl(SourceLocation atLoc, unsigned numRefProtos, IdentifierInfo *Id, bool FD = false, bool isInternal = false) - : TypeDecl(ObjcInterface, atLoc, Id, 0), SuperClass(0), + : TypeDecl(ObjCInterface, atLoc, Id, 0), SuperClass(0), ReferencedProtocols(0), NumReferencedProtocols(0), Ivars(0), NumIvars(-1), InstanceMethods(0), NumInstanceMethods(-1), @@ -229,21 +229,21 @@ public: // This is necessary when converting a forward declaration to a definition. void AllocIntfRefProtocols(unsigned numRefProtos) { if (numRefProtos) { - ReferencedProtocols = new ObjcProtocolDecl*[numRefProtos]; + ReferencedProtocols = new ObjCProtocolDecl*[numRefProtos]; memset(ReferencedProtocols, '\0', - numRefProtos*sizeof(ObjcProtocolDecl*)); + numRefProtos*sizeof(ObjCProtocolDecl*)); NumReferencedProtocols = numRefProtos; } } - ObjcProtocolDecl **getReferencedProtocols() const { + ObjCProtocolDecl **getReferencedProtocols() const { return ReferencedProtocols; } unsigned getNumIntfRefProtocols() const { return NumReferencedProtocols; } int getNumInstanceVariables() const { return NumIvars; } - typedef ObjcIvarDecl * const *ivar_iterator; + typedef ObjCIvarDecl * const *ivar_iterator; unsigned ivar_size() const { return NumIvars == -1 ?0 : NumIvars; } ivar_iterator ivar_begin() const { return Ivars; } ivar_iterator ivar_end() const { return Ivars + ivar_size();} @@ -251,45 +251,45 @@ public: int getNumInstanceMethods() const { return NumInstanceMethods; } int getNumClassMethods() const { return NumClassMethods; } - typedef ObjcMethodDecl * const * instmeth_iterator; + typedef ObjCMethodDecl * const * instmeth_iterator; instmeth_iterator instmeth_begin() const { return InstanceMethods; } instmeth_iterator instmeth_end() const { return InstanceMethods+(NumInstanceMethods == -1 ? 0 : NumInstanceMethods); } - typedef ObjcMethodDecl * const * classmeth_iterator; + typedef ObjCMethodDecl * const * classmeth_iterator; classmeth_iterator classmeth_begin() const { return ClassMethods; } classmeth_iterator classmeth_end() const { return ClassMethods+(NumClassMethods == -1 ? 0 : NumClassMethods); } - void addInstanceVariablesToClass(ObjcIvarDecl **ivars, unsigned numIvars, + void addInstanceVariablesToClass(ObjCIvarDecl **ivars, unsigned numIvars, SourceLocation RBracLoc); - void addMethods(ObjcMethodDecl **insMethods, unsigned numInsMembers, - ObjcMethodDecl **clsMethods, unsigned numClsMembers, + void addMethods(ObjCMethodDecl **insMethods, unsigned numInsMembers, + ObjCMethodDecl **clsMethods, unsigned numClsMembers, SourceLocation AtEnd); bool isForwardDecl() const { return ForwardDecl; } void setForwardDecl(bool val) { ForwardDecl = val; } - void setIntfRefProtocols(unsigned idx, ObjcProtocolDecl *OID) { + void setIntfRefProtocols(unsigned idx, ObjCProtocolDecl *OID) { assert((idx < NumReferencedProtocols) && "index out of range"); ReferencedProtocols[idx] = OID; } - ObjcInterfaceDecl *getSuperClass() const { return SuperClass; } - void setSuperClass(ObjcInterfaceDecl * superCls) { SuperClass = superCls; } + ObjCInterfaceDecl *getSuperClass() const { return SuperClass; } + void setSuperClass(ObjCInterfaceDecl * superCls) { SuperClass = superCls; } - ObjcCategoryDecl* getCategoryList() const { return CategoryList; } - void setCategoryList(ObjcCategoryDecl *category) { + ObjCCategoryDecl* getCategoryList() const { return CategoryList; } + void setCategoryList(ObjCCategoryDecl *category) { CategoryList = category; } - ObjcIvarDecl *lookupInstanceVariable(IdentifierInfo *ivarName, - ObjcInterfaceDecl *&clsDeclared); + ObjCIvarDecl *lookupInstanceVariable(IdentifierInfo *ivarName, + ObjCInterfaceDecl *&clsDeclared); // Get the local instance method declared in this interface. - ObjcMethodDecl *getInstanceMethod(Selector &Sel) { + ObjCMethodDecl *getInstanceMethod(Selector &Sel) { for (instmeth_iterator I = instmeth_begin(), E = instmeth_end(); I != E; ++I) { if ((*I)->getSelector() == Sel) @@ -298,7 +298,7 @@ public: return 0; } // Get the local class method declared in this interface. - ObjcMethodDecl *getClassMethod(Selector &Sel) { + ObjCMethodDecl *getClassMethod(Selector &Sel) { for (classmeth_iterator I = classmeth_begin(), E = classmeth_end(); I != E; ++I) { if ((*I)->getSelector() == Sel) @@ -308,8 +308,8 @@ public: } // Lookup a method. First, we search locally. If a method isn't // found, we search referenced protocols and class categories. - ObjcMethodDecl *lookupInstanceMethod(Selector Sel); - ObjcMethodDecl *lookupClassMethod(Selector Sel); + ObjCMethodDecl *lookupInstanceMethod(Selector Sel); + ObjCMethodDecl *lookupClassMethod(Selector Sel); // Location information, modeled after the Stmt API. SourceLocation getLocStart() const { return getLocation(); } // '@'interface @@ -322,22 +322,22 @@ public: int getNumPropertyDecl() const { return NumPropertyDecl; } void setNumPropertyDecl(int num) { NumPropertyDecl = num; } - ObjcPropertyDecl **const getPropertyDecl() const { return PropertyDecl; } - ObjcPropertyDecl **getPropertyDecl() { return PropertyDecl; } - void setPropertyDecls(ObjcPropertyDecl **properties) { + ObjCPropertyDecl **const getPropertyDecl() const { return PropertyDecl; } + ObjCPropertyDecl **getPropertyDecl() { return PropertyDecl; } + void setPropertyDecls(ObjCPropertyDecl **properties) { PropertyDecl = properties; } /// ImplicitInterfaceDecl - check that this is an implicitely declared - /// ObjcInterfaceDecl node. This is for legacy objective-c @implementation + /// ObjCInterfaceDecl node. This is for legacy objective-c @implementation /// declaration without an @interface declaration. bool ImplicitInterfaceDecl() const { return InternalInterface; } - static bool classof(const Decl *D) { return D->getKind() == ObjcInterface; } - static bool classof(const ObjcInterfaceDecl *D) { return true; } + static bool classof(const Decl *D) { return D->getKind() == ObjCInterface; } + static bool classof(const ObjCInterfaceDecl *D) { return true; } }; -/// ObjcIvarDecl - Represents an ObjC instance variable. In general, ObjC +/// ObjCIvarDecl - Represents an ObjC instance variable. In general, ObjC /// instance variables are identical to C. The only exception is Objective-C /// supports C++ style access control. For example: /// @@ -352,10 +352,10 @@ public: /// id canBePackage; // framework visibility (not available in C++). /// } /// -class ObjcIvarDecl : public FieldDecl { +class ObjCIvarDecl : public FieldDecl { public: - ObjcIvarDecl(SourceLocation L, IdentifierInfo *Id, QualType T) - : FieldDecl(ObjcIvar, L, Id, T) {} + ObjCIvarDecl(SourceLocation L, IdentifierInfo *Id, QualType T) + : FieldDecl(ObjCIvar, L, Id, T) {} enum AccessControl { None, Private, Protected, Public, Package @@ -364,14 +364,14 @@ public: AccessControl getAccessControl() const { return DeclAccess; } // Implement isa/cast/dyncast/etc. - static bool classof(const Decl *D) { return D->getKind() == ObjcIvar; } - static bool classof(const ObjcIvarDecl *D) { return true; } + static bool classof(const Decl *D) { return D->getKind() == ObjCIvar; } + static bool classof(const ObjCIvarDecl *D) { return true; } private: AccessControl DeclAccess : 3; }; -/// ObjcProtocolDecl - Represents a protocol declaration. ObjC protocols +/// ObjCProtocolDecl - Represents a protocol declaration. ObjC protocols /// declare a pure abstract type (i.e no instance variables are permitted). /// Protocols orginally drew inspiration from C++ pure virtual functions (a C++ /// feature with nice semantics and lousy syntax:-). Here is an example: @@ -384,24 +384,24 @@ private: /// @interface ImplementsNSDraggingInfo : NSObject /// @end /// -/// Objc protocols inspired Java interfaces. Unlike Java, ObjC classes and +/// ObjC protocols inspired Java interfaces. Unlike Java, ObjC classes and /// protocols are in distinct namespaces. For example, Cocoa defines both /// an NSObject protocol and class (which isn't allowed in Java). As a result, /// protocols are referenced using angle brackets as follows: /// /// id anyObjectThatImplementsNSDraggingInfo; /// -class ObjcProtocolDecl : public NamedDecl { +class ObjCProtocolDecl : public NamedDecl { /// referenced protocols - ObjcProtocolDecl **ReferencedProtocols; // Null if none + ObjCProtocolDecl **ReferencedProtocols; // Null if none unsigned NumReferencedProtocols; // 0 if none /// protocol instance methods - ObjcMethodDecl **InstanceMethods; // Null if not defined + ObjCMethodDecl **InstanceMethods; // Null if not defined int NumInstanceMethods; // -1 if not defined /// protocol class methods - ObjcMethodDecl **ClassMethods; // Null if not defined + ObjCMethodDecl **ClassMethods; // Null if not defined int NumClassMethods; // -1 if not defined bool isForwardProtoDecl; // declared with @protocol. @@ -409,9 +409,9 @@ class ObjcProtocolDecl : public NamedDecl { SourceLocation EndLoc; // marks the '>' or identifier. SourceLocation AtEndLoc; // marks the end of the entire interface. public: - ObjcProtocolDecl(SourceLocation L, unsigned numRefProtos, + ObjCProtocolDecl(SourceLocation L, unsigned numRefProtos, IdentifierInfo *Id, bool FD = false) - : NamedDecl(ObjcProtocol, L, Id), + : NamedDecl(ObjCProtocol, L, Id), ReferencedProtocols(0), NumReferencedProtocols(0), InstanceMethods(0), NumInstanceMethods(-1), ClassMethods(0), NumClassMethods(-1), @@ -420,42 +420,42 @@ public: } void AllocReferencedProtocols(unsigned numRefProtos) { if (numRefProtos) { - ReferencedProtocols = new ObjcProtocolDecl*[numRefProtos]; + ReferencedProtocols = new ObjCProtocolDecl*[numRefProtos]; memset(ReferencedProtocols, '\0', - numRefProtos*sizeof(ObjcProtocolDecl*)); + numRefProtos*sizeof(ObjCProtocolDecl*)); NumReferencedProtocols = numRefProtos; } } - void addMethods(ObjcMethodDecl **insMethods, unsigned numInsMembers, - ObjcMethodDecl **clsMethods, unsigned numClsMembers, + void addMethods(ObjCMethodDecl **insMethods, unsigned numInsMembers, + ObjCMethodDecl **clsMethods, unsigned numClsMembers, SourceLocation AtEndLoc); - void setReferencedProtocols(unsigned idx, ObjcProtocolDecl *OID) { + void setReferencedProtocols(unsigned idx, ObjCProtocolDecl *OID) { assert((idx < NumReferencedProtocols) && "index out of range"); ReferencedProtocols[idx] = OID; } - ObjcProtocolDecl** getReferencedProtocols() const { + ObjCProtocolDecl** getReferencedProtocols() const { return ReferencedProtocols; } unsigned getNumReferencedProtocols() const { return NumReferencedProtocols; } int getNumInstanceMethods() const { return NumInstanceMethods; } int getNumClassMethods() const { return NumClassMethods; } - typedef ObjcMethodDecl * const * instmeth_iterator; + typedef ObjCMethodDecl * const * instmeth_iterator; instmeth_iterator instmeth_begin() const { return InstanceMethods; } instmeth_iterator instmeth_end() const { return InstanceMethods+(NumInstanceMethods == -1 ? 0 : NumInstanceMethods); } - typedef ObjcMethodDecl * const * classmeth_iterator; + typedef ObjCMethodDecl * const * classmeth_iterator; classmeth_iterator classmeth_begin() const { return ClassMethods; } classmeth_iterator classmeth_end() const { return ClassMethods+(NumClassMethods == -1 ? 0 : NumClassMethods); } // Get the local instance method declared in this interface. - ObjcMethodDecl *getInstanceMethod(Selector &Sel) { + ObjCMethodDecl *getInstanceMethod(Selector &Sel) { for (instmeth_iterator I = instmeth_begin(), E = instmeth_end(); I != E; ++I) { if ((*I)->getSelector() == Sel) @@ -464,7 +464,7 @@ public: return 0; } // Get the local class method declared in this interface. - ObjcMethodDecl *getClassMethod(Selector &Sel) { + ObjCMethodDecl *getClassMethod(Selector &Sel) { for (classmeth_iterator I = classmeth_begin(), E = classmeth_end(); I != E; ++I) { if ((*I)->getSelector() == Sel) @@ -475,8 +475,8 @@ public: // Lookup a method. First, we search locally. If a method isn't // found, we search referenced protocols and class categories. - ObjcMethodDecl *lookupInstanceMethod(Selector Sel); - ObjcMethodDecl *lookupClassMethod(Selector Sel); + ObjCMethodDecl *lookupInstanceMethod(Selector Sel); + ObjCMethodDecl *lookupClassMethod(Selector Sel); bool isForwardDecl() const { return isForwardProtoDecl; } void setForwardDecl(bool val) { isForwardProtoDecl = val; } @@ -489,82 +489,82 @@ public: // We also need to record the @end location. SourceLocation getAtEndLoc() const { return AtEndLoc; } - static bool classof(const Decl *D) { return D->getKind() == ObjcProtocol; } - static bool classof(const ObjcProtocolDecl *D) { return true; } + static bool classof(const Decl *D) { return D->getKind() == ObjCProtocol; } + static bool classof(const ObjCProtocolDecl *D) { return true; } }; -/// ObjcClassDecl - Specifies a list of forward class declarations. For example: +/// ObjCClassDecl - Specifies a list of forward class declarations. For example: /// /// @class NSCursor, NSImage, NSPasteboard, NSWindow; /// -class ObjcClassDecl : public Decl { - ObjcInterfaceDecl **ForwardDecls; +class ObjCClassDecl : public Decl { + ObjCInterfaceDecl **ForwardDecls; unsigned NumForwardDecls; public: - ObjcClassDecl(SourceLocation L, ObjcInterfaceDecl **Elts, unsigned nElts) - : Decl(ObjcClass, L) { + ObjCClassDecl(SourceLocation L, ObjCInterfaceDecl **Elts, unsigned nElts) + : Decl(ObjCClass, L) { if (nElts) { - ForwardDecls = new ObjcInterfaceDecl*[nElts]; - memcpy(ForwardDecls, Elts, nElts*sizeof(ObjcInterfaceDecl*)); + ForwardDecls = new ObjCInterfaceDecl*[nElts]; + memcpy(ForwardDecls, Elts, nElts*sizeof(ObjCInterfaceDecl*)); } else { ForwardDecls = 0; } NumForwardDecls = nElts; } - void setInterfaceDecl(unsigned idx, ObjcInterfaceDecl *OID) { + void setInterfaceDecl(unsigned idx, ObjCInterfaceDecl *OID) { assert(idx < NumForwardDecls && "index out of range"); ForwardDecls[idx] = OID; } - ObjcInterfaceDecl** getForwardDecls() const { return ForwardDecls; } + ObjCInterfaceDecl** getForwardDecls() const { return ForwardDecls; } int getNumForwardDecls() const { return NumForwardDecls; } - static bool classof(const Decl *D) { return D->getKind() == ObjcClass; } - static bool classof(const ObjcClassDecl *D) { return true; } + static bool classof(const Decl *D) { return D->getKind() == ObjCClass; } + static bool classof(const ObjCClassDecl *D) { return true; } }; -/// ObjcForwardProtocolDecl - Specifies a list of forward protocol declarations. +/// ObjCForwardProtocolDecl - Specifies a list of forward protocol declarations. /// For example: /// /// @protocol NSTextInput, NSChangeSpelling, NSDraggingInfo; /// -class ObjcForwardProtocolDecl : public Decl { - ObjcProtocolDecl **ReferencedProtocols; +class ObjCForwardProtocolDecl : public Decl { + ObjCProtocolDecl **ReferencedProtocols; unsigned NumReferencedProtocols; public: - ObjcForwardProtocolDecl(SourceLocation L, - ObjcProtocolDecl **Elts, unsigned nElts) - : Decl(ObjcForwardProtocol, L) { + ObjCForwardProtocolDecl(SourceLocation L, + ObjCProtocolDecl **Elts, unsigned nElts) + : Decl(ObjCForwardProtocol, L) { NumReferencedProtocols = nElts; if (nElts) { - ReferencedProtocols = new ObjcProtocolDecl*[nElts]; - memcpy(ReferencedProtocols, Elts, nElts*sizeof(ObjcProtocolDecl*)); + ReferencedProtocols = new ObjCProtocolDecl*[nElts]; + memcpy(ReferencedProtocols, Elts, nElts*sizeof(ObjCProtocolDecl*)); } else { ReferencedProtocols = 0; } } - void setForwardProtocolDecl(unsigned idx, ObjcProtocolDecl *OID) { + void setForwardProtocolDecl(unsigned idx, ObjCProtocolDecl *OID) { assert(idx < NumReferencedProtocols && "index out of range"); ReferencedProtocols[idx] = OID; } unsigned getNumForwardDecls() const { return NumReferencedProtocols; } - ObjcProtocolDecl *getForwardProtocolDecl(unsigned idx) { + ObjCProtocolDecl *getForwardProtocolDecl(unsigned idx) { assert(idx < NumReferencedProtocols && "index out of range"); return ReferencedProtocols[idx]; } - const ObjcProtocolDecl *getForwardProtocolDecl(unsigned idx) const { + const ObjCProtocolDecl *getForwardProtocolDecl(unsigned idx) const { assert(idx < NumReferencedProtocols && "index out of range"); return ReferencedProtocols[idx]; } static bool classof(const Decl *D) { - return D->getKind() == ObjcForwardProtocol; + return D->getKind() == ObjCForwardProtocol; } - static bool classof(const ObjcForwardProtocolDecl *D) { return true; } + static bool classof(const ObjCForwardProtocolDecl *D) { return true; } }; -/// ObjcCategoryDecl - Represents a category declaration. A category allows +/// ObjCCategoryDecl - Represents a category declaration. A category allows /// you to add methods to an existing class (without subclassing or modifying /// the original class interface or implementation:-). Categories don't allow /// you to add instance data. The following example adds "myMethod" to all @@ -581,71 +581,71 @@ public: /// Lisp and Smalltalk. More traditional class-based languages (C++, Java) /// don't support this level of dynamism, which is both powerful and dangerous. /// -class ObjcCategoryDecl : public NamedDecl { +class ObjCCategoryDecl : public NamedDecl { /// Interface belonging to this category - ObjcInterfaceDecl *ClassInterface; + ObjCInterfaceDecl *ClassInterface; /// referenced protocols in this category - ObjcProtocolDecl **ReferencedProtocols; // Null if none + ObjCProtocolDecl **ReferencedProtocols; // Null if none unsigned NumReferencedProtocols; // 0 if none /// category instance methods - ObjcMethodDecl **InstanceMethods; // Null if not defined + ObjCMethodDecl **InstanceMethods; // Null if not defined int NumInstanceMethods; // -1 if not defined /// category class methods - ObjcMethodDecl **ClassMethods; // Null if not defined + ObjCMethodDecl **ClassMethods; // Null if not defined int NumClassMethods; // -1 if not defined /// Next category belonging to this class - ObjcCategoryDecl *NextClassCategory; + ObjCCategoryDecl *NextClassCategory; SourceLocation EndLoc; // marks the '>' or identifier. SourceLocation AtEndLoc; // marks the end of the entire interface. public: - ObjcCategoryDecl(SourceLocation L, unsigned numRefProtocol,IdentifierInfo *Id) - : NamedDecl(ObjcCategory, L, Id), + ObjCCategoryDecl(SourceLocation L, unsigned numRefProtocol,IdentifierInfo *Id) + : NamedDecl(ObjCCategory, L, Id), ClassInterface(0), ReferencedProtocols(0), NumReferencedProtocols(0), InstanceMethods(0), NumInstanceMethods(-1), ClassMethods(0), NumClassMethods(-1), NextClassCategory(0) { if (numRefProtocol) { - ReferencedProtocols = new ObjcProtocolDecl*[numRefProtocol]; + ReferencedProtocols = new ObjCProtocolDecl*[numRefProtocol]; memset(ReferencedProtocols, '\0', - numRefProtocol*sizeof(ObjcProtocolDecl*)); + numRefProtocol*sizeof(ObjCProtocolDecl*)); NumReferencedProtocols = numRefProtocol; } } - ObjcInterfaceDecl *getClassInterface() const { return ClassInterface; } - void setClassInterface(ObjcInterfaceDecl *IDecl) { ClassInterface = IDecl; } + ObjCInterfaceDecl *getClassInterface() const { return ClassInterface; } + void setClassInterface(ObjCInterfaceDecl *IDecl) { ClassInterface = IDecl; } - void setCatReferencedProtocols(unsigned idx, ObjcProtocolDecl *OID) { + void setCatReferencedProtocols(unsigned idx, ObjCProtocolDecl *OID) { assert((idx < NumReferencedProtocols) && "index out of range"); ReferencedProtocols[idx] = OID; } - ObjcProtocolDecl **getReferencedProtocols() const { + ObjCProtocolDecl **getReferencedProtocols() const { return ReferencedProtocols; } unsigned getNumReferencedProtocols() const { return NumReferencedProtocols; } int getNumInstanceMethods() const { return NumInstanceMethods; } int getNumClassMethods() const { return NumClassMethods; } - typedef ObjcMethodDecl * const * instmeth_iterator; + typedef ObjCMethodDecl * const * instmeth_iterator; instmeth_iterator instmeth_begin() const { return InstanceMethods; } instmeth_iterator instmeth_end() const { return InstanceMethods+(NumInstanceMethods == -1 ? 0 : NumInstanceMethods); } - typedef ObjcMethodDecl * const * classmeth_iterator; + typedef ObjCMethodDecl * const * classmeth_iterator; classmeth_iterator classmeth_begin() const { return ClassMethods; } classmeth_iterator classmeth_end() const { return ClassMethods+(NumClassMethods == -1 ? 0 : NumClassMethods); } // Get the local instance method declared in this interface. - ObjcMethodDecl *getInstanceMethod(Selector &Sel) { + ObjCMethodDecl *getInstanceMethod(Selector &Sel) { for (instmeth_iterator I = instmeth_begin(), E = instmeth_end(); I != E; ++I) { if ((*I)->getSelector() == Sel) @@ -654,7 +654,7 @@ public: return 0; } // Get the local class method declared in this interface. - ObjcMethodDecl *getClassMethod(Selector &Sel) { + ObjCMethodDecl *getClassMethod(Selector &Sel) { for (classmeth_iterator I = classmeth_begin(), E = classmeth_end(); I != E; ++I) { if ((*I)->getSelector() == Sel) @@ -663,11 +663,11 @@ public: return 0; } - void addMethods(ObjcMethodDecl **insMethods, unsigned numInsMembers, - ObjcMethodDecl **clsMethods, unsigned numClsMembers, + void addMethods(ObjCMethodDecl **insMethods, unsigned numInsMembers, + ObjCMethodDecl **clsMethods, unsigned numClsMembers, SourceLocation AtEndLoc); - ObjcCategoryDecl *getNextClassCategory() const { return NextClassCategory; } + ObjCCategoryDecl *getNextClassCategory() const { return NextClassCategory; } void insertNextClassCategory() { NextClassCategory = ClassInterface->getCategoryList(); ClassInterface->setCategoryList(this); @@ -680,51 +680,51 @@ public: // We also need to record the @end location. SourceLocation getAtEndLoc() const { return AtEndLoc; } - static bool classof(const Decl *D) { return D->getKind() == ObjcCategory; } - static bool classof(const ObjcCategoryDecl *D) { return true; } + static bool classof(const Decl *D) { return D->getKind() == ObjCCategory; } + static bool classof(const ObjCCategoryDecl *D) { return true; } }; -/// ObjcCategoryImplDecl - An object of this class encapsulates a category +/// ObjCCategoryImplDecl - An object of this class encapsulates a category /// @implementation declaration. -class ObjcCategoryImplDecl : public NamedDecl { +class ObjCCategoryImplDecl : public NamedDecl { /// Class interface for this category implementation - ObjcInterfaceDecl *ClassInterface; + ObjCInterfaceDecl *ClassInterface; /// implemented instance methods - llvm::SmallVector InstanceMethods; + llvm::SmallVector InstanceMethods; /// implemented class methods - llvm::SmallVector ClassMethods; + llvm::SmallVector ClassMethods; SourceLocation EndLoc; public: - ObjcCategoryImplDecl(SourceLocation L, IdentifierInfo *Id, - ObjcInterfaceDecl *classInterface) - : NamedDecl(ObjcCategoryImpl, L, Id), ClassInterface(classInterface) {} + ObjCCategoryImplDecl(SourceLocation L, IdentifierInfo *Id, + ObjCInterfaceDecl *classInterface) + : NamedDecl(ObjCCategoryImpl, L, Id), ClassInterface(classInterface) {} - ObjcInterfaceDecl *getClassInterface() const { return ClassInterface; } + ObjCInterfaceDecl *getClassInterface() const { return ClassInterface; } unsigned getNumInstanceMethods() const { return InstanceMethods.size(); } unsigned getNumClassMethods() const { return ClassMethods.size(); } - void addInstanceMethod(ObjcMethodDecl *method) { + void addInstanceMethod(ObjCMethodDecl *method) { InstanceMethods.push_back(method); } - void addClassMethod(ObjcMethodDecl *method) { + void addClassMethod(ObjCMethodDecl *method) { ClassMethods.push_back(method); } // Get the instance method definition for this implementation. - ObjcMethodDecl *getInstanceMethod(Selector Sel); + ObjCMethodDecl *getInstanceMethod(Selector Sel); // Get the class method definition for this implementation. - ObjcMethodDecl *getClassMethod(Selector Sel); + ObjCMethodDecl *getClassMethod(Selector Sel); - typedef llvm::SmallVector::const_iterator + typedef llvm::SmallVector::const_iterator instmeth_iterator; instmeth_iterator instmeth_begin() const { return InstanceMethods.begin(); } instmeth_iterator instmeth_end() const { return InstanceMethods.end(); } - typedef llvm::SmallVector::const_iterator + typedef llvm::SmallVector::const_iterator classmeth_iterator; classmeth_iterator classmeth_begin() const { return ClassMethods.begin(); } classmeth_iterator classmeth_end() const { return ClassMethods.end(); } @@ -735,11 +735,11 @@ public: SourceLocation getLocEnd() const { return EndLoc; } void setLocEnd(SourceLocation LE) { EndLoc = LE; }; - static bool classof(const Decl *D) { return D->getKind() == ObjcCategoryImpl;} - static bool classof(const ObjcCategoryImplDecl *D) { return true; } + static bool classof(const Decl *D) { return D->getKind() == ObjCCategoryImpl;} + static bool classof(const ObjCCategoryImplDecl *D) { return true; } }; -/// ObjcImplementationDecl - Represents a class definition - this is where +/// ObjCImplementationDecl - Represents a class definition - this is where /// method definitions are specified. For example: /// /// @implementation MyClass @@ -754,39 +754,39 @@ public: /// the legacy semantics and allow developers to move private ivar declarations /// from the class interface to the class implementation (but I digress:-) /// -class ObjcImplementationDecl : public NamedDecl { +class ObjCImplementationDecl : public NamedDecl { /// Class interface for this category implementation - ObjcInterfaceDecl *ClassInterface; + ObjCInterfaceDecl *ClassInterface; /// Implementation Class's super class. - ObjcInterfaceDecl *SuperClass; + ObjCInterfaceDecl *SuperClass; /// Optional Ivars/NumIvars - This is a new[]'d array of pointers to Decls. - ObjcIvarDecl **Ivars; // Null if not specified + ObjCIvarDecl **Ivars; // Null if not specified int NumIvars; // -1 if not defined. /// implemented instance methods - llvm::SmallVector InstanceMethods; + llvm::SmallVector InstanceMethods; /// implemented class methods - llvm::SmallVector ClassMethods; + llvm::SmallVector ClassMethods; SourceLocation EndLoc; public: - ObjcImplementationDecl(SourceLocation L, IdentifierInfo *Id, - ObjcInterfaceDecl *classInterface, - ObjcInterfaceDecl *superDecl) - : NamedDecl(ObjcImplementation, L, Id), + ObjCImplementationDecl(SourceLocation L, IdentifierInfo *Id, + ObjCInterfaceDecl *classInterface, + ObjCInterfaceDecl *superDecl) + : NamedDecl(ObjCImplementation, L, Id), ClassInterface(classInterface), SuperClass(superDecl), Ivars(0), NumIvars(-1) {} - void ObjcAddInstanceVariablesToClassImpl(ObjcIvarDecl **ivars, + void ObjCAddInstanceVariablesToClassImpl(ObjCIvarDecl **ivars, unsigned numIvars); - void addInstanceMethod(ObjcMethodDecl *method) { + void addInstanceMethod(ObjCMethodDecl *method) { InstanceMethods.push_back(method); } - void addClassMethod(ObjcMethodDecl *method) { + void addClassMethod(ObjCMethodDecl *method) { ClassMethods.push_back(method); } // Location information, modeled after the Stmt API. @@ -794,10 +794,10 @@ public: SourceLocation getLocEnd() const { return EndLoc; } void setLocEnd(SourceLocation LE) { EndLoc = LE; }; - ObjcInterfaceDecl *getClassInterface() const { return ClassInterface; } - ObjcInterfaceDecl *getSuperClass() const { return SuperClass; } + ObjCInterfaceDecl *getClassInterface() const { return ClassInterface; } + ObjCInterfaceDecl *getSuperClass() const { return SuperClass; } - void setSuperClass(ObjcInterfaceDecl * superCls) + void setSuperClass(ObjCInterfaceDecl * superCls) { SuperClass = superCls; } int getNumInstanceMethods() const { return InstanceMethods.size(); } @@ -806,54 +806,54 @@ public: int getImplDeclNumIvars() const { return NumIvars; } - typedef llvm::SmallVector::const_iterator + typedef llvm::SmallVector::const_iterator instmeth_iterator; instmeth_iterator instmeth_begin() const { return InstanceMethods.begin(); } instmeth_iterator instmeth_end() const { return InstanceMethods.end(); } - typedef llvm::SmallVector::const_iterator + typedef llvm::SmallVector::const_iterator classmeth_iterator; classmeth_iterator classmeth_begin() const { return ClassMethods.begin(); } classmeth_iterator classmeth_end() const { return ClassMethods.end(); } // Get the instance method definition for this implementation. - ObjcMethodDecl *getInstanceMethod(Selector Sel); + ObjCMethodDecl *getInstanceMethod(Selector Sel); // Get the class method definition for this implementation. - ObjcMethodDecl *getClassMethod(Selector Sel); + ObjCMethodDecl *getClassMethod(Selector Sel); - typedef ObjcIvarDecl * const *ivar_iterator; + typedef ObjCIvarDecl * const *ivar_iterator; ivar_iterator ivar_begin() const { return Ivars; } ivar_iterator ivar_end() const {return Ivars+(NumIvars == -1 ? 0 : NumIvars);} static bool classof(const Decl *D) { - return D->getKind() == ObjcImplementation; + return D->getKind() == ObjCImplementation; } - static bool classof(const ObjcImplementationDecl *D) { return true; } + static bool classof(const ObjCImplementationDecl *D) { return true; } }; -/// ObjcCompatibleAliasDecl - Represents alias of a class. This alias is +/// ObjCCompatibleAliasDecl - Represents alias of a class. This alias is /// declared as @compatibility_alias alias class. -class ObjcCompatibleAliasDecl : public ScopedDecl { +class ObjCCompatibleAliasDecl : public ScopedDecl { /// Class that this is an alias of. - ObjcInterfaceDecl *AliasedClass; + ObjCInterfaceDecl *AliasedClass; public: - ObjcCompatibleAliasDecl(SourceLocation L, IdentifierInfo *Id, - ObjcInterfaceDecl* aliasedClass) + ObjCCompatibleAliasDecl(SourceLocation L, IdentifierInfo *Id, + ObjCInterfaceDecl* aliasedClass) : ScopedDecl(CompatibleAlias, L, Id, 0), AliasedClass(aliasedClass) {} - ObjcInterfaceDecl *getClassInterface() const { return AliasedClass; } + ObjCInterfaceDecl *getClassInterface() const { return AliasedClass; } static bool classof(const Decl *D) { return D->getKind() == CompatibleAlias; } - static bool classof(const ObjcCompatibleAliasDecl *D) { return true; } + static bool classof(const ObjCCompatibleAliasDecl *D) { return true; } }; -class ObjcPropertyDecl : public Decl { +class ObjCPropertyDecl : public Decl { public: enum PropertyAttributeKind { OBJC_PR_noattr = 0x0, OBJC_PR_readonly = 0x01, @@ -867,7 +867,7 @@ public: private: // List of property name declarations // FIXME: Property is not an ivar. - ObjcIvarDecl **PropertyDecls; + ObjCIvarDecl **PropertyDecls; int NumPropertyDecls; PropertyAttributeKind PropertyAttributes : 8; @@ -876,13 +876,13 @@ private: IdentifierInfo *SetterName; // setter name of NULL if no setter public: - ObjcPropertyDecl(SourceLocation L) + ObjCPropertyDecl(SourceLocation L) : Decl(PropertyDecl, L), PropertyDecls(0), NumPropertyDecls(-1), PropertyAttributes(OBJC_PR_noattr), GetterName(0), SetterName(0) {} - ObjcIvarDecl **const getPropertyDecls() const { return PropertyDecls; } - void setPropertyDecls(ObjcIvarDecl **property) { PropertyDecls = property; } + ObjCIvarDecl **const getPropertyDecls() const { return PropertyDecls; } + void setPropertyDecls(ObjCIvarDecl **property) { PropertyDecls = property; } const int getNumPropertyDecls() const { return NumPropertyDecls; } void setNumPropertyDecls(int num) { NumPropertyDecls = num; } @@ -905,7 +905,7 @@ public: static bool classof(const Decl *D) { return D->getKind() == PropertyDecl; } - static bool classof(const ObjcPropertyDecl *D) { return true; } + static bool classof(const ObjCPropertyDecl *D) { return true; } }; } // end namespace clang diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h index 151fc066e0..da18d09dd1 100644 --- a/include/clang/AST/Expr.h +++ b/include/clang/AST/Expr.h @@ -1283,15 +1283,15 @@ public: /// ObjCProtocolExpr used for protocol in Objective-C. class ObjCProtocolExpr : public Expr { - ObjcProtocolDecl *Protocol; + ObjCProtocolDecl *Protocol; SourceLocation AtLoc, RParenLoc; public: - ObjCProtocolExpr(QualType T, ObjcProtocolDecl *protocol, + ObjCProtocolExpr(QualType T, ObjCProtocolDecl *protocol, SourceLocation at, SourceLocation rp) : Expr(ObjCProtocolExprClass, T), Protocol(protocol), AtLoc(at), RParenLoc(rp) {} - ObjcProtocolDecl *getProtocol() const { return Protocol; } + ObjCProtocolDecl *getProtocol() const { return Protocol; } SourceLocation getAtLoc() const { return AtLoc; } SourceLocation getRParenLoc() const { return RParenLoc; } @@ -1309,20 +1309,20 @@ public: /// ObjCIvarRefExpr - A reference to an ObjC instance variable. class ObjCIvarRefExpr : public Expr { - class ObjcIvarDecl *D; + class ObjCIvarDecl *D; SourceLocation Loc; Expr *Base; bool IsArrow:1; // True if this is "X->F", false if this is "X.F". bool IsFreeIvar:1; // True if ivar reference has no base (self assumed). public: - ObjCIvarRefExpr(ObjcIvarDecl *d, QualType t, SourceLocation l, Expr *base=0, + ObjCIvarRefExpr(ObjCIvarDecl *d, QualType t, SourceLocation l, Expr *base=0, bool arrow = false, bool freeIvar = false) : Expr(ObjCIvarRefExprClass, t), D(d), Loc(l), Base(base), IsArrow(arrow), IsFreeIvar(freeIvar) {} - ObjcIvarDecl *getDecl() { return D; } - const ObjcIvarDecl *getDecl() const { return D; } + ObjCIvarDecl *getDecl() { return D; } + const ObjCIvarDecl *getDecl() const { return D; } virtual SourceRange getSourceRange() const { return SourceRange(Loc); } Expr *const getBase() const { return Base; } const bool isArrow() const { return IsArrow; } @@ -1356,7 +1356,7 @@ class ObjCMessageExpr : public Expr { // A method prototype for this message (optional). // FIXME: Since method decls contain the selector, and most messages have a // prototype, consider devising a scheme for unifying SelName/MethodProto. - ObjcMethodDecl *MethodProto; + ObjCMethodDecl *MethodProto; IdentifierInfo *ClassName; // optional - 0 for instance messages. @@ -1365,12 +1365,12 @@ public: // constructor for class messages. // FIXME: clsName should be typed to ObjCInterfaceType ObjCMessageExpr(IdentifierInfo *clsName, Selector selInfo, - QualType retType, ObjcMethodDecl *methDecl, + QualType retType, ObjCMethodDecl *methDecl, SourceLocation LBrac, SourceLocation RBrac, Expr **ArgExprs, unsigned NumArgs); // constructor for instance messages. ObjCMessageExpr(Expr *receiver, Selector selInfo, - QualType retType, ObjcMethodDecl *methDecl, + QualType retType, ObjCMethodDecl *methDecl, SourceLocation LBrac, SourceLocation RBrac, Expr **ArgExprs, unsigned NumArgs); ~ObjCMessageExpr() { @@ -1383,8 +1383,8 @@ public: const Selector &getSelector() const { return SelName; } Selector &getSelector() { return SelName; } - const ObjcMethodDecl *getMethodDecl() const { return MethodProto; } - ObjcMethodDecl *getMethodDecl() { return MethodProto; } + const ObjCMethodDecl *getMethodDecl() const { return MethodProto; } + ObjCMethodDecl *getMethodDecl() { return MethodProto; } const IdentifierInfo *getClassName() const { return ClassName; } IdentifierInfo *getClassName() { return ClassName; } diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h index 445b8e4844..04184f44df 100644 --- a/include/clang/AST/Stmt.h +++ b/include/clang/AST/Stmt.h @@ -573,17 +573,17 @@ public: static ForStmt* CreateImpl(llvm::Deserializer& D); }; -/// ObjcForCollectionStmt - This represents Objective-c's collection statement; +/// ObjCForCollectionStmt - This represents Objective-c's collection statement; /// represented as 'for (element 'in' collection-expression)' stmt. /// -class ObjcForCollectionStmt : public Stmt { +class ObjCForCollectionStmt : public Stmt { enum { ELEM, COLLECTION, BODY, END_EXPR }; Stmt* SubExprs[END_EXPR]; // SubExprs[ELEM] is an expression or declstmt. SourceLocation ForLoc; public: - ObjcForCollectionStmt(Stmt *Elem, Expr *Collect, Stmt *Body, + ObjCForCollectionStmt(Stmt *Elem, Expr *Collect, Stmt *Body, SourceLocation FCL) - : Stmt(ObjcForCollectionStmtClass) { + : Stmt(ObjCForCollectionStmtClass) { SubExprs[ELEM] = Elem; SubExprs[COLLECTION] = reinterpret_cast(Collect); SubExprs[BODY] = Body; @@ -606,16 +606,16 @@ public: return SourceRange(ForLoc, SubExprs[BODY]->getLocEnd()); } static bool classof(const Stmt *T) { - return T->getStmtClass() == ObjcForCollectionStmtClass; + return T->getStmtClass() == ObjCForCollectionStmtClass; } - static bool classof(const ObjcForCollectionStmt *) { return true; } + static bool classof(const ObjCForCollectionStmt *) { return true; } // Iterators virtual child_iterator child_begin(); virtual child_iterator child_end(); virtual void EmitImpl(llvm::Serializer& S) const; - static ObjcForCollectionStmt* CreateImpl(llvm::Deserializer& D); + static ObjCForCollectionStmt* CreateImpl(llvm::Deserializer& D); }; /// GotoStmt - This represents a direct goto. @@ -819,30 +819,30 @@ public: static AsmStmt* CreateImpl(llvm::Deserializer& D); }; -/// ObjcAtCatchStmt - This represents objective-c's @catch statement. -class ObjcAtCatchStmt : public Stmt { +/// ObjCAtCatchStmt - This represents objective-c's @catch statement. +class ObjCAtCatchStmt : public Stmt { private: // Points to next @catch statement, or null - ObjcAtCatchStmt *NextAtCatchStmt; + ObjCAtCatchStmt *NextAtCatchStmt; enum { SELECTOR, BODY, END_EXPR }; Stmt *SubExprs[END_EXPR]; SourceLocation AtCatchLoc, RParenLoc; // Used by deserialization. - ObjcAtCatchStmt(SourceLocation atCatchLoc, SourceLocation rparenloc) - : Stmt(ObjcAtCatchStmtClass), AtCatchLoc(atCatchLoc), RParenLoc(rparenloc) {} + ObjCAtCatchStmt(SourceLocation atCatchLoc, SourceLocation rparenloc) + : Stmt(ObjCAtCatchStmtClass), AtCatchLoc(atCatchLoc), RParenLoc(rparenloc) {} public: - ObjcAtCatchStmt(SourceLocation atCatchLoc, SourceLocation rparenloc, + ObjCAtCatchStmt(SourceLocation atCatchLoc, SourceLocation rparenloc, Stmt *catchVarStmtDecl, Stmt *atCatchStmt, Stmt *atCatchList) - : Stmt(ObjcAtCatchStmtClass) { + : Stmt(ObjCAtCatchStmtClass) { SubExprs[SELECTOR] = catchVarStmtDecl; SubExprs[BODY] = atCatchStmt; if (!atCatchList) NextAtCatchStmt = NULL; else { - ObjcAtCatchStmt *AtCatchList = - static_cast(atCatchList); + ObjCAtCatchStmt *AtCatchList = + static_cast(atCatchList); while (AtCatchList->NextAtCatchStmt) AtCatchList = AtCatchList->NextAtCatchStmt; AtCatchList->NextAtCatchStmt = this; @@ -853,8 +853,8 @@ public: const Stmt *getCatchBody() const { return SubExprs[BODY]; } Stmt *getCatchBody() { return SubExprs[BODY]; } - const ObjcAtCatchStmt *getNextCatchStmt() const { return NextAtCatchStmt; } - ObjcAtCatchStmt *getNextCatchStmt() { return NextAtCatchStmt; } + const ObjCAtCatchStmt *getNextCatchStmt() const { return NextAtCatchStmt; } + ObjCAtCatchStmt *getNextCatchStmt() { return NextAtCatchStmt; } const Stmt *getCatchParamStmt() const { return SubExprs[SELECTOR]; } Stmt *getCatchParamStmt() { return SubExprs[SELECTOR]; } @@ -865,24 +865,24 @@ public: } static bool classof(const Stmt *T) { - return T->getStmtClass() == ObjcAtCatchStmtClass; + return T->getStmtClass() == ObjCAtCatchStmtClass; } - static bool classof(const ObjcAtCatchStmt *) { return true; } + static bool classof(const ObjCAtCatchStmt *) { return true; } virtual child_iterator child_begin(); virtual child_iterator child_end(); virtual void EmitImpl(llvm::Serializer& S) const; - static ObjcAtCatchStmt* CreateImpl(llvm::Deserializer& D); + static ObjCAtCatchStmt* CreateImpl(llvm::Deserializer& D); }; -/// ObjcAtFinallyStmt - This represent objective-c's @finally Statement -class ObjcAtFinallyStmt : public Stmt { +/// ObjCAtFinallyStmt - This represent objective-c's @finally Statement +class ObjCAtFinallyStmt : public Stmt { Stmt *AtFinallyStmt; SourceLocation AtFinallyLoc; public: - ObjcAtFinallyStmt(SourceLocation atFinallyLoc, Stmt *atFinallyStmt) - : Stmt(ObjcAtFinallyStmtClass), + ObjCAtFinallyStmt(SourceLocation atFinallyLoc, Stmt *atFinallyStmt) + : Stmt(ObjCAtFinallyStmtClass), AtFinallyStmt(atFinallyStmt), AtFinallyLoc(atFinallyLoc) {} const Stmt *getFinallyBody () const { return AtFinallyStmt; } @@ -893,30 +893,30 @@ public: } static bool classof(const Stmt *T) { - return T->getStmtClass() == ObjcAtFinallyStmtClass; + return T->getStmtClass() == ObjCAtFinallyStmtClass; } - static bool classof(const ObjcAtFinallyStmt *) { return true; } + static bool classof(const ObjCAtFinallyStmt *) { return true; } virtual child_iterator child_begin(); virtual child_iterator child_end(); virtual void EmitImpl(llvm::Serializer& S) const; - static ObjcAtFinallyStmt* CreateImpl(llvm::Deserializer& D); + static ObjCAtFinallyStmt* CreateImpl(llvm::Deserializer& D); }; -/// ObjcAtTryStmt - This represent objective-c's over-all +/// ObjCAtTryStmt - This represent objective-c's over-all /// @try ... @catch ... @finally statement. -class ObjcAtTryStmt : public Stmt { +class ObjCAtTryStmt : public Stmt { private: enum { TRY, CATCH, FINALLY, END_EXPR }; Stmt* SubStmts[END_EXPR]; SourceLocation AtTryLoc; public: - ObjcAtTryStmt(SourceLocation atTryLoc, Stmt *atTryStmt, + ObjCAtTryStmt(SourceLocation atTryLoc, Stmt *atTryStmt, Stmt *atCatchStmt, Stmt *atFinallyStmt) - : Stmt(ObjcAtTryStmtClass) { + : Stmt(ObjCAtTryStmtClass) { SubStmts[TRY] = atTryStmt; SubStmts[CATCH] = atCatchStmt; SubStmts[FINALLY] = atFinallyStmt; @@ -925,41 +925,41 @@ public: const Stmt *getTryBody() const { return SubStmts[TRY]; } Stmt *getTryBody() { return SubStmts[TRY]; } - const ObjcAtCatchStmt *getCatchStmts() const { - return dyn_cast_or_null(SubStmts[CATCH]); + const ObjCAtCatchStmt *getCatchStmts() const { + return dyn_cast_or_null(SubStmts[CATCH]); } - ObjcAtCatchStmt *getCatchStmts() { - return dyn_cast_or_null(SubStmts[CATCH]); + ObjCAtCatchStmt *getCatchStmts() { + return dyn_cast_or_null(SubStmts[CATCH]); } - const ObjcAtFinallyStmt *getFinallyStmt() const { - return dyn_cast_or_null(SubStmts[FINALLY]); + const ObjCAtFinallyStmt *getFinallyStmt() const { + return dyn_cast_or_null(SubStmts[FINALLY]); } - ObjcAtFinallyStmt *getFinallyStmt() { - return dyn_cast_or_null(SubStmts[FINALLY]); + ObjCAtFinallyStmt *getFinallyStmt() { + return dyn_cast_or_null(SubStmts[FINALLY]); } virtual SourceRange getSourceRange() const { return SourceRange(AtTryLoc, SubStmts[TRY]->getLocEnd()); } static bool classof(const Stmt *T) { - return T->getStmtClass() == ObjcAtTryStmtClass; + return T->getStmtClass() == ObjCAtTryStmtClass; } - static bool classof(const ObjcAtTryStmt *) { return true; } + static bool classof(const ObjCAtTryStmt *) { return true; } virtual child_iterator child_begin(); virtual child_iterator child_end(); virtual void EmitImpl(llvm::Serializer& S) const; - static ObjcAtTryStmt* CreateImpl(llvm::Deserializer& D); + static ObjCAtTryStmt* CreateImpl(llvm::Deserializer& D); }; -/// ObjcAtThrowStmt - This represents objective-c's @throw statement. -class ObjcAtThrowStmt : public Stmt { +/// ObjCAtThrowStmt - This represents objective-c's @throw statement. +class ObjCAtThrowStmt : public Stmt { Stmt *Throw; SourceLocation AtThrowLoc; public: - ObjcAtThrowStmt(SourceLocation atThrowLoc, Stmt *throwExpr) - : Stmt(ObjcAtThrowStmtClass), Throw(throwExpr) { + ObjCAtThrowStmt(SourceLocation atThrowLoc, Stmt *throwExpr) + : Stmt(ObjCAtThrowStmtClass), Throw(throwExpr) { AtThrowLoc = atThrowLoc; } @@ -970,15 +970,15 @@ public: } static bool classof(const Stmt *T) { - return T->getStmtClass() == ObjcAtThrowStmtClass; + return T->getStmtClass() == ObjCAtThrowStmtClass; } - static bool classof(const ObjcAtThrowStmt *) { return true; } + static bool classof(const ObjCAtThrowStmt *) { return true; } virtual child_iterator child_begin(); virtual child_iterator child_end(); virtual void EmitImpl(llvm::Serializer& S) const; - static ObjcAtThrowStmt* CreateImpl(llvm::Deserializer& D); + static ObjCAtThrowStmt* CreateImpl(llvm::Deserializer& D); }; } // end namespace clang diff --git a/include/clang/AST/StmtNodes.def b/include/clang/AST/StmtNodes.def index 387ff651e1..99262a71a0 100644 --- a/include/clang/AST/StmtNodes.def +++ b/include/clang/AST/StmtNodes.def @@ -45,12 +45,12 @@ STMT(17, SwitchCase , Stmt) STMT(18, AsmStmt , Stmt) // Obj-C statements -STMT(19, ObjcAtTryStmt , Stmt) -STMT(20, ObjcAtCatchStmt , Stmt) -STMT(21, ObjcAtFinallyStmt , Stmt) -STMT(22, ObjcAtThrowStmt , Stmt) +STMT(19, ObjCAtTryStmt , Stmt) +STMT(20, ObjCAtCatchStmt , Stmt) +STMT(21, ObjCAtFinallyStmt , Stmt) +STMT(22, ObjCAtThrowStmt , Stmt) // Obj-C2 statements -STMT(23, ObjcForCollectionStmt, Stmt) +STMT(23, ObjCForCollectionStmt, Stmt) LAST_STMT(23) diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index f69aad57dd..eba5172687 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -33,9 +33,9 @@ namespace clang { class RecordDecl; class EnumDecl; class FieldDecl; - class ObjcInterfaceDecl; - class ObjcProtocolDecl; - class ObjcMethodDecl; + class ObjCInterfaceDecl; + class ObjCProtocolDecl; + class ObjCMethodDecl; class Expr; class SourceLocation; class PointerType; @@ -50,7 +50,7 @@ namespace clang { class FunctionType; class OCUVectorType; class BuiltinType; - class ObjcQualifiedInterfaceType; + class ObjCQualifiedInterfaceType; class StmtIteratorBase; /// QualType - For efficiency, we don't store CVR-qualified types as nodes on @@ -219,8 +219,8 @@ public: Vector, OCUVector, FunctionNoProto, FunctionProto, TypeName, Tagged, - ObjcInterface, ObjcQualifiedInterface, - ObjcQualifiedId, + ObjCInterface, ObjCQualifiedInterface, + ObjCQualifiedId, TypeOfExp, TypeOfTyp // GNU typeof extension. }; private: @@ -294,8 +294,8 @@ public: bool isUnionType() const; bool isVectorType() const; // GCC vector type. bool isOCUVectorType() const; // OCU vector type. - bool isObjcInterfaceType() const; // includes conforming protocol type - bool isObjcQualifiedIdType() const; // id includes conforming protocol type + bool isObjCInterfaceType() const; // includes conforming protocol type + bool isObjCQualifiedIdType() const; // id includes conforming protocol type // Type Checking Functions: Check to see if this type is structurally the // specified type, ignoring typedefs, and return a pointer to the best type @@ -901,83 +901,83 @@ protected: friend class Type; }; -class ObjcInterfaceType : public Type { - ObjcInterfaceDecl *Decl; +class ObjCInterfaceType : public Type { + ObjCInterfaceDecl *Decl; protected: - ObjcInterfaceType(TypeClass tc, ObjcInterfaceDecl *D) : + ObjCInterfaceType(TypeClass tc, ObjCInterfaceDecl *D) : Type(tc, QualType()), Decl(D) { } friend class ASTContext; // ASTContext creates these. public: - ObjcInterfaceDecl *getDecl() const { return Decl; } + ObjCInterfaceDecl *getDecl() const { return Decl; } virtual void getAsStringInternal(std::string &InnerString) const; static bool classof(const Type *T) { - return T->getTypeClass() == ObjcInterface; + return T->getTypeClass() == ObjCInterface; } - static bool classof(const ObjcInterfaceType *) { return true; } + static bool classof(const ObjCInterfaceType *) { return true; } }; -/// ObjcQualifiedInterfaceType - This class represents interface types +/// ObjCQualifiedInterfaceType - This class represents interface types /// conforming to a list of protocols; such as, INTF. /// Duplicate protocols are removed and protocol list is canonicalized to be in /// alphabetical order. -class ObjcQualifiedInterfaceType : public ObjcInterfaceType, +class ObjCQualifiedInterfaceType : public ObjCInterfaceType, public llvm::FoldingSetNode { // List of protocols for this protocol conforming object type // List is sorted on protocol name. No protocol is enterred more than once. - llvm::SmallVector Protocols; + llvm::SmallVector Protocols; - ObjcQualifiedInterfaceType(ObjcInterfaceDecl *D, - ObjcProtocolDecl **Protos, unsigned NumP) : - ObjcInterfaceType(ObjcQualifiedInterface, D), + ObjCQualifiedInterfaceType(ObjCInterfaceDecl *D, + ObjCProtocolDecl **Protos, unsigned NumP) : + ObjCInterfaceType(ObjCQualifiedInterface, D), Protocols(Protos, Protos+NumP) { } friend class ASTContext; // ASTContext creates these. public: - ObjcProtocolDecl *getProtocols(unsigned i) const { + ObjCProtocolDecl *getProtocols(unsigned i) const { return Protocols[i]; } unsigned getNumProtocols() const { return Protocols.size(); } - ObjcProtocolDecl **getReferencedProtocols() { + ObjCProtocolDecl **getReferencedProtocols() { return &Protocols[0]; } virtual void getAsStringInternal(std::string &InnerString) const; void Profile(llvm::FoldingSetNodeID &ID); static void Profile(llvm::FoldingSetNodeID &ID, - ObjcProtocolDecl **protocols, unsigned NumProtocols); + ObjCProtocolDecl **protocols, unsigned NumProtocols); static bool classof(const Type *T) { - return T->getTypeClass() == ObjcQualifiedInterface; + return T->getTypeClass() == ObjCQualifiedInterface; } - static bool classof(const ObjcQualifiedInterfaceType *) { return true; } + static bool classof(const ObjCQualifiedInterfaceType *) { return true; } }; -/// ObjcQualifiedIdType - to represent id -class ObjcQualifiedIdType : public Type, +/// ObjCQualifiedIdType - to represent id +class ObjCQualifiedIdType : public Type, public llvm::FoldingSetNode { // List of protocols for this protocol conforming 'id' type // List is sorted on protocol name. No protocol is enterred more than once. - llvm::SmallVector Protocols; + llvm::SmallVector Protocols; - ObjcQualifiedIdType(QualType can, ObjcProtocolDecl **Protos, unsigned NumP) - : Type(ObjcQualifiedId, can), + ObjCQualifiedIdType(QualType can, ObjCProtocolDecl **Protos, unsigned NumP) + : Type(ObjCQualifiedId, can), Protocols(Protos, Protos+NumP) { } friend class ASTContext; // ASTContext creates these. public: - ObjcProtocolDecl *getProtocols(unsigned i) const { + ObjCProtocolDecl *getProtocols(unsigned i) const { return Protocols[i]; } unsigned getNumProtocols() const { return Protocols.size(); } - ObjcProtocolDecl **getReferencedProtocols() { + ObjCProtocolDecl **getReferencedProtocols() { return &Protocols[0]; } @@ -985,12 +985,12 @@ public: void Profile(llvm::FoldingSetNodeID &ID); static void Profile(llvm::FoldingSetNodeID &ID, - ObjcProtocolDecl **protocols, unsigned NumProtocols); + ObjCProtocolDecl **protocols, unsigned NumProtocols); static bool classof(const Type *T) { - return T->getTypeClass() == ObjcQualifiedId; + return T->getTypeClass() == ObjCQualifiedId; } - static bool classof(const ObjcQualifiedIdType *) { return true; } + static bool classof(const ObjCQualifiedIdType *) { return true; } }; @@ -1052,12 +1052,12 @@ inline bool Type::isVectorType() const { inline bool Type::isOCUVectorType() const { return isa(CanonicalType); } -inline bool Type::isObjcInterfaceType() const { - return isa(CanonicalType) - || isa(CanonicalType); +inline bool Type::isObjCInterfaceType() const { + return isa(CanonicalType) + || isa(CanonicalType); } -inline bool Type::isObjcQualifiedIdType() const { - return isa(CanonicalType); +inline bool Type::isObjCQualifiedIdType() const { + return isa(CanonicalType); } } // end namespace clang diff --git a/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h b/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h index da4ef30f92..5ce21e4fdb 100644 --- a/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h +++ b/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h @@ -63,7 +63,7 @@ public: DISPATCH_CASE(Union,RecordDecl) // FIXME: Refine. DISPATCH_CASE(Class,RecordDecl) // FIXME: Refine. DISPATCH_CASE(Enum,EnumDecl) - DISPATCH_CASE(ObjcInterface,ObjcInterfaceDecl) + DISPATCH_CASE(ObjCInterface,ObjCInterfaceDecl) default: assert(false && "Subtype of ScopedDecl not handled."); } @@ -78,11 +78,11 @@ public: DEFAULT_DISPATCH(TypedefDecl) DEFAULT_DISPATCH(RecordDecl) DEFAULT_DISPATCH(EnumDecl) - DEFAULT_DISPATCH(ObjcInterfaceDecl) - DEFAULT_DISPATCH(ObjcClassDecl) - DEFAULT_DISPATCH(ObjcMethodDecl) - DEFAULT_DISPATCH(ObjcProtocolDecl) - DEFAULT_DISPATCH(ObjcCategoryDecl) + DEFAULT_DISPATCH(ObjCInterfaceDecl) + DEFAULT_DISPATCH(ObjCClassDecl) + DEFAULT_DISPATCH(ObjCMethodDecl) + DEFAULT_DISPATCH(ObjCProtocolDecl) + DEFAULT_DISPATCH(ObjCCategoryDecl) }; } // end namespace clang diff --git a/include/clang/Parse/Action.h b/include/clang/Parse/Action.h index bfd6624389..8b4a0c1bfd 100644 --- a/include/clang/Parse/Action.h +++ b/include/clang/Parse/Action.h @@ -21,7 +21,7 @@ namespace clang { // Semantic. class DeclSpec; - class ObjcDeclSpec; + class ObjCDeclSpec; class Declarator; class AttributeList; // Parse. @@ -131,7 +131,7 @@ public: return ActOnDeclarator(FnBodyScope, D, 0); } - virtual void ObjcActOnStartOfMethodDef(Scope *FnBodyScope, DeclTy *D) { + virtual void ObjCActOnStartOfMethodDef(Scope *FnBodyScope, DeclTy *D) { return; } @@ -265,7 +265,7 @@ public: SourceLocation RParenLoc, StmtTy *Body) { return 0; } - virtual StmtResult ActOnObjcForCollectionStmt(SourceLocation ForColLoc, + virtual StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, SourceLocation LParenLoc, StmtTy *First, ExprTy *Second, SourceLocation RParenLoc, StmtTy *Body) { @@ -307,24 +307,24 @@ public: } // Objective-c statements - virtual StmtResult ActOnObjcAtCatchStmt(SourceLocation AtLoc, + virtual StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, StmtTy *Parm, StmtTy *Body, StmtTy *CatchList) { return 0; } - virtual StmtResult ActOnObjcAtFinallyStmt(SourceLocation AtLoc, + virtual StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, StmtTy *Body) { return 0; } - virtual StmtResult ActOnObjcAtTryStmt(SourceLocation AtLoc, + virtual StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, StmtTy *Try, StmtTy *Catch, StmtTy *Finally) { return 0; } - virtual StmtResult ActOnObjcAtThrowStmt(SourceLocation AtLoc, + virtual StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc, StmtTy *Throw) { return 0; } @@ -572,10 +572,10 @@ public: SourceLocation EndLoc, // location of the ; or {. tok::TokenKind MethodType, // tok::minus for instance, tok::plus for class. DeclTy *ClassDecl, // class this methods belongs to. - ObjcDeclSpec &ReturnQT, // for return type's in inout etc. + ObjCDeclSpec &ReturnQT, // for return type's in inout etc. TypeTy *ReturnType, // the method return type. Selector Sel, // a unique name for the method. - ObjcDeclSpec *ArgQT, // for arguments' in inout etc. + ObjCDeclSpec *ArgQT, // for arguments' in inout etc. TypeTy **ArgTypes, // non-zero when Sel.getNumArgs() > 0 IdentifierInfo **ArgNames, // non-zero when Sel.getNumArgs() > 0 AttributeList *AttrList, // optional @@ -597,9 +597,9 @@ public: unsigned pNum = 0) { return; } - // ActOnAddObjcProperties - called to build one property AST - virtual DeclTy *ActOnAddObjcProperties (SourceLocation AtLoc, - DeclTy **allProperties, unsigned NumProperties, ObjcDeclSpec &DS) { + // ActOnAddObjCProperties - called to build one property AST + virtual DeclTy *ActOnAddObjCProperties (SourceLocation AtLoc, + DeclTy **allProperties, unsigned NumProperties, ObjCDeclSpec &DS) { return 0; } diff --git a/include/clang/Parse/DeclSpec.h b/include/clang/Parse/DeclSpec.h index 85e4cb6cc8..bf7920fa2d 100644 --- a/include/clang/Parse/DeclSpec.h +++ b/include/clang/Parse/DeclSpec.h @@ -280,12 +280,12 @@ private: } }; -/// ObjcDeclSpec - This class captures information about +/// ObjCDeclSpec - This class captures information about /// "declaration specifiers" specific to objective-c -class ObjcDeclSpec { +class ObjCDeclSpec { public: - /// ObjcDeclQualifier - Qualifier used on types in method declarations - enum ObjcDeclQualifier { + /// ObjCDeclQualifier - Qualifier used on types in method declarations + enum ObjCDeclQualifier { DQ_None = 0x0, DQ_In = 0x1, DQ_Inout = 0x2, @@ -296,7 +296,7 @@ public: }; /// PropertyAttributeKind - list of property attributes. - enum ObjcPropertyAttributeKind { DQ_PR_noattr = 0x0, + enum ObjCPropertyAttributeKind { DQ_PR_noattr = 0x0, DQ_PR_readonly = 0x01, DQ_PR_getter = 0x02, DQ_PR_assign = 0x04, @@ -308,17 +308,17 @@ public: }; - ObjcDeclSpec() : objcDeclQualifier(DQ_None), PropertyAttributes(DQ_PR_noattr) + ObjCDeclSpec() : objcDeclQualifier(DQ_None), PropertyAttributes(DQ_PR_noattr) {} - ObjcDeclQualifier getObjcDeclQualifier() const { return objcDeclQualifier; } - void setObjcDeclQualifier(ObjcDeclQualifier DQVal) - { objcDeclQualifier = (ObjcDeclQualifier) (objcDeclQualifier | DQVal); } + ObjCDeclQualifier getObjCDeclQualifier() const { return objcDeclQualifier; } + void setObjCDeclQualifier(ObjCDeclQualifier DQVal) + { objcDeclQualifier = (ObjCDeclQualifier) (objcDeclQualifier | DQVal); } - const ObjcPropertyAttributeKind getPropertyAttributes() const + const ObjCPropertyAttributeKind getPropertyAttributes() const { return PropertyAttributes; } - void setPropertyAttributes(ObjcPropertyAttributeKind PRVal) { + void setPropertyAttributes(ObjCPropertyAttributeKind PRVal) { PropertyAttributes = - (ObjcPropertyAttributeKind) (PropertyAttributes | PRVal); + (ObjCPropertyAttributeKind) (PropertyAttributes | PRVal); } const IdentifierInfo *getGetterName() const { return GetterName; } @@ -332,9 +332,9 @@ private: // FIXME: These two are unrelated and mutially exclusive. So perhaps // we can put them in a union to reflect their mutual exclusiveness // (space saving is negligible). - ObjcDeclQualifier objcDeclQualifier : 6; + ObjCDeclQualifier objcDeclQualifier : 6; - ObjcPropertyAttributeKind PropertyAttributes : 8; + ObjCPropertyAttributeKind PropertyAttributes : 8; IdentifierInfo *GetterName; // getter name of NULL if no getter IdentifierInfo *SetterName; // setter name of NULL if no setter }; diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h index e74c38508f..c1069c25f6 100644 --- a/include/clang/Parse/Parser.h +++ b/include/clang/Parse/Parser.h @@ -19,7 +19,7 @@ namespace clang { class DeclSpec; - class ObjcDeclSpec; + class ObjCDeclSpec; class Declarator; class AttributeList; class Scope; @@ -270,7 +270,7 @@ private: tok::ObjCKeywordKind contextKey); DeclTy *ParseObjCAtProtocolDeclaration(SourceLocation atLoc); - DeclTy *ObjcImpDecl; + DeclTy *ObjCImpDecl; DeclTy *ParseObjCAtImplementationDeclaration(SourceLocation atLoc); DeclTy *ParseObjCAtEndDeclaration(SourceLocation atLoc); @@ -284,26 +284,26 @@ private: objc_in=0, objc_out, objc_inout, objc_oneway, objc_bycopy, objc_byref, objc_NumQuals }; - IdentifierInfo *ObjcTypeQuals[objc_NumQuals]; + IdentifierInfo *ObjCTypeQuals[objc_NumQuals]; // Definitions for ObjC2's @property attributes. enum ObjCPropertyAttr { objc_readonly=0, objc_getter, objc_setter, objc_assign, objc_readwrite, objc_retain, objc_copy, objc_nonatomic, objc_NumAttrs }; - IdentifierInfo *ObjcPropertyAttrs[objc_NumAttrs]; + IdentifierInfo *ObjCPropertyAttrs[objc_NumAttrs]; bool isObjCPropertyAttribute(); IdentifierInfo *ObjCForCollectionInKW; bool isTokIdentifier_in() const; - TypeTy *ParseObjCTypeName(ObjcDeclSpec &DS); + TypeTy *ParseObjCTypeName(ObjCDeclSpec &DS); void ParseObjCMethodRequirement(); DeclTy *ParseObjCMethodPrototype(DeclTy *classOrCat, tok::ObjCKeywordKind MethodImplKind = tok::objc_not_keyword); DeclTy *ParseObjCMethodDecl(SourceLocation mLoc, tok::TokenKind mType, DeclTy *classDecl, tok::ObjCKeywordKind MethodImplKind = tok::objc_not_keyword); - void ParseObjCPropertyAttribute(ObjcDeclSpec &DS); + void ParseObjCPropertyAttribute(ObjCDeclSpec &DS); DeclTy *ParseObjCPropertyDecl(DeclTy *interfaceDecl, SourceLocation AtLoc); DeclTy *ParseObjCMethodDefinition(); @@ -407,7 +407,7 @@ private: void ParseDeclarationSpecifiers(DeclSpec &DS); void ParseSpecifierQualifierList(DeclSpec &DS); - void ParseObjcTypeQualifierList(ObjcDeclSpec &DS); + void ParseObjCTypeQualifierList(ObjCDeclSpec &DS); bool ParseTag(DeclTy *&Decl, unsigned TagType, SourceLocation StartLoc); void ParseEnumSpecifier(DeclSpec &DS);