Index: llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp =================================================================== --- llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp +++ llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp @@ -254,7 +254,7 @@ llvm::Constant *initWith = 0) { llvm::BasicBlock &block = function.getEntryBlock(); llvm::IRBuilder<> tmp(&block, block.begin()); - llvm::AllocaInst *ret = tmp.CreateAlloca(type, 0, varName.c_str()); + llvm::AllocaInst *ret = tmp.CreateAlloca(type, 0, varName); if (initWith) tmp.CreateStore(initWith, ret); Index: llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp =================================================================== --- llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp +++ llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp @@ -1047,7 +1047,7 @@ const Constant *&C) { auto Source = StringValue.str(); // The source has to be null terminated. SMDiagnostic Err; - C = parseConstantValue(Source.c_str(), Err, *MF.getFunction()->getParent(), + C = parseConstantValue(Source, Err, *MF.getFunction()->getParent(), &PFS.IRSlots); if (!C) return error(Loc + Err.getColumnNo(), Err.getMessage()); Index: llvm/trunk/lib/MC/MCParser/DarwinAsmParser.cpp =================================================================== --- llvm/trunk/lib/MC/MCParser/DarwinAsmParser.cpp +++ llvm/trunk/lib/MC/MCParser/DarwinAsmParser.cpp @@ -614,7 +614,7 @@ TAA, TAAParsed, StubSize); if (!ErrorStr.empty()) - return Error(Loc, ErrorStr.c_str()); + return Error(Loc, ErrorStr); // Issue a warning if the target is not powerpc and Section is a *coal* section. Triple TT = getParser().getContext().getObjectFileInfo()->getTargetTriple(); Index: llvm/trunk/lib/MC/MachObjectWriter.cpp =================================================================== --- llvm/trunk/lib/MC/MachObjectWriter.cpp +++ llvm/trunk/lib/MC/MachObjectWriter.cpp @@ -422,7 +422,7 @@ uint64_t BytesWritten = sizeof(MachO::linker_option_command); for (const std::string &Option : Options) { // Write each string, including the null byte. - writeBytes(Option.c_str(), Option.size() + 1); + writeBytes(Option, Option.size() + 1); BytesWritten += Option.size() + 1; } Index: llvm/trunk/lib/ObjectYAML/ObjectYAML.cpp =================================================================== --- llvm/trunk/lib/ObjectYAML/ObjectYAML.cpp +++ llvm/trunk/lib/ObjectYAML/ObjectYAML.cpp @@ -51,7 +51,7 @@ else IO.setError( llvm::Twine("YAML Object File unsupported document type tag '") + - llvm::Twine(Tag.c_str()) + llvm::Twine("'!")); + llvm::Twine(Tag) + llvm::Twine("'!")); } } } Index: llvm/trunk/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp =================================================================== --- llvm/trunk/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp +++ llvm/trunk/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp @@ -1504,7 +1504,7 @@ ES << "0-" << Max; else ES << Max << "-" << (-Max - 1); - return Parser.printError(IDLoc, ES.str().c_str()); + return Parser.printError(IDLoc, ES.str()); } int HexagonAsmParser::processInstruction(MCInst &Inst, Index: llvm/trunk/lib/Target/Hexagon/HexagonVectorPrint.cpp =================================================================== --- llvm/trunk/lib/Target/Hexagon/HexagonVectorPrint.cpp +++ llvm/trunk/lib/Target/Hexagon/HexagonVectorPrint.cpp @@ -80,7 +80,7 @@ MachineFunction &Fn) { std::string VDescStr = ".long 0x1dffe0" + getStringReg(Reg); - const char *cstr = Fn.createExternalSymbolName(VDescStr.c_str()); + const char *cstr = Fn.createExternalSymbolName(VDescStr); unsigned ExtraInfo = InlineAsm::Extra_HasSideEffects; BuildMI(*MBB, I, DL, QII->get(TargetOpcode::INLINEASM)) .addExternalSymbol(cstr) Index: llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp =================================================================== --- llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp +++ llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp @@ -224,8 +224,7 @@ const char *Sym = MFI->getImageHandleSymbol(Index); std::string *SymNamePtr = nvTM.getManagedStrPool()->getManagedString(Sym); - MCOp = GetSymbolRef(OutContext.getOrCreateSymbol( - StringRef(SymNamePtr->c_str()))); + MCOp = GetSymbolRef(OutContext.getOrCreateSymbol(StringRef(*SymNamePtr))); } void NVPTXAsmPrinter::lowerToMCInst(const MachineInstr *MI, MCInst &OutMI) { Index: llvm/trunk/tools/lli/lli.cpp =================================================================== --- llvm/trunk/tools/lli/lli.cpp +++ llvm/trunk/tools/lli/lli.cpp @@ -271,7 +271,7 @@ return nullptr; // Load the object from the cache filename ErrorOr> IRObjectBuffer = - MemoryBuffer::getFile(CacheName.c_str(), -1, false); + MemoryBuffer::getFile(CacheName, -1, false); // If the file isn't there, that's OK. if (!IRObjectBuffer) return nullptr; Index: llvm/trunk/tools/llvm-lto/llvm-lto.cpp =================================================================== --- llvm/trunk/tools/llvm-lto/llvm-lto.cpp +++ llvm/trunk/tools/llvm-lto/llvm-lto.cpp @@ -823,7 +823,7 @@ for (unsigned i = BaseArg; i < InputFilenames.size(); ++i) { CurrentActivity = "loading file '" + InputFilenames[i] + "'"; ErrorOr> ModuleOrErr = - LTOModule::createFromFile(Context, InputFilenames[i].c_str(), Options); + LTOModule::createFromFile(Context, InputFilenames[i], Options); std::unique_ptr &Module = *ModuleOrErr; CurrentActivity = ""; @@ -851,11 +851,11 @@ // Add all the exported symbols to the table of symbols to preserve. for (unsigned i = 0; i < ExportedSymbols.size(); ++i) - CodeGen.addMustPreserveSymbol(ExportedSymbols[i].c_str()); + CodeGen.addMustPreserveSymbol(ExportedSymbols[i]); // Add all the dso symbols to the table of symbols to expose. for (unsigned i = 0; i < KeptDSOSyms.size(); ++i) - CodeGen.addMustPreserveSymbol(KeptDSOSyms[i].c_str()); + CodeGen.addMustPreserveSymbol(KeptDSOSyms[i]); // Set cpu and attrs strings for the default target/subtarget. CodeGen.setCpu(MCPU.c_str()); @@ -870,7 +870,7 @@ } if (!attrs.empty()) - CodeGen.setAttr(attrs.c_str()); + CodeGen.setAttr(attrs); if (FileType.getNumOccurrences()) CodeGen.setFileType(FileType); @@ -887,7 +887,7 @@ ModuleFilename += ".merged.bc"; std::string ErrMsg; - if (!CodeGen.writeMergedModules(ModuleFilename.c_str())) + if (!CodeGen.writeMergedModules(ModuleFilename)) error("writing merged module failed."); } Index: llvm/trunk/tools/lto/lto.cpp =================================================================== --- llvm/trunk/tools/lto/lto.cpp +++ llvm/trunk/tools/lto/lto.cpp @@ -153,7 +153,7 @@ attrs.append(MAttrs[i]); } - CG->setAttr(attrs.c_str()); + CG->setAttr(attrs); } if (OptLevel < '0' || OptLevel > '3') Index: llvm/trunk/tools/opt/PassPrinters.cpp =================================================================== --- llvm/trunk/tools/opt/PassPrinters.cpp +++ llvm/trunk/tools/opt/PassPrinters.cpp @@ -46,7 +46,7 @@ return false; } - StringRef getPassName() const override { return PassName.c_str(); } + StringRef getPassName() const override { return PassName; } void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequiredID(PassToPrint->getTypeInfo()); @@ -83,7 +83,7 @@ return false; } - StringRef getPassName() const override { return PassName.c_str(); } + StringRef getPassName() const override { return PassName; } void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequiredID(PassToPrint->getTypeInfo()); @@ -115,7 +115,7 @@ return false; } - StringRef getPassName() const override { return PassName.c_str(); } + StringRef getPassName() const override { return PassName; } void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequiredID(PassToPrint->getTypeInfo()); @@ -148,7 +148,7 @@ return false; } - StringRef getPassName() const override { return PassName.c_str(); } + StringRef getPassName() const override { return PassName; } void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequiredID(PassToPrint->getTypeInfo()); @@ -183,7 +183,7 @@ return false; } - StringRef getPassName() const override { return PassName.c_str(); } + StringRef getPassName() const override { return PassName; } void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequiredID(PassToPrint->getTypeInfo()); @@ -217,7 +217,7 @@ return false; } - StringRef getPassName() const override { return PassName.c_str(); } + StringRef getPassName() const override { return PassName; } void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequiredID(PassToPrint->getTypeInfo()); Index: llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITTestAPICommon.h =================================================================== --- llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITTestAPICommon.h +++ llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITTestAPICommon.h @@ -67,7 +67,7 @@ // If ARCH has sub-arch support, find it SmallVectorImpl::const_iterator I = SupportedSubArchs.begin(); for(; I != SupportedSubArchs.end(); ++I) - if (Host.getArchName().startswith(I->c_str())) + if (Host.getArchName().startswith(*I)) return true; return false;