Index: cfe/trunk/lib/ARCMigrate/FileRemapper.cpp =================================================================== --- cfe/trunk/lib/ARCMigrate/FileRemapper.cpp +++ cfe/trunk/lib/ARCMigrate/FileRemapper.cpp @@ -64,7 +64,7 @@ std::vector > pairs; llvm::ErrorOr> fileBuf = - llvm::MemoryBuffer::getFile(infoFile.c_str()); + llvm::MemoryBuffer::getFile(infoFile); if (!fileBuf) return report("Error opening file: " + infoFile, Diag); Index: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp +++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp @@ -2647,8 +2647,7 @@ for (std::vector::iterator iter = ClassAliases.begin(); iter != ClassAliases.end(); ++iter) { llvm::Constant *TheClass = - TheModule.getGlobalVariable(("_OBJC_CLASS_" + iter->first).c_str(), - true); + TheModule.getGlobalVariable("_OBJC_CLASS_" + iter->first, true); if (TheClass) { TheClass = llvm::ConstantExpr::getBitCast(TheClass, PtrTy); Builder.CreateCall(RegisterAlias, Index: cfe/trunk/lib/CodeGen/TargetInfo.cpp =================================================================== --- cfe/trunk/lib/CodeGen/TargetInfo.cpp +++ cfe/trunk/lib/CodeGen/TargetInfo.cpp @@ -7457,7 +7457,7 @@ std::string Enc; public: FieldEncoding(bool b, SmallStringEnc &e) : HasName(b), Enc(e.c_str()) {} - StringRef str() {return Enc.c_str();} + StringRef str() { return Enc; } bool operator<(const FieldEncoding &rhs) const { if (HasName != rhs.HasName) return HasName; return Enc < rhs.Enc; @@ -7623,7 +7623,7 @@ E.State = IncompleteUsed; ++IncompleteUsedCount; } - return E.Str.c_str(); + return E.Str; } /// The XCore ABI includes a type information section that communicates symbol Index: cfe/trunk/lib/Driver/Driver.cpp =================================================================== --- cfe/trunk/lib/Driver/Driver.cpp +++ cfe/trunk/lib/Driver/Driver.cpp @@ -874,8 +874,7 @@ return; std::string TmpName = GetTemporaryPath("response", "txt"); - Cmd.setResponseFile( - C.addTempFile(C.getArgs().MakeArgString(TmpName.c_str()))); + Cmd.setResponseFile(C.addTempFile(C.getArgs().MakeArgString(TmpName))); } int Driver::ExecuteCompilation( @@ -3295,7 +3294,7 @@ std::pair Split = Name.split('.'); std::string TmpName = GetTemporaryPath( Split.first, types::getTypeTempSuffix(JA.getType(), IsCLMode())); - return C.addTempFile(C.getArgs().MakeArgString(TmpName.c_str())); + return C.addTempFile(C.getArgs().MakeArgString(TmpName)); } SmallString<128> BasePath(BaseInput); @@ -3344,7 +3343,7 @@ NamedOutput = C.getArgs().MakeArgString(Output.c_str()); } } else if (JA.getType() == types::TY_PCH && IsCLMode()) { - NamedOutput = C.getArgs().MakeArgString(GetClPchPath(C, BaseName).c_str()); + NamedOutput = C.getArgs().MakeArgString(GetClPchPath(C, BaseName)); } else { const char *Suffix = types::getTypeTempSuffix(JA.getType(), IsCLMode()); assert(Suffix && "All types used for output should have a suffix."); @@ -3394,7 +3393,7 @@ std::pair Split = Name.split('.'); std::string TmpName = GetTemporaryPath( Split.first, types::getTypeTempSuffix(JA.getType(), IsCLMode())); - return C.addTempFile(C.getArgs().MakeArgString(TmpName.c_str())); + return C.addTempFile(C.getArgs().MakeArgString(TmpName)); } } Index: cfe/trunk/lib/Driver/Job.cpp =================================================================== --- cfe/trunk/lib/Driver/Job.cpp +++ cfe/trunk/lib/Driver/Job.cpp @@ -182,7 +182,7 @@ // Replace the input file name with the crashinfo's file name. OS << ' '; StringRef ShortName = llvm::sys::path::filename(CrashInfo->Filename); - printArg(OS, ShortName.str().c_str(), Quote); + printArg(OS, ShortName.str(), Quote); continue; } } @@ -195,7 +195,7 @@ OS << ' '; printArg(OS, "-ivfsoverlay", Quote); OS << ' '; - printArg(OS, CrashInfo->VFSPath.str().c_str(), Quote); + printArg(OS, CrashInfo->VFSPath.str(), Quote); // Insert -fmodules-cache-path and use the relative module directory // .cache/vfs/modules where we already dumped the modules. @@ -207,7 +207,7 @@ ModCachePath.append(RelModCacheDir.c_str()); OS << ' '; - printArg(OS, ModCachePath.c_str(), Quote); + printArg(OS, ModCachePath, Quote); } if (ResponseFile != nullptr) { Index: cfe/trunk/lib/Driver/Tools.cpp =================================================================== --- cfe/trunk/lib/Driver/Tools.cpp +++ cfe/trunk/lib/Driver/Tools.cpp @@ -10753,14 +10753,14 @@ std::string UniversalCRTLibPath; if (MSVC.getUniversalCRTLibraryPath(UniversalCRTLibPath)) CmdArgs.push_back(Args.MakeArgString(std::string("-libpath:") + - UniversalCRTLibPath.c_str())); + UniversalCRTLibPath)); } } std::string WindowsSdkLibPath; if (MSVC.getWindowsSDKLibraryPath(WindowsSdkLibPath)) - CmdArgs.push_back(Args.MakeArgString(std::string("-libpath:") + - WindowsSdkLibPath.c_str())); + CmdArgs.push_back( + Args.MakeArgString(std::string("-libpath:") + WindowsSdkLibPath)); } if (!C.getDriver().IsCLMode() && Args.hasArg(options::OPT_L)) Index: cfe/trunk/lib/Frontend/CompilerInvocation.cpp =================================================================== --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp @@ -1469,7 +1469,7 @@ Path = Buffer.str(); } - Opts.AddPath(Path.c_str(), Group, IsFramework, + Opts.AddPath(Path, Group, IsFramework, /*IgnoreSysroot*/ true); IsIndexHeaderMap = false; } Index: cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp =================================================================== --- cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp +++ cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp @@ -863,9 +863,9 @@ CDecl = CatDecl->getClassInterface(); std::string RecName = CDecl->getName(); RecName += "_IMPL"; - RecordDecl *RD = RecordDecl::Create(*Context, TTK_Struct, TUDecl, - SourceLocation(), SourceLocation(), - &Context->Idents.get(RecName.c_str())); + RecordDecl *RD = + RecordDecl::Create(*Context, TTK_Struct, TUDecl, SourceLocation(), + SourceLocation(), &Context->Idents.get(RecName)); QualType PtrStructIMPL = Context->getPointerType(Context->getTagDeclType(RD)); unsigned UnsignedIntSize = static_cast(Context->getTypeSize(Context->UnsignedIntTy)); @@ -5301,11 +5301,9 @@ // Initialize the block descriptor. std::string DescData = "__" + FuncName + "_block_desc_" + BlockNumber + "_DATA"; - VarDecl *NewVD = VarDecl::Create(*Context, TUDecl, - SourceLocation(), SourceLocation(), - &Context->Idents.get(DescData.c_str()), - Context->VoidPtrTy, nullptr, - SC_Static); + VarDecl *NewVD = VarDecl::Create( + *Context, TUDecl, SourceLocation(), SourceLocation(), + &Context->Idents.get(DescData), Context->VoidPtrTy, nullptr, SC_Static); UnaryOperator *DescRefExpr = new (Context) UnaryOperator(new (Context) DeclRefExpr(NewVD, false, Context->VoidPtrTy, @@ -7522,9 +7520,9 @@ CDecl = CatDecl->getClassInterface(); std::string RecName = CDecl->getName(); RecName += "_IMPL"; - RecordDecl *RD = RecordDecl::Create(*Context, TTK_Struct, TUDecl, - SourceLocation(), SourceLocation(), - &Context->Idents.get(RecName.c_str())); + RecordDecl *RD = RecordDecl::Create( + *Context, TTK_Struct, TUDecl, SourceLocation(), SourceLocation(), + &Context->Idents.get(RecName)); QualType PtrStructIMPL = Context->getPointerType(Context->getTagDeclType(RD)); unsigned UnsignedIntSize = static_cast(Context->getTypeSize(Context->UnsignedIntTy)); Index: cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp =================================================================== --- cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp +++ cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp @@ -4426,11 +4426,9 @@ // Initialize the block descriptor. std::string DescData = "__" + FuncName + "_block_desc_" + BlockNumber + "_DATA"; - VarDecl *NewVD = VarDecl::Create(*Context, TUDecl, - SourceLocation(), SourceLocation(), - &Context->Idents.get(DescData.c_str()), - Context->VoidPtrTy, nullptr, - SC_Static); + VarDecl *NewVD = VarDecl::Create( + *Context, TUDecl, SourceLocation(), SourceLocation(), + &Context->Idents.get(DescData), Context->VoidPtrTy, nullptr, SC_Static); UnaryOperator *DescRefExpr = new (Context) UnaryOperator(new (Context) DeclRefExpr(NewVD, false, Context->VoidPtrTy, @@ -5650,14 +5648,12 @@ InstanceMethods.push_back(Setter); } RewriteObjCMethodsMetaData(InstanceMethods.begin(), InstanceMethods.end(), - true, "CATEGORY_", FullCategoryName.c_str(), - Result); - + true, "CATEGORY_", FullCategoryName, Result); + // Build _objc_method_list for class's class methods if needed RewriteObjCMethodsMetaData(IDecl->classmeth_begin(), IDecl->classmeth_end(), - false, "CATEGORY_", FullCategoryName.c_str(), - Result); - + false, "CATEGORY_", FullCategoryName, Result); + // Protocols referenced in class declaration? // Null CDecl is case of a category implementation with no category interface if (CDecl) @@ -5776,7 +5772,7 @@ Result += "{\n\t0, " + utostr(NumMethods) + "\n"; Result += "\t,{{(SEL)\""; - Result += (*MethodBegin)->getSelector().getAsString().c_str(); + Result += (*MethodBegin)->getSelector().getAsString(); std::string MethodTypeString; Context->getObjCEncodingForMethodDecl(*MethodBegin, MethodTypeString); Result += "\", \""; @@ -5786,7 +5782,7 @@ Result += "}\n"; for (++MethodBegin; MethodBegin != MethodEnd; ++MethodBegin) { Result += "\t ,{(SEL)\""; - Result += (*MethodBegin)->getSelector().getAsString().c_str(); + Result += (*MethodBegin)->getSelector().getAsString(); std::string MethodTypeString; Context->getObjCEncodingForMethodDecl(*MethodBegin, MethodTypeString); Result += "\", \""; Index: cfe/trunk/lib/Parse/ParseDeclCXX.cpp =================================================================== --- cfe/trunk/lib/Parse/ParseDeclCXX.cpp +++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp @@ -2234,7 +2234,7 @@ if (!(Function.TypeQuals & TypeQual)) { std::string Name(FixItName); Name += " "; - Insertion = FixItHint::CreateInsertion(VS.getFirstLocation(), Name.c_str()); + Insertion = FixItHint::CreateInsertion(VS.getFirstLocation(), Name); Function.TypeQuals |= TypeQual; *QualifierLoc = SpecLoc.getRawEncoding(); } Index: cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp +++ cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp @@ -106,7 +106,7 @@ SmallVector checkerOpts; for (unsigned i = 0, e = opts.CheckersControlList.size(); i != e; ++i) { const std::pair &opt = opts.CheckersControlList[i]; - checkerOpts.push_back(CheckerOptInfo(opt.first.c_str(), opt.second)); + checkerOpts.push_back(CheckerOptInfo(opt.first, opt.second)); } return checkerOpts; } Index: cfe/trunk/unittests/AST/ASTImporterTest.cpp =================================================================== --- cfe/trunk/unittests/AST/ASTImporterTest.cpp +++ cfe/trunk/unittests/AST/ASTImporterTest.cpp @@ -71,8 +71,7 @@ ToCtx.getSourceManager().getFileManager().getVirtualFileSystem().get()); vfs::InMemoryFileSystem *MFS = static_cast( OFS->overlays_begin()->get()); - MFS->addFile(InputFileName, 0, - llvm::MemoryBuffer::getMemBuffer(FromCode.c_str())); + MFS->addFile(InputFileName, 0, llvm::MemoryBuffer::getMemBuffer(FromCode)); ASTImporter Importer(ToCtx, ToAST->getFileManager(), FromCtx, FromAST->getFileManager(), false);