diff options
Diffstat (limited to 'Driver/RewriteObjC.cpp')
-rw-r--r-- | Driver/RewriteObjC.cpp | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/Driver/RewriteObjC.cpp b/Driver/RewriteObjC.cpp index 2903f998a0..69aedcc2dd 100644 --- a/Driver/RewriteObjC.cpp +++ b/Driver/RewriteObjC.cpp @@ -506,7 +506,7 @@ void RewriteObjC::HandleTopLevelDecl(Decl *D) { RewriteFunctionDecl(FD); } else if (VarDecl *FVD = dyn_cast<VarDecl>(D)) { // declared in <Foundation/NSString.h> - if (strcmp(FVD->getName(), "_NSConstantStringClassReference") == 0) { + if (strcmp(FVD->getIdentifierName(), "_NSConstantStringClassReference") == 0) { ConstantStringClassReference = FVD; return; } @@ -1088,13 +1088,13 @@ Stmt *RewriteObjC::RewriteObjCForCollectionStmt(ObjCForCollectionStmt *S, elementTypeAsString = ElementType.getAsString(); buf += elementTypeAsString; buf += " "; - elementName = D->getName(); + elementName = D->getIdentifierName(); buf += elementName; buf += ";\n\t"; } else { DeclRefExpr *DR = cast<DeclRefExpr>(S->getElement()); - elementName = DR->getDecl()->getName(); + elementName = DR->getDecl()->getIdentifierName(); elementTypeAsString = cast<ValueDecl>(DR->getDecl())->getType().getAsString(); } @@ -1694,7 +1694,7 @@ void RewriteObjC::SynthGetProtocolFunctionDecl() { void RewriteObjC::RewriteFunctionDecl(FunctionDecl *FD) { // declared in <objc/objc.h> - if (strcmp(FD->getName(), "sel_registerName") == 0) { + if (strcmp(FD->getIdentifierName(), "sel_registerName") == 0) { SelGetUidFunctionDecl = FD; return; } @@ -2299,8 +2299,8 @@ Stmt *RewriteObjC::RewriteObjCProtocolExpr(ObjCProtocolExpr *Exp) { // Create a call to objc_getProtocol("ProtocolName"). llvm::SmallVector<Expr*, 8> ProtoExprs; QualType argType = Context->getPointerType(Context->CharTy); - ProtoExprs.push_back(new StringLiteral(Exp->getProtocol()->getName(), - strlen(Exp->getProtocol()->getName()), + ProtoExprs.push_back(new StringLiteral(Exp->getProtocol()->getIdentifierName(), + strlen(Exp->getProtocol()->getIdentifierName()), false, argType, SourceLocation(), SourceLocation())); CallExpr *ProtoExp = SynthesizeCallToFunctionDecl(GetProtocolFunctionDecl, @@ -2343,7 +2343,8 @@ bool RewriteObjC::BufferContainsPPDirectives(const char *startBuf, void RewriteObjC::SynthesizeObjCInternalStruct(ObjCInterfaceDecl *CDecl, std::string &Result) { assert(CDecl && "Class missing in SynthesizeObjCInternalStruct"); - assert(CDecl->getName() && "Name missing in SynthesizeObjCInternalStruct"); + assert(CDecl->getIdentifierName() && + "Name missing in SynthesizeObjCInternalStruct"); // Do not synthesize more than once. if (ObjCSynthesizedStructs.count(CDecl)) return; @@ -2922,15 +2923,15 @@ void RewriteObjC::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl, // Build _objc_method_list for class's instance methods if needed RewriteObjCMethodsMetaData(IDecl->instmeth_begin(), IDecl->instmeth_end(), - true, "", IDecl->getName(), Result); + true, "", IDecl->getIdentifierName(), Result); // Build _objc_method_list for class's class methods if needed RewriteObjCMethodsMetaData(IDecl->classmeth_begin(), IDecl->classmeth_end(), - false, "", IDecl->getName(), Result); + false, "", IDecl->getIdentifierName(), Result); // Protocols referenced in class declaration? RewriteObjCProtocolsMetaData(CDecl->getReferencedProtocols(), - "CLASS", CDecl->getName(), Result); + "CLASS", CDecl->getIdentifierName(), Result); // Declaration of class/meta-class metadata @@ -3429,7 +3430,7 @@ void RewriteObjC::SynthesizeBlockLiterals(SourceLocation FunLocStart, void RewriteObjC::InsertBlockLiteralsWithinFunction(FunctionDecl *FD) { SourceLocation FunLocStart = FD->getTypeSpecStartLoc(); - const char *FuncName = FD->getName(); + const char *FuncName = FD->getIdentifierName(); SynthesizeBlockLiterals(FunLocStart, FuncName); } @@ -3489,13 +3490,13 @@ Stmt *RewriteObjC::SynthesizeBlockCall(CallExpr *Exp) { const BlockPointerType *CPT = 0; if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Exp->getCallee())) { - closureName = DRE->getDecl()->getName(); + closureName = DRE->getDecl()->getIdentifierName(); CPT = DRE->getType()->getAsBlockPointerType(); } else if (BlockDeclRefExpr *CDRE = dyn_cast<BlockDeclRefExpr>(Exp->getCallee())) { - closureName = CDRE->getDecl()->getName(); + closureName = CDRE->getDecl()->getIdentifierName(); CPT = CDRE->getType()->getAsBlockPointerType(); } else if (MemberExpr *MExpr = dyn_cast<MemberExpr>(Exp->getCallee())) { - closureName = MExpr->getMemberDecl()->getName(); + closureName = MExpr->getMemberDecl()->getIdentifierName(); CPT = MExpr->getType()->getAsBlockPointerType(); } else { assert(1 && "RewriteBlockClass: Bad type"); @@ -3812,15 +3813,15 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp) { E = BlockByCopyDecls.end(); I != E; ++I) { if (isObjCType((*I)->getType())) { // FIXME: Conform to ABI ([[obj retain] autorelease]). - FD = SynthBlockInitFunctionDecl((*I)->getName()); + FD = SynthBlockInitFunctionDecl((*I)->getIdentifierName()); Exp = new DeclRefExpr(FD, FD->getType(), SourceLocation()); } else if (isBlockPointerType((*I)->getType())) { - FD = SynthBlockInitFunctionDecl((*I)->getName()); + FD = SynthBlockInitFunctionDecl((*I)->getIdentifierName()); Arg = new DeclRefExpr(FD, FD->getType(), SourceLocation()); Exp = new CStyleCastExpr(Context->VoidPtrTy, Arg, Context->VoidPtrTy, SourceLocation(), SourceLocation()); } else { - FD = SynthBlockInitFunctionDecl((*I)->getName()); + FD = SynthBlockInitFunctionDecl((*I)->getIdentifierName()); Exp = new DeclRefExpr(FD, FD->getType(), SourceLocation()); } InitExprs.push_back(Exp); @@ -3828,7 +3829,7 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp) { // Output all "by ref" declarations. for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(), E = BlockByRefDecls.end(); I != E; ++I) { - FD = SynthBlockInitFunctionDecl((*I)->getName()); + FD = SynthBlockInitFunctionDecl((*I)->getIdentifierName()); Exp = new DeclRefExpr(FD, FD->getType(), SourceLocation()); Exp = new UnaryOperator(Exp, UnaryOperator::AddrOf, Context->getPointerType(Exp->getType()), @@ -4064,7 +4065,8 @@ void RewriteObjC::HandleDeclInMainFile(Decl *D) { if (VD->getInit()) { GlobalVarDecl = VD; RewriteFunctionBodyOrGlobalInitializer(VD->getInit()); - SynthesizeBlockLiterals(VD->getTypeSpecStartLoc(), VD->getName()); + SynthesizeBlockLiterals(VD->getTypeSpecStartLoc(), + VD->getIdentifierName()); GlobalVarDecl = 0; // This is needed for blocks. |