From: Daniel Dunbar Date: Tue, 17 Aug 2010 22:39:59 +0000 (+0000) Subject: StringRef'ication of lots stuff, patch by Peter Davies! X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4087f27e5416c799bcb6be072f905be752acb61c;p=clang StringRef'ication of lots stuff, patch by Peter Davies! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111314 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index fc928f3858..1b5f6c0c34 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -522,7 +522,7 @@ public: llvm::SmallVectorImpl &Layout); /// This builds the struct used for __block variables. - QualType BuildByRefType(const char *DeclName, QualType Ty); + QualType BuildByRefType(llvm::StringRef DeclName, QualType Ty); /// Returns true iff we need copy/dispose helpers for the given type. bool BlockRequiresCopying(QualType Ty); diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index ac9b0f74ab..e954c71aa6 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -118,16 +118,6 @@ public: return getIdentifier() ? getIdentifier()->getName() : ""; } - /// getNameAsCString - Get the name of identifier for this declaration as a - /// C string (const char*). This requires that the declaration have a name - /// and that it be a simple identifier. - // - // FIXME: Deprecated, move clients to getName(). - const char *getNameAsCString() const { - assert(Name.isIdentifier() && "Name is not a simple identifier"); - return getIdentifier() ? getIdentifier()->getNameStart() : ""; - } - /// getNameAsString - Get a human-readable name for the declaration, even if /// it is one of the special kinds of names (C++ constructor, Objective-C /// selector, etc). Creating this name requires expensive string diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 1e437fdabe..b549415a1b 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -3186,7 +3186,7 @@ bool ASTContext::BlockRequiresCopying(QualType Ty) { return false; } -QualType ASTContext::BuildByRefType(const char *DeclName, QualType Ty) { +QualType ASTContext::BuildByRefType(llvm::StringRef DeclName, QualType Ty) { // type = struct __Block_byref_1_X { // void *__isa; // struct __Block_byref_1_X *__forwarding; @@ -3219,7 +3219,7 @@ QualType ASTContext::BuildByRefType(const char *DeclName, QualType Ty) { Ty }; - const char *FieldNames[] = { + llvm::StringRef FieldNames[] = { "__isa", "__forwarding", "__flags", @@ -3296,7 +3296,7 @@ QualType ASTContext::getBlockParmType( const ValueDecl *D = BDRE->getDecl(); FieldName = D->getIdentifier(); if (BDRE->isByRef()) - FieldType = BuildByRefType(D->getNameAsCString(), FieldType); + FieldType = BuildByRefType(D->getName(), FieldType); } else { // Padding. assert(isa(FieldType) && diff --git a/lib/AST/RecordLayoutBuilder.cpp b/lib/AST/RecordLayoutBuilder.cpp index 88d71ce042..ad15917b88 100644 --- a/lib/AST/RecordLayoutBuilder.cpp +++ b/lib/AST/RecordLayoutBuilder.cpp @@ -1630,7 +1630,7 @@ static void DumpCXXRecordLayout(llvm::raw_ostream &OS, if (const RecordType *RT = Field->getType()->getAs()) { if (const CXXRecordDecl *D = dyn_cast(RT->getDecl())) { DumpCXXRecordLayout(OS, D, C, FieldOffset, IndentLevel, - Field->getNameAsCString(), + Field->getName().data(), /*IncludeVirtualBases=*/true); continue; } diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp index 62336ec7d5..d648dac9d1 100644 --- a/lib/AST/StmtPrinter.cpp +++ b/lib/AST/StmtPrinter.cpp @@ -512,7 +512,7 @@ void StmtPrinter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *Node) { PrintExpr(Node->getBase()); OS << "."; } - OS << Node->getProperty()->getNameAsCString(); + OS << Node->getProperty()->getName(); } void StmtPrinter::VisitObjCImplicitSetterGetterRefExpr( diff --git a/lib/Checker/CheckSecuritySyntaxOnly.cpp b/lib/Checker/CheckSecuritySyntaxOnly.cpp index af85c2faee..9dfe512dc3 100644 --- a/lib/Checker/CheckSecuritySyntaxOnly.cpp +++ b/lib/Checker/CheckSecuritySyntaxOnly.cpp @@ -217,7 +217,7 @@ void WalkAST::CheckLoopConditionForFloat(const ForStmt *FS) { llvm::SmallString<256> sbuf; llvm::raw_svector_ostream os(sbuf); - os << "Variable '" << drCond->getDecl()->getNameAsCString() + os << "Variable '" << drCond->getDecl()->getName() << "' with floating point type '" << drCond->getType().getAsString() << "' should not be used as a loop counter"; diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index c484737c4b..46c04631a5 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -3923,7 +3923,7 @@ llvm::Constant *CGObjCCommonMac::BuildIvarLayout( if (CGM.getLangOptions().ObjCGCBitmapPrint) { printf("\n%s ivar layout for class '%s': ", ForStrongLayout ? "strong" : "weak", - OMD->getClassInterface()->getNameAsCString()); + OMD->getClassInterface()->getName().data()); const unsigned char *s = (unsigned char*)BitMap.c_str(); for (unsigned i = 0; i < BitMap.size(); i++) if (!(s[i] & 0xf0)) @@ -5040,7 +5040,7 @@ llvm::Value *CGObjCNonFragileABIMac::GenerateProtocolRef(CGBuilderTy &Builder, ObjCTypes.ExternalProtocolPtrTy); std::string ProtocolName("\01l_OBJC_PROTOCOL_REFERENCE_$_"); - ProtocolName += PD->getNameAsCString(); + ProtocolName += PD->getName(); llvm::GlobalVariable *PTGV = CGM.getModule().getGlobalVariable(ProtocolName); if (PTGV) diff --git a/lib/Rewrite/RewriteObjC.cpp b/lib/Rewrite/RewriteObjC.cpp index 2cbf5f308c..4cabf0623b 100644 --- a/lib/Rewrite/RewriteObjC.cpp +++ b/lib/Rewrite/RewriteObjC.cpp @@ -330,17 +330,17 @@ namespace { void RewriteObjCMethodsMetaData(MethodIterator MethodBegin, MethodIterator MethodEnd, bool IsInstanceMethod, - const char *prefix, - const char *ClassName, + llvm::StringRef prefix, + llvm::StringRef ClassName, std::string &Result); void RewriteObjCProtocolMetaData(ObjCProtocolDecl *Protocol, - const char *prefix, - const char *ClassName, + llvm::StringRef prefix, + llvm::StringRef ClassName, std::string &Result); void RewriteObjCProtocolListMetaData(const ObjCList &Prots, - const char *prefix, - const char *ClassName, + llvm::StringRef prefix, + llvm::StringRef ClassName, std::string &Result); void SynthesizeObjCInternalStruct(ObjCInterfaceDecl *CDecl, std::string &Result); @@ -366,18 +366,18 @@ namespace { void RewriteBlockPointerFunctionArgs(FunctionDecl *FD); std::string SynthesizeBlockHelperFuncs(BlockExpr *CE, int i, - const char *funcName, std::string Tag); + llvm::StringRef funcName, std::string Tag); std::string SynthesizeBlockFunc(BlockExpr *CE, int i, - const char *funcName, std::string Tag); + llvm::StringRef funcName, std::string Tag); std::string SynthesizeBlockImpl(BlockExpr *CE, std::string Tag, std::string Desc); std::string SynthesizeBlockDescriptor(std::string DescTag, std::string ImplTag, - int i, const char *funcName, + int i, llvm::StringRef funcName, unsigned hasCopy); Stmt *SynthesizeBlockCall(CallExpr *Exp, const Expr* BlockExp); void SynthesizeBlockLiterals(SourceLocation FunLocStart, - const char *FunName); + llvm::StringRef FunName); void RewriteRecordBody(RecordDecl *RD); void CollectBlockDeclRefInfo(BlockExpr *Exp); @@ -427,7 +427,7 @@ namespace { const char *&RParen); void RewriteCastExpr(CStyleCastExpr *CE); - FunctionDecl *SynthBlockInitFunctionDecl(const char *name); + FunctionDecl *SynthBlockInitFunctionDecl(llvm::StringRef name); Stmt *SynthBlockInitExpr(BlockExpr *Exp, const llvm::SmallVector &InnerBlockDeclRefs); @@ -678,7 +678,7 @@ void RewriteObjC::HandleTopLevelSingleDecl(Decl *D) { RewriteFunctionDecl(FD); } else if (VarDecl *FVD = dyn_cast(D)) { // declared in - if (strcmp(FVD->getNameAsCString(), "_NSConstantStringClassReference") == 0) { + if (FVD->getName() == "_NSConstantStringClassReference") { ConstantStringClassReference = FVD; return; } @@ -841,7 +841,7 @@ void RewriteObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID, Setr += "objc_setProperty (self, _cmd, "; SynthesizeIvarOffsetComputation(ClassDecl, OID, Setr); Setr += ", (id)"; - Setr += PD->getNameAsCString(); + Setr += PD->getName(); Setr += ", "; if (Attributes & ObjCPropertyDecl::OBJC_PR_nonatomic) Setr += "0, "; @@ -854,7 +854,7 @@ void RewriteObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID, } else { Setr += getIvarAccessString(ClassDecl, OID) + " = "; - Setr += PD->getNameAsCString(); + Setr += PD->getName(); } Setr += "; }"; InsertText(onePastSemiLoc, Setr); @@ -1509,7 +1509,7 @@ Stmt *RewriteObjC::RewriteObjCForCollectionStmt(ObjCForCollectionStmt *S, SourceLocation startLoc = S->getLocStart(); const char *startBuf = SM->getCharacterData(startLoc); - const char *elementName; + llvm::StringRef elementName; std::string elementTypeAsString; std::string buf; buf = "\n{\n\t"; @@ -1525,13 +1525,13 @@ Stmt *RewriteObjC::RewriteObjCForCollectionStmt(ObjCForCollectionStmt *S, elementTypeAsString = ElementType.getAsString(Context->PrintingPolicy); buf += elementTypeAsString; buf += " "; - elementName = D->getNameAsCString(); + elementName = D->getName(); buf += elementName; buf += ";\n\t"; } else { DeclRefExpr *DR = cast(S->getElement()); - elementName = DR->getDecl()->getNameAsCString(); + elementName = DR->getDecl()->getName(); ValueDecl *VD = cast(DR->getDecl()); if (VD->getType()->isObjCQualifiedIdType() || VD->getType()->isObjCQualifiedInterfaceType()) @@ -2272,7 +2272,7 @@ void RewriteObjC::SynthSelGetUidFunctionDecl() { void RewriteObjC::RewriteFunctionDecl(FunctionDecl *FD) { // declared in if (FD->getIdentifier() && - strcmp(FD->getNameAsCString(), "sel_registerName") == 0) { + FD->getName() == "sel_registerName") { SelGetUidFunctionDecl = FD; return; } @@ -2332,7 +2332,7 @@ void RewriteObjC::RewriteBlockLiteralFunctionDecl(FunctionDecl *FD) { QualType Type = proto->getResultType(); std::string FdStr = Type.getAsString(Context->PrintingPolicy); FdStr += " "; - FdStr += FD->getNameAsCString(); + FdStr += FD->getName(); FdStr += "("; unsigned numArgs = proto->getNumArgs(); for (unsigned i = 0; i < numArgs; i++) { @@ -3126,7 +3126,7 @@ bool RewriteObjC::BufferContainsPPDirectives(const char *startBuf, void RewriteObjC::SynthesizeObjCInternalStruct(ObjCInterfaceDecl *CDecl, std::string &Result) { assert(CDecl && "Class missing in SynthesizeObjCInternalStruct"); - assert(CDecl->getNameAsCString() && + assert(CDecl->getName() != "" && "Name missing in SynthesizeObjCInternalStruct"); // Do not synthesize more than once. if (ObjCSynthesizedStructs.count(CDecl)) @@ -3259,8 +3259,8 @@ template void RewriteObjC::RewriteObjCMethodsMetaData(MethodIterator MethodBegin, MethodIterator MethodEnd, bool IsInstanceMethod, - const char *prefix, - const char *ClassName, + llvm::StringRef prefix, + llvm::StringRef ClassName, std::string &Result) { if (MethodBegin == MethodEnd) return; @@ -3329,8 +3329,8 @@ void RewriteObjC::RewriteObjCMethodsMetaData(MethodIterator MethodBegin, /// RewriteObjCProtocolMetaData - Rewrite protocols meta-data. void RewriteObjC:: -RewriteObjCProtocolMetaData(ObjCProtocolDecl *PDecl, const char *prefix, - const char *ClassName, std::string &Result) { +RewriteObjCProtocolMetaData(ObjCProtocolDecl *PDecl, llvm::StringRef prefix, + llvm::StringRef ClassName, std::string &Result) { static bool objc_protocol_methods = false; // Output struct protocol_methods holder of method selector and type. @@ -3376,7 +3376,7 @@ RewriteObjCProtocolMetaData(ObjCProtocolDecl *PDecl, const char *prefix, Result += "\t ,{{(struct objc_selector *)\""; else Result += "\t ,{(struct objc_selector *)\""; - Result += (*I)->getSelector().getAsString().c_str(); + Result += (*I)->getSelector().getAsString(); std::string MethodTypeString; Context->getObjCEncodingForMethodDecl((*I), MethodTypeString); Result += "\", \""; @@ -3414,7 +3414,7 @@ RewriteObjCProtocolMetaData(ObjCProtocolDecl *PDecl, const char *prefix, Result += "\t ,{{(struct objc_selector *)\""; else Result += "\t ,{(struct objc_selector *)\""; - Result += (*I)->getSelector().getAsString().c_str(); + Result += (*I)->getSelector().getAsString(); std::string MethodTypeString; Context->getObjCEncodingForMethodDecl((*I), MethodTypeString); Result += "\", \""; @@ -3477,7 +3477,7 @@ RewriteObjCProtocolMetaData(ObjCProtocolDecl *PDecl, const char *prefix, void RewriteObjC:: RewriteObjCProtocolListMetaData(const ObjCList &Protocols, - const char *prefix, const char *ClassName, + llvm::StringRef prefix, llvm::StringRef ClassName, std::string &Result) { if (Protocols.empty()) return; @@ -3570,7 +3570,7 @@ void RewriteObjC::RewriteObjCCategoryImplDecl(ObjCCategoryImplDecl *IDecl, // Null CDecl is case of a category implementation with no category interface if (CDecl) RewriteObjCProtocolListMetaData(CDecl->getReferencedProtocols(), "CATEGORY", - FullCategoryName.c_str(), Result); + FullCategoryName, Result); /* struct _objc_category { char *category_name; char *class_name; @@ -3768,15 +3768,15 @@ void RewriteObjC::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl, InstanceMethods.push_back(Setter); } RewriteObjCMethodsMetaData(InstanceMethods.begin(), InstanceMethods.end(), - true, "", IDecl->getNameAsCString(), Result); + true, "", IDecl->getName(), Result); // Build _objc_method_list for class's class methods if needed RewriteObjCMethodsMetaData(IDecl->classmeth_begin(), IDecl->classmeth_end(), - false, "", IDecl->getNameAsCString(), Result); + false, "", IDecl->getName(), Result); // Protocols referenced in class declaration? RewriteObjCProtocolListMetaData(CDecl->getReferencedProtocols(), - "CLASS", CDecl->getNameAsCString(), Result); + "CLASS", CDecl->getName(), Result); // Declaration of class/meta-class metadata /* struct _objc_class { @@ -4042,13 +4042,13 @@ static bool HasLocalVariableExternalStorage(ValueDecl *VD) { } std::string RewriteObjC::SynthesizeBlockFunc(BlockExpr *CE, int i, - const char *funcName, + llvm::StringRef funcName, std::string Tag) { const FunctionType *AFT = CE->getFunctionType(); QualType RT = AFT->getResultType(); std::string StructRef = "struct " + Tag; std::string S = "static " + RT.getAsString(Context->PrintingPolicy) + " __" + - funcName + "_" + "block_func_" + utostr(i); + funcName.str() + "_" + "block_func_" + utostr(i); BlockDecl *BD = CE->getBlockDecl(); @@ -4136,7 +4136,7 @@ std::string RewriteObjC::SynthesizeBlockFunc(BlockExpr *CE, int i, } std::string RewriteObjC::SynthesizeBlockHelperFuncs(BlockExpr *CE, int i, - const char *funcName, + llvm::StringRef funcName, std::string Tag) { std::string StructRef = "struct " + Tag; std::string S = "static void __"; @@ -4311,7 +4311,7 @@ std::string RewriteObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag, std::string RewriteObjC::SynthesizeBlockDescriptor(std::string DescTag, std::string ImplTag, int i, - const char *FunName, + llvm::StringRef FunName, unsigned hasCopy) { std::string S = "\nstatic struct " + DescTag; @@ -4330,15 +4330,15 @@ std::string RewriteObjC::SynthesizeBlockDescriptor(std::string DescTag, S += DescTag + "_DATA = { 0, sizeof(struct "; S += ImplTag + ")"; if (hasCopy) { - S += ", __" + std::string(FunName) + "_block_copy_" + utostr(i); - S += ", __" + std::string(FunName) + "_block_dispose_" + utostr(i); + S += ", __" + FunName.str() + "_block_copy_" + utostr(i); + S += ", __" + FunName.str() + "_block_dispose_" + utostr(i); } S += "};\n"; return S; } void RewriteObjC::SynthesizeBlockLiterals(SourceLocation FunLocStart, - const char *FunName) { + llvm::StringRef FunName) { // Insert declaration for the function in which block literal is used. if (CurFunctionDeclToDeclareForBlock && !Blocks.empty()) RewriteBlockLiteralFunctionDecl(CurFunctionDeclToDeclareForBlock); @@ -4372,8 +4372,8 @@ void RewriteObjC::SynthesizeBlockLiterals(SourceLocation FunLocStart, } } - std::string ImplTag = "__" + std::string(FunName) + "_block_impl_" + utostr(i); - std::string DescTag = "__" + std::string(FunName) + "_block_desc_" + utostr(i); + std::string ImplTag = "__" + FunName.str() + "_block_impl_" + utostr(i); + std::string DescTag = "__" + FunName.str() + "_block_desc_" + utostr(i); std::string CI = SynthesizeBlockImpl(Blocks[i], ImplTag, DescTag); @@ -4421,7 +4421,7 @@ void RewriteObjC::SynthesizeBlockLiterals(SourceLocation FunLocStart, void RewriteObjC::InsertBlockLiteralsWithinFunction(FunctionDecl *FD) { SourceLocation FunLocStart = FD->getTypeSpecStartLoc(); - const char *FuncName = FD->getNameAsCString(); + llvm::StringRef FuncName = FD->getName(); SynthesizeBlockLiterals(FunLocStart, FuncName); } @@ -4429,7 +4429,7 @@ void RewriteObjC::InsertBlockLiteralsWithinFunction(FunctionDecl *FD) { static void BuildUniqueMethodName(std::string &Name, ObjCMethodDecl *MD) { ObjCInterfaceDecl *IFace = MD->getClassInterface(); - Name = IFace->getNameAsCString(); + Name = IFace->getName(); Name += "__" + MD->getSelector().getAsString(); // Convert colons to underscores. std::string::size_type loc = 0; @@ -4443,7 +4443,7 @@ void RewriteObjC::InsertBlockLiteralsWithinMethod(ObjCMethodDecl *MD) { SourceLocation FunLocStart = MD->getLocStart(); std::string FuncName; BuildUniqueMethodName(FuncName, MD); - SynthesizeBlockLiterals(FunLocStart, FuncName.c_str()); + SynthesizeBlockLiterals(FunLocStart, FuncName); } void RewriteObjC::GetBlockDeclRefExprs(Stmt *S) { @@ -4671,7 +4671,7 @@ Stmt *RewriteObjC::RewriteBlockDeclRefExpr(Expr *DeclRefExp) { FD, SourceLocation(), FD->getType()); - const char *Name = VD->getNameAsCString(); + llvm::StringRef Name = VD->getName(); FD = FieldDecl::Create(*Context, 0, SourceLocation(), &Context->Idents.get(Name), Context->VoidPtrTy, 0, @@ -5111,7 +5111,7 @@ void RewriteObjC::CollectBlockDeclRefInfo(BlockExpr *Exp) { } } -FunctionDecl *RewriteObjC::SynthBlockInitFunctionDecl(const char *name) { +FunctionDecl *RewriteObjC::SynthBlockInitFunctionDecl(llvm::StringRef name) { IdentifierInfo *ID = &Context->Idents.get(name); QualType FType = Context->getFunctionNoProtoType(Context->VoidPtrTy); return FunctionDecl::Create(*Context, TUDecl,SourceLocation(), @@ -5178,13 +5178,13 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp, Expr *NewRep; // Simulate a contructor call... - FD = SynthBlockInitFunctionDecl(Tag.c_str()); + FD = SynthBlockInitFunctionDecl(Tag); DeclRefExpr *DRE = new (Context) DeclRefExpr(FD, FType, SourceLocation()); llvm::SmallVector InitExprs; // Initialize the block function. - FD = SynthBlockInitFunctionDecl(Func.c_str()); + FD = SynthBlockInitFunctionDecl(Func); DeclRefExpr *Arg = new (Context) DeclRefExpr(FD, FD->getType(), SourceLocation()); CastExpr *castExpr = NoTypeInfoCStyleCastExpr(Context, Context->VoidPtrTy, @@ -5214,7 +5214,7 @@ 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)->getNameAsCString()); + FD = SynthBlockInitFunctionDecl((*I)->getName()); Exp = new (Context) DeclRefExpr(FD, FD->getType(), SourceLocation()); if (HasLocalVariableExternalStorage(*I)) { QualType QT = (*I)->getType(); @@ -5223,12 +5223,12 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp, SourceLocation()); } } else if (isTopLevelBlockPointerType((*I)->getType())) { - FD = SynthBlockInitFunctionDecl((*I)->getNameAsCString()); + FD = SynthBlockInitFunctionDecl((*I)->getName()); Arg = new (Context) DeclRefExpr(FD, FD->getType(), SourceLocation()); Exp = NoTypeInfoCStyleCastExpr(Context, Context->VoidPtrTy, CastExpr::CK_Unknown, Arg); } else { - FD = SynthBlockInitFunctionDecl((*I)->getNameAsCString()); + FD = SynthBlockInitFunctionDecl((*I)->getName()); Exp = new (Context) DeclRefExpr(FD, FD->getType(), SourceLocation()); if (HasLocalVariableExternalStorage(*I)) { QualType QT = (*I)->getType(); @@ -5254,7 +5254,7 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp, assert(RD && "SynthBlockInitExpr(): Can't find RecordDecl"); QualType castT = Context->getPointerType(Context->getTagDeclType(RD)); - FD = SynthBlockInitFunctionDecl((*I)->getNameAsCString()); + FD = SynthBlockInitFunctionDecl((*I)->getName()); Exp = new (Context) DeclRefExpr(FD, FD->getType(), SourceLocation()); Exp = new (Context) UnaryOperator(Exp, UnaryOperator::AddrOf, Context->getPointerType(Exp->getType()), @@ -5670,7 +5670,7 @@ void RewriteObjC::HandleDeclInMainFile(Decl *D) { PropParentMap = 0; } SynthesizeBlockLiterals(VD->getTypeSpecStartLoc(), - VD->getNameAsCString()); + VD->getName()); GlobalVarDecl = 0; // This is needed for blocks. diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index b7b802a72f..550dcb8aeb 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -4789,7 +4789,7 @@ Sema::DeclPtrTy Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, DeclPtrTy D) { // emitted. Diag(FD->getLocation(), diag::warn_redeclaration_without_attribute_prev_attribute_ignored) - << FD->getNameAsCString() << "dllimport"; + << FD->getName() << "dllimport"; } } return DeclPtrTy::make(FD); diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index bd9155b052..9cb6babe44 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -387,7 +387,7 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(Scope *S, << property->getDeclName() << Ivar->getDeclName() << ClassDeclared->getDeclName(); Diag(Ivar->getLocation(), diag::note_previous_access_declaration) - << Ivar << Ivar->getNameAsCString(); + << Ivar << Ivar->getName(); // Note! I deliberately want it to fall thru so more errors are caught. } QualType IvarType = Context.getCanonicalType(Ivar->getType());