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/Sema/Sema.cpp b/Sema/Sema.cpp
index b33e782..a51b075 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<PointerType*>(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 @@
TypedefType *t;
// Add the built-in ObjC types.
- t = dyn_cast<TypedefType>(Context.getObjcIdType().getTypePtr());
+ t = dyn_cast<TypedefType>(Context.getObjCIdType().getTypePtr());
t->getDecl()->getIdentifier()->setFETokenInfo(t->getDecl());
TUScope->AddDecl(t->getDecl());
- t = dyn_cast<TypedefType>(Context.getObjcClassType().getTypePtr());
+ t = dyn_cast<TypedefType>(Context.getObjCClassType().getTypePtr());
t->getDecl()->getIdentifier()->setFETokenInfo(t->getDecl());
TUScope->AddDecl(t->getDecl());
- ObjcInterfaceType *it = dyn_cast<ObjcInterfaceType>(Context.getObjcProtoType());
- ObjcInterfaceDecl *IDecl = it->getDecl();
+ ObjCInterfaceType *it = dyn_cast<ObjCInterfaceType>(Context.getObjCProtoType());
+ ObjCInterfaceDecl *IDecl = it->getDecl();
IDecl->getIdentifier()->setFETokenInfo(IDecl);
TUScope->AddDecl(IDecl);
- t = dyn_cast<TypedefType>(Context.getObjcSelType().getTypePtr());
+ t = dyn_cast<TypedefType>(Context.getObjCSelType().getTypePtr());
t->getDecl()->getIdentifier()->setFETokenInfo(t->getDecl());
TUScope->AddDecl(t->getDecl());
}
@@ -88,24 +88,24 @@
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 @@
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 bc74fd1..2788537 100644
--- a/Sema/Sema.h
+++ b/Sema/Sema.h
@@ -48,13 +48,13 @@
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 @@
/// 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 @@
/// This is only necessary for issuing pretty diagnostics.
llvm::SmallVector<TypedefDecl*, 24> 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<IdentifierInfo*, ObjcImplementationDecl*> ObjcImplementations;
+ llvm::DenseMap<IdentifierInfo*, ObjCImplementationDecl*> 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<IdentifierInfo*, ObjcProtocolDecl*> ObjcProtocols;
+ llvm::DenseMap<IdentifierInfo*, ObjCProtocolDecl*> ObjCProtocols;
// Enum values used by KnownFunctionIDs (see below).
enum {
@@ -118,15 +118,15 @@
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 @@
/// 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<Selector, ObjcMethodList> InstanceMethodPool;
- llvm::DenseMap<Selector, ObjcMethodList> FactoryMethodPool;
+ llvm::DenseMap<Selector, ObjCMethodList> InstanceMethodPool;
+ llvm::DenseMap<Selector, ObjCMethodList> FactoryMethodPool;
public:
Sema(Preprocessor &pp, ASTContext &ctxt);
@@ -173,7 +173,7 @@
//
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 @@
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 @@
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 @@
/// 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<Selector> &InsMap,
const llvm::DenseSet<Selector> &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<P>, 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 @@
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 @@
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 @@
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 @@
// 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 bd9ef0c..61c67f0 100644
--- a/Sema/SemaChecking.cpp
+++ b/Sema/SemaChecking.cpp
@@ -560,7 +560,7 @@
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 @@
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 07b3d71..94c65ac 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -33,10 +33,10 @@
IIDecl = cast<ScopedDecl>(IIDecl)->getNext();
if (!IIDecl)
return 0;
- if (isa<TypedefDecl>(IIDecl) || isa<ObjcInterfaceDecl>(IIDecl))
+ if (isa<TypedefDecl>(IIDecl) || isa<ObjCInterfaceDecl>(IIDecl))
return IIDecl;
- if (ObjcCompatibleAliasDecl *ADecl =
- dyn_cast<ObjcCompatibleAliasDecl>(IIDecl))
+ if (ObjCCompatibleAliasDecl *ADecl =
+ dyn_cast<ObjCCompatibleAliasDecl>(IIDecl))
return ADecl->getClassInterface();
return 0;
}
@@ -98,17 +98,17 @@
if (IDecl->getIdentifierNamespace() == Decl::IDNS_Ordinary)
break;
- if (ObjcCompatibleAliasDecl *ADecl =
- dyn_cast_or_null<ObjcCompatibleAliasDecl>(IDecl))
+ if (ObjCCompatibleAliasDecl *ADecl =
+ dyn_cast_or_null<ObjCCompatibleAliasDecl>(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<ObjcInterfaceDecl>(IdDecl);
+ return cast_or_null<ObjCInterfaceDecl>(IdDecl);
}
/// LookupScopedDecl - Look up the inner-most declaration in the specified
@@ -208,7 +208,7 @@
// 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 @@
}
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 @@
FD->setBody((Stmt*)Body);
assert(FD == CurFunctionDecl && "Function parsing confused");
CurFunctionDecl = 0;
- } else if (ObjcMethodDecl *MD = dyn_cast<ObjcMethodDecl>(dcl)) {
+ } else if (ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(dcl)) {
MD->setBody((Stmt*)Body);
CurMethodDecl = 0;
}
@@ -1204,14 +1204,14 @@
if (isa<RecordDecl>(static_cast<Decl *>(TagDecl)))
NewFD = new FieldDecl(Loc, II, T, BitWidth);
- else if (isa<ObjcInterfaceDecl>(static_cast<Decl *>(TagDecl)) ||
- isa<ObjcImplementationDecl>(static_cast<Decl *>(TagDecl)) ||
- isa<ObjcCategoryDecl>(static_cast<Decl *>(TagDecl)) ||
+ else if (isa<ObjCInterfaceDecl>(static_cast<Decl *>(TagDecl)) ||
+ isa<ObjCImplementationDecl>(static_cast<Decl *>(TagDecl)) ||
+ isa<ObjCCategoryDecl>(static_cast<Decl *>(TagDecl)) ||
// FIXME: ivars are currently used to model properties, and
// properties can appear within a protocol.
- // See corresponding FIXME in DeclObjC.h:ObjcPropertyDecl.
- isa<ObjcProtocolDecl>(static_cast<Decl *>(TagDecl)))
- NewFD = new ObjcIvarDecl(Loc, II, T);
+ // See corresponding FIXME in DeclObjC.h:ObjCPropertyDecl.
+ isa<ObjCProtocolDecl>(static_cast<Decl *>(TagDecl)))
+ NewFD = new ObjCIvarDecl(Loc, II, T);
else
assert(0 && "Sema::ActOnField(): Unknown TagDecl");
@@ -1222,13 +1222,13 @@
/// 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 @@
// If we have visibility info, make sure the AST is set accordingly.
if (visibility)
- cast<ObjcIvarDecl>(FD)->setAccessControl(
+ cast<ObjCIvarDecl>(FD)->setAccessControl(
TranslateIvarVisibility(visibility[i]));
// C99 6.7.2.1p2 - A field may not be a function type.
@@ -1337,7 +1337,7 @@
}
}
/// 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 @@
if (Record)
Record->defineBody(&RecFields[0], RecFields.size());
else {
- ObjcIvarDecl **ClsFields =
- reinterpret_cast<ObjcIvarDecl**>(&RecFields[0]);
- if (isa<ObjcInterfaceDecl>(static_cast<Decl*>(RecDecl)))
- cast<ObjcInterfaceDecl>(static_cast<Decl*>(RecDecl))->
+ ObjCIvarDecl **ClsFields =
+ reinterpret_cast<ObjCIvarDecl**>(&RecFields[0]);
+ if (isa<ObjCInterfaceDecl>(static_cast<Decl*>(RecDecl)))
+ cast<ObjCInterfaceDecl>(static_cast<Decl*>(RecDecl))->
addInstanceVariablesToClass(ClsFields, RecFields.size(), RBrac);
- else if (isa<ObjcImplementationDecl>(static_cast<Decl*>(RecDecl))) {
- ObjcImplementationDecl* IMPDecl =
- cast<ObjcImplementationDecl>(static_cast<Decl*>(RecDecl));
- assert(IMPDecl && "ActOnFields - missing ObjcImplementationDecl");
- IMPDecl->ObjcAddInstanceVariablesToClassImpl(ClsFields, RecFields.size());
+ else if (isa<ObjCImplementationDecl>(static_cast<Decl*>(RecDecl))) {
+ ObjCImplementationDecl* IMPDecl =
+ cast<ObjCImplementationDecl>(static_cast<Decl*>(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 e744089..89b7611 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<ObjcMethodDecl>(static_cast<Decl *>(D));
+ ObjCMethodDecl *MDecl = dyn_cast<ObjCMethodDecl>(static_cast<Decl *>(D));
assert(MDecl != 0 && "Not a method declarator!");
// Allow the rest of sema to find private method decl implementations.
@@ -43,15 +43,15 @@
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 @@
// Check for another declaration kind with the same name.
ScopedDecl *PrevDecl = LookupInterfaceDecl(ClassName);
- if (PrevDecl && !isa<ObjcInterfaceDecl>(PrevDecl)) {
+ if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
Diag(ClassLoc, diag::err_redefinition_different_kind,
ClassName->getName());
Diag(PrevDecl->getLocation(), diag::err_previous_definition);
}
- ObjcInterfaceDecl* IDecl = dyn_cast_or_null<ObjcInterfaceDecl>(PrevDecl);
+ ObjCInterfaceDecl* IDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
if (IDecl) {
// Class already seen. Is it a forward declaration?
if (!IDecl->isForwardDecl())
@@ -91,7 +91,7 @@
}
}
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<ScopedDecl>());
@@ -102,17 +102,17 @@
}
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<ObjcInterfaceDecl>(PrevDecl)) {
+ if (PrevDecl && !isa<ObjCInterfaceDecl>(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<ObjcInterfaceDecl>(PrevDecl);
+ SuperClassEntry = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
if (!SuperClassEntry || SuperClassEntry->isForwardDecl()) {
Diag(AtInterfaceLoc, diag::err_undef_superclass,
@@ -130,7 +130,7 @@
/// 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 @@
ScopedDecl *ADecl = LookupScopedDecl(AliasName, Decl::IDNS_Ordinary,
AliasLocation, TUScope);
if (ADecl) {
- if (isa<ObjcCompatibleAliasDecl>(ADecl)) {
+ if (isa<ObjCCompatibleAliasDecl>(ADecl)) {
Diag(AliasLocation, diag::warn_previous_alias_decl);
Diag(ADecl->getLocation(), diag::warn_previous_declaration);
}
@@ -166,7 +166,7 @@
// Check for class declaration
ScopedDecl *CDecl = LookupScopedDecl(ClassName, Decl::IDNS_Ordinary,
ClassLocation, TUScope);
- if (!CDecl || !isa<ObjcInterfaceDecl>(CDecl)) {
+ if (!CDecl || !isa<ObjCInterfaceDecl>(CDecl)) {
Diag(ClassLocation, diag::warn_undef_interface,
ClassName->getName());
if (CDecl)
@@ -174,10 +174,10 @@
return 0;
}
// Everything checked out, instantiate a new alias declaration ast
- ObjcCompatibleAliasDecl *AliasDecl =
- new ObjcCompatibleAliasDecl(AtCompatibilityAliasLoc,
+ ObjCCompatibleAliasDecl *AliasDecl =
+ new ObjCCompatibleAliasDecl(AtCompatibilityAliasLoc,
AliasName,
- dyn_cast<ObjcInterfaceDecl>(CDecl));
+ dyn_cast<ObjCInterfaceDecl>(CDecl));
// Chain & install the interface decl into the identifier.
AliasDecl->setNext(AliasName->getFETokenInfo<ScopedDecl>());
@@ -191,7 +191,7 @@
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 @@
}
}
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 @@
unsigned NumProtocols,
llvm::SmallVector<DeclTy *,8> &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 @@
Action::DeclTy *
Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc,
IdentifierInfo **IdentList, unsigned NumElts) {
- llvm::SmallVector<ObjcProtocolDecl*, 32> Protocols;
+ llvm::SmallVector<ObjCProtocolDecl*, 32> 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 @@
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 @@
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 @@
}
/// 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 @@
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<ObjcInterfaceDecl>(PrevDecl)) {
+ if (PrevDecl && !isa<ObjCInterfaceDecl>(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<ObjcInterfaceDecl>(PrevDecl);
+ IDecl = dyn_cast_or_null<ObjCInterfaceDecl>(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<ObjcInterfaceDecl>(PrevDecl)) {
+ if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
Diag(SuperClassLoc, diag::err_redefinition_different_kind,
SuperClassname->getName());
Diag(PrevDecl->getLocation(), diag::err_previous_definition);
}
else {
- SDecl = dyn_cast_or_null<ObjcInterfaceDecl>(PrevDecl);
+ SDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
if (!SDecl)
Diag(SuperClassLoc, diag::err_undef_superclass,
SuperClassname->getName(), ClassName->getName());
@@ -374,7 +374,7 @@
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<ScopedDecl>());
ClassName->setFETokenInfo(IDecl);
@@ -385,22 +385,22 @@
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 @@
// 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 @@
/// 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<Selector> &InsMap,
const llvm::DenseSet<Selector> &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<Selector> 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 @@
llvm::DenseSet<Selector> 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 @@
// 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 @@
/// 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<Selector> 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 @@
llvm::DenseSet<Selector> 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 @@
// 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 @@
Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
IdentifierInfo **IdentList, unsigned NumElts)
{
- llvm::SmallVector<ObjcInterfaceDecl*, 32> Interfaces;
+ llvm::SmallVector<ObjCInterfaceDecl*, 32> 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<ObjcInterfaceDecl>(PrevDecl)) {
+ if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
Diag(AtClassLoc, diag::err_redefinition_different_kind,
IdentList[i]->getName());
Diag(PrevDecl->getLocation(), diag::err_previous_definition);
}
- ObjcInterfaceDecl *IDecl = dyn_cast_or_null<ObjcInterfaceDecl>(PrevDecl);
+ ObjCInterfaceDecl *IDecl = dyn_cast_or_null<ObjCInterfaceDecl>(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<ScopedDecl>());
IdentList[i]->setFETokenInfo(IDecl);
@@ -605,15 +605,15 @@
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<p1,p2> 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 @@
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 @@
// 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 @@
// 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 @@
if (!ClassDecl)
return;
- llvm::SmallVector<ObjcMethodDecl*, 32> insMethods;
- llvm::SmallVector<ObjcMethodDecl*, 16> clsMethods;
+ llvm::SmallVector<ObjCMethodDecl*, 32> insMethods;
+ llvm::SmallVector<ObjCMethodDecl*, 16> clsMethods;
- llvm::DenseMap<Selector, const ObjcMethodDecl*> InsMap;
- llvm::DenseMap<Selector, const ObjcMethodDecl*> ClsMap;
+ llvm::DenseMap<Selector, const ObjCMethodDecl*> InsMap;
+ llvm::DenseMap<Selector, const ObjCMethodDecl*> ClsMap;
bool isInterfaceDeclKind =
- (isa<ObjcInterfaceDecl>(ClassDecl) || isa<ObjcCategoryDecl>(ClassDecl)
- || isa<ObjcProtocolDecl>(ClassDecl));
- bool checkIdenticalMethods = isa<ObjcImplementationDecl>(ClassDecl);
+ (isa<ObjCInterfaceDecl>(ClassDecl) || isa<ObjCCategoryDecl>(ClassDecl)
+ || isa<ObjCProtocolDecl>(ClassDecl));
+ bool checkIdenticalMethods = isa<ObjCImplementationDecl>(ClassDecl);
// TODO: property declaration in category and protocols.
- if (pNum != 0 && isa<ObjcInterfaceDecl>(ClassDecl)) {
- ObjcPropertyDecl **properties = new ObjcPropertyDecl*[pNum];
- memcpy(properties, allProperties, pNum*sizeof(ObjcPropertyDecl*));
- dyn_cast<ObjcInterfaceDecl>(ClassDecl)->setPropertyDecls(properties);
- dyn_cast<ObjcInterfaceDecl>(ClassDecl)->setNumPropertyDecl(pNum);
+ if (pNum != 0 && isa<ObjCInterfaceDecl>(ClassDecl)) {
+ ObjCPropertyDecl **properties = new ObjCPropertyDecl*[pNum];
+ memcpy(properties, allProperties, pNum*sizeof(ObjCPropertyDecl*));
+ dyn_cast<ObjCInterfaceDecl>(ClassDecl)->setPropertyDecls(properties);
+ dyn_cast<ObjCInterfaceDecl>(ClassDecl)->setNumPropertyDecl(pNum);
}
for (unsigned i = 0; i < allNum; i++ ) {
- ObjcMethodDecl *Method =
- cast_or_null<ObjcMethodDecl>(static_cast<Decl*>(allMethods[i]));
+ ObjCMethodDecl *Method =
+ cast_or_null<ObjCMethodDecl>(static_cast<Decl*>(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 @@
}
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 @@
}
}
- if (ObjcInterfaceDecl *I = dyn_cast<ObjcInterfaceDecl>(ClassDecl)) {
+ if (ObjCInterfaceDecl *I = dyn_cast<ObjCInterfaceDecl>(ClassDecl)) {
I->addMethods(&insMethods[0], insMethods.size(),
&clsMethods[0], clsMethods.size(), AtEndLoc);
- } else if (ObjcProtocolDecl *P = dyn_cast<ObjcProtocolDecl>(ClassDecl)) {
+ } else if (ObjCProtocolDecl *P = dyn_cast<ObjCProtocolDecl>(ClassDecl)) {
P->addMethods(&insMethods[0], insMethods.size(),
&clsMethods[0], clsMethods.size(), AtEndLoc);
}
- else if (ObjcCategoryDecl *C = dyn_cast<ObjcCategoryDecl>(ClassDecl)) {
+ else if (ObjCCategoryDecl *C = dyn_cast<ObjCCategoryDecl>(ClassDecl)) {
C->addMethods(&insMethods[0], insMethods.size(),
&clsMethods[0], clsMethods.size(), AtEndLoc);
}
- else if (ObjcImplementationDecl *IC =
- dyn_cast<ObjcImplementationDecl>(ClassDecl)) {
+ else if (ObjCImplementationDecl *IC =
+ dyn_cast<ObjCImplementationDecl>(ClassDecl)) {
IC->setLocEnd(AtEndLoc);
- if (ObjcInterfaceDecl* IDecl = getObjCInterfaceDecl(IC->getIdentifier()))
+ if (ObjCInterfaceDecl* IDecl = getObjCInterfaceDecl(IC->getIdentifier()))
ImplMethodsVsClassMethods(IC, IDecl);
} else {
- ObjcCategoryImplDecl* CatImplClass = cast<ObjcCategoryImplDecl>(ClassDecl);
+ ObjCCategoryImplDecl* CatImplClass = cast<ObjCCategoryImplDecl>(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 @@
/// 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 @@
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<ParmVarDecl*, 16> Params;
@@ -820,11 +820,11 @@
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 @@
if (ReturnType)
resultDeclType = QualType::getFromOpaquePtr(ReturnType);
else // get the type for "id".
- resultDeclType = Context.getObjcIdType();
+ resultDeclType = Context.getObjCIdType();
Decl *CDecl = static_cast<Decl*>(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<ObjcImplementationDecl>(CDecl)) {
+ if (ObjCImplementationDecl *ImpDecl =
+ dyn_cast<ObjCImplementationDecl>(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<ObjcCategoryImplDecl>(CDecl)) {
+ else if (ObjCCategoryImplDecl *CatImpDecl =
+ dyn_cast<ObjCCategoryImplDecl>(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 d0ade1b..cff4908 100644
--- a/Sema/SemaExpr.cpp
+++ b/Sema/SemaExpr.cpp
@@ -81,9 +81,9 @@
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 @@
}
if (isa<TypedefDecl>(D))
return Diag(Loc, diag::err_unexpected_typedef, II.getName());
- if (isa<ObjcInterfaceDecl>(D))
+ if (isa<ObjCInterfaceDecl>(D))
return Diag(Loc, diag::err_unexpected_interface, II.getName());
assert(0 && "Invalid decl");
@@ -535,14 +535,14 @@
if (ret.isNull())
return true;
return new OCUVectorElementExpr(ret, BaseExpr, Member, MemberLoc);
- } else if (BaseType->isObjcInterfaceType()) {
- ObjcInterfaceDecl *IFace;
- if (isa<ObjcInterfaceType>(BaseType.getCanonicalType()))
- IFace = dyn_cast<ObjcInterfaceType>(BaseType)->getDecl();
+ } else if (BaseType->isObjCInterfaceType()) {
+ ObjCInterfaceDecl *IFace;
+ if (isa<ObjCInterfaceType>(BaseType.getCanonicalType()))
+ IFace = dyn_cast<ObjCInterfaceType>(BaseType)->getDecl();
else
- IFace = dyn_cast<ObjcQualifiedInterfaceType>(BaseType)->getDecl();
- ObjcInterfaceDecl *clsDeclared;
- if (ObjcIvarDecl *IV = IFace->lookupInstanceVariable(&Member, clsDeclared))
+ IFace = dyn_cast<ObjCQualifiedInterfaceType>(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 @@
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::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 @@
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 a82f6fb..125a4c4 100644
--- a/Sema/SemaExprObjC.cpp
+++ b/Sema/SemaExprObjC.cpp
@@ -48,19 +48,19 @@
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<ObjcInterfaceDecl>(IFace);
+ ObjCInterfaceDecl *strIFace = dyn_cast_or_null<ObjCInterfaceDecl>(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 @@
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 @@
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 @@
}
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 @@
assert(receiverName && "missing receiver class name");
Expr **ArgExprs = reinterpret_cast<Expr **>(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 @@
// 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 @@
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 @@
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 @@
Expr *RExpr = static_cast<Expr *>(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 @@
return true;
}
} else {
- bool receiverIsQualId = isa<ObjcQualifiedIdType>(receiverType);
+ bool receiverIsQualId = isa<ObjCQualifiedIdType>(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 @@
static_cast<PointerType*>(receiverType.getTypePtr());
receiverType = pointerType->getPointeeType();
}
- ObjcInterfaceDecl* ClassDecl = 0;
- if (ObjcQualifiedInterfaceType *QIT =
- dyn_cast<ObjcQualifiedInterfaceType>(receiverType)) {
+ ObjCInterfaceDecl* ClassDecl = 0;
+ if (ObjCQualifiedInterfaceType *QIT =
+ dyn_cast<ObjCQualifiedInterfaceType>(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 @@
std::string("-"), Sel.getName(),
SourceRange(lbrac, rbrac));
}
- else if (ObjcQualifiedIdType *QIT =
- dyn_cast<ObjcQualifiedIdType>(receiverType)) {
+ else if (ObjCQualifiedIdType *QIT =
+ dyn_cast<ObjCQualifiedIdType>(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 @@
SourceRange(lbrac, rbrac));
}
else {
- assert(ObjcInterfaceType::classof(receiverType.getTypePtr()) &&
+ assert(ObjCInterfaceType::classof(receiverType.getTypePtr()) &&
"bad receiver type");
- ClassDecl = static_cast<ObjcInterfaceType*>(
+ ClassDecl = static_cast<ObjCInterfaceType*>(
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 @@
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 @@
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 7219db26..7f540d4 100644
--- a/Sema/SemaStmt.cpp
+++ b/Sema/SemaStmt.cpp
@@ -531,7 +531,7 @@
}
Action::StmtResult
-Sema::ActOnObjcForCollectionStmt(SourceLocation ForColLoc,
+Sema::ActOnObjCForCollectionStmt(SourceLocation ForColLoc,
SourceLocation LParenLoc,
StmtTy *first, ExprTy *second,
SourceLocation RParenLoc, StmtTy *body) {
@@ -552,17 +552,17 @@
}
else
FirstType = static_cast<Expr*>(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 @@
}
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<Stmt*>(Parm), static_cast<Stmt*>(Body),
static_cast<Stmt*>(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<Stmt*>(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<Stmt*>(Try),
+ ObjCAtTryStmt *TS = new ObjCAtTryStmt(AtLoc, static_cast<Stmt*>(Try),
static_cast<Stmt*>(Catch),
static_cast<Stmt*>(Finally));
return TS;
}
Action::StmtResult
-Sema::ActOnObjcAtThrowStmt(SourceLocation AtLoc, StmtTy *Throw) {
- ObjcAtThrowStmt *TS = new ObjcAtThrowStmt(AtLoc, static_cast<Stmt*>(Throw));
+Sema::ActOnObjCAtThrowStmt(SourceLocation AtLoc, StmtTy *Throw) {
+ ObjCAtThrowStmt *TS = new ObjCAtThrowStmt(AtLoc, static_cast<Stmt*>(Throw));
return TS;
}
diff --git a/Sema/SemaType.cpp b/Sema/SemaType.cpp
index 5e9bb3c..c4a9c0f 100644
--- a/Sema/SemaType.cpp
+++ b/Sema/SemaType.cpp
@@ -104,22 +104,22 @@
"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<ObjcInterfaceDecl>(D)) {
+ if (ObjCInterfaceDecl *ObjCIntDecl = dyn_cast<ObjCInterfaceDecl>(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<ObjcProtocolDecl**>(PPDecl),
+ return Ctx.getObjCQualifiedInterfaceType(ObjCIntDecl,
+ reinterpret_cast<ObjCProtocolDecl**>(PPDecl),
DS.NumProtocolQualifiers());
}
else if (TypedefDecl *typeDecl = dyn_cast<TypedefDecl>(D)) {
- if (Ctx.getObjcIdType() == Ctx.getTypedefType(typeDecl)
+ if (Ctx.getObjCIdType() == Ctx.getTypedefType(typeDecl)
&& DS.getProtocolQualifiers()) {
// id<protocol-list>
Action::DeclTy **PPDecl = &(*DS.getProtocolQualifiers())[0];
- return Ctx.getObjcQualifiedIdType(typeDecl->getUnderlyingType(),
- reinterpret_cast<ObjcProtocolDecl**>(PPDecl),
+ return Ctx.getObjCQualifiedIdType(typeDecl->getUnderlyingType(),
+ reinterpret_cast<ObjCProtocolDecl**>(PPDecl),
DS.NumProtocolQualifiers());
}
}
@@ -346,22 +346,22 @@
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<ObjcMethodDecl>(static_cast<Decl *>(D));
+QualType Sema::ObjCGetTypeForMethodDefinition(DeclTy *D) {
+ ObjCMethodDecl *MDecl = dyn_cast<ObjCMethodDecl>(static_cast<Decl *>(D));
QualType T = MDecl->getResultType();
llvm::SmallVector<QualType, 16> 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);