SmallString<128> FilePath(Entry->getName());
FixupRelativePath(FilePath);
- return FS->getBufferForFile(FilePath.str(), FileSize,
+ return FS->getBufferForFile(FilePath, FileSize,
/*RequiresNullTerminator=*/true, isVolatile);
}
if (Current != End) {
SmallString<128> PathStr(Dir);
llvm::sys::path::append(PathStr, (*Current)->getName());
- llvm::ErrorOr<vfs::Status> S = FS.status(PathStr.str());
+ llvm::ErrorOr<vfs::Status> S = FS.status(PathStr);
if (S)
CurrentEntry = *S;
else
if (++Current != End) {
SmallString<128> PathStr(Dir);
llvm::sys::path::append(PathStr, (*Current)->getName());
- llvm::ErrorOr<vfs::Status> S = FS.status(PathStr.str());
+ llvm::ErrorOr<vfs::Status> S = FS.status(PathStr);
if (!S)
return S.getError();
CurrentEntry = *S;
if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
SmallString<128> ResourceDir(D.ResourceDir);
llvm::sys::path::append(ResourceDir, "include");
- addSystemInclude(DriverArgs, CC1Args, ResourceDir.str());
+ addSystemInclude(DriverArgs, CC1Args, ResourceDir);
}
addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include");
}
SmallString<64> Path(Value);
if (Arg *WorkDir = Args.getLastArg(options::OPT_working_directory)) {
- if (!llvm::sys::path::is_absolute(Path.str())) {
+ if (!llvm::sys::path::is_absolute(Path)) {
SmallString<64> Directory(WorkDir->getValue());
llvm::sys::path::append(Directory, Value);
Path.assign(Directory);
if (D.IsCLMode() && llvm::sys::Process::FindInEnvPath("LIB", Value))
return true;
- D.Diag(clang::diag::err_drv_no_such_file) << Path.str();
+ D.Diag(clang::diag::err_drv_no_such_file) << Path;
return false;
}
const char *subfolder) const {
llvm::SmallString<128> path(folder);
llvm::sys::path::append(path, subfolder);
- addSystemInclude(DriverArgs, CC1Args, path.str());
+ addSystemInclude(DriverArgs, CC1Args, path);
}
void MSVCToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
SmallString<128> P(getDriver().ResourceDir);
llvm::sys::path::append(P, "include");
- addSystemInclude(DriverArgs, CC1Args, P.str());
+ addSystemInclude(DriverArgs, CC1Args, P);
}
if (DriverArgs.hasArg(options::OPT_nostdlibinc))
llvm::sys::path::append(IncludeSuffix, "/", Base.includeSuffix(),
New.includeSuffix());
- Multilib Composed(GCCSuffix.str(), OSSuffix.str(), IncludeSuffix.str());
+ Multilib Composed(GCCSuffix, OSSuffix, IncludeSuffix);
Multilib::flags_list &Flags = Composed.flags();
// For now, allow missing resource libraries to support developers who may
// not have compiler-rt checked out or integrated into their build (unless
// we explicitly force linking with this library).
- if (AlwaysLink || llvm::sys::fs::exists(P.str()))
- CmdArgs.push_back(Args.MakeArgString(P.str()));
+ if (AlwaysLink || llvm::sys::fs::exists(P))
+ CmdArgs.push_back(Args.MakeArgString(P));
// Adding the rpaths might negatively interact when other rpaths are involved,
// so we should make sure we add the rpaths last, after all user-specified
// Add the path to the resource dir to rpath to support using the dylib
// from the default location without copying.
CmdArgs.push_back("-rpath");
- CmdArgs.push_back(Args.MakeArgString(Dir.str()));
+ CmdArgs.push_back(Args.MakeArgString(Dir));
}
}
SmallString<128> P(A->getValue());
llvm::sys::path::append(P, "usr", "lib", "libstdc++.dylib");
- if (!llvm::sys::fs::exists(P.str())) {
+ if (!llvm::sys::fs::exists(P)) {
llvm::sys::path::remove_filename(P);
llvm::sys::path::append(P, "libstdc++.6.dylib");
- if (llvm::sys::fs::exists(P.str())) {
- CmdArgs.push_back(Args.MakeArgString(P.str()));
+ if (llvm::sys::fs::exists(P)) {
+ CmdArgs.push_back(Args.MakeArgString(P));
return;
}
}
// For now, allow missing resource libraries to support developers who may
// not have compiler-rt checked out or integrated into their build.
- if (llvm::sys::fs::exists(P.str()))
- CmdArgs.push_back(Args.MakeArgString(P.str()));
+ if (llvm::sys::fs::exists(P))
+ CmdArgs.push_back(Args.MakeArgString(P));
}
DerivedArgList *MachO::TranslateArgs(const DerivedArgList &Args,
llvm::sys::path::append(IncludeDir, "hexagon/include/c++/");
llvm::sys::path::append(IncludeDir, Ver);
- addSystemInclude(DriverArgs, CC1Args, IncludeDir.str());
+ addSystemInclude(DriverArgs, CC1Args, IncludeDir);
}
ToolChain::CXXStdlibType
if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
SmallString<128> P(D.ResourceDir);
llvm::sys::path::append(P, "include");
- addSystemInclude(DriverArgs, CC1Args, P.str());
+ addSystemInclude(DriverArgs, CC1Args, P);
}
if (DriverArgs.hasArg(options::OPT_nostdlibinc))
P += ".dummy";
if (UsePCH) {
llvm::sys::path::replace_extension(P, "pch");
- if (llvm::sys::fs::exists(P.str()))
+ if (llvm::sys::fs::exists(P))
FoundPCH = true;
}
if (!FoundPCH) {
llvm::sys::path::replace_extension(P, "pth");
- if (llvm::sys::fs::exists(P.str()))
+ if (llvm::sys::fs::exists(P))
FoundPTH = true;
}
if (!FoundPCH && !FoundPTH) {
llvm::sys::path::replace_extension(P, "gch");
- if (llvm::sys::fs::exists(P.str())) {
+ if (llvm::sys::fs::exists(P)) {
FoundPCH = UsePCH;
FoundPTH = !UsePCH;
}
CmdArgs.push_back("-include-pch");
else
CmdArgs.push_back("-include-pth");
- CmdArgs.push_back(Args.MakeArgString(P.str()));
+ CmdArgs.push_back(Args.MakeArgString(P));
continue;
} else {
// Ignore the PCH if not first on command line and emit warning.
D.Diag(diag::warn_drv_pch_not_first_include)
- << P.str() << A->getAsString(Args);
+ << P << A->getAsString(Args);
}
}
}
} else {
CoverageFilename = llvm::sys::path::filename(Output.getBaseInput());
}
- if (llvm::sys::path::is_relative(CoverageFilename.str())) {
+ if (llvm::sys::path::is_relative(CoverageFilename)) {
SmallString<128> Pwd;
if (!llvm::sys::fs::current_path(Pwd)) {
- llvm::sys::path::append(Pwd, CoverageFilename.str());
+ llvm::sys::path::append(Pwd, CoverageFilename);
CoverageFilename.swap(Pwd);
}
}
Flags += EscapedArg;
}
CmdArgs.push_back("-dwarf-debug-flags");
- CmdArgs.push_back(Args.MakeArgString(Flags.str()));
+ CmdArgs.push_back(Args.MakeArgString(Flags));
}
// Add the split debug info name to the command lines here so we
Flags += EscapedArg;
}
CmdArgs.push_back("-dwarf-debug-flags");
- CmdArgs.push_back(Args.MakeArgString(Flags.str()));
+ CmdArgs.push_back(Args.MakeArgString(Flags));
}
// FIXME: Add -static support, once we have it.
SmallString<128> ImplibName(Output.getFilename());
llvm::sys::path::replace_extension(ImplibName, "lib");
CmdArgs.push_back(Args.MakeArgString(std::string("-implib:") +
- ImplibName.str()));
+ ImplibName));
}
if (TC.getSanitizerArgs().needsAsanRt()) {
StrVec += text;
}
- return commitInsert(OrigLoc, Offs, StrVec.str(), beforePreviousInsertions);
+ return commitInsert(OrigLoc, Offs, StrVec, beforePreviousInsertions);
}
void EditedSource::commitRemove(SourceLocation OrigLoc,
continue;
}
- applyRewrite(receiver, StrVec.str(), CurOffs, CurLen, SourceMgr, LangOpts);
+ applyRewrite(receiver, StrVec, CurOffs, CurLen, SourceMgr, LangOpts);
CurOffs = offs;
StrVec = act.Text;
CurLen = act.RemoveLen;
CurEnd = CurOffs.getWithOffset(CurLen);
}
- applyRewrite(receiver, StrVec.str(), CurOffs, CurLen, SourceMgr, LangOpts);
+ applyRewrite(receiver, StrVec, CurOffs, CurLen, SourceMgr, LangOpts);
}
void EditedSource::clearRewrites() {
TempPath = File;
TempPath += "-%%%%%%%%";
int fd;
- if (llvm::sys::fs::createUniqueFile(TempPath.str(), fd, TempPath))
+ if (llvm::sys::fs::createUniqueFile(TempPath, fd, TempPath))
return true;
// FIXME: Can we somehow regenerate the stat cache here, or do we need to
return true;
}
- if (llvm::sys::fs::rename(TempPath.str(), File)) {
- llvm::sys::fs::remove(TempPath.str());
+ if (llvm::sys::fs::rename(TempPath, File)) {
+ llvm::sys::fs::remove(TempPath);
return true;
}
// relative to that.
FileMgr->FixupRelativePath(NewOutFile);
if (std::error_code ec =
- llvm::sys::fs::rename(it->TempFilename, NewOutFile.str())) {
+ llvm::sys::fs::rename(it->TempFilename, NewOutFile)) {
getDiagnostics().Report(diag::err_unable_to_rename_temp)
<< it->TempFilename << it->Filename << ec.message();
TempPath += "-%%%%%%%%";
int fd;
std::error_code EC =
- llvm::sys::fs::createUniqueFile(TempPath.str(), fd, TempPath);
+ llvm::sys::fs::createUniqueFile(TempPath, fd, TempPath);
if (CreateMissingDirectories &&
EC == llvm::errc::no_such_file_or_directory) {
StringRef Parent = llvm::sys::path::parent_path(OutputPath);
EC = llvm::sys::fs::create_directories(Parent);
if (!EC) {
- EC = llvm::sys::fs::createUniqueFile(TempPath.str(), fd, TempPath);
+ EC = llvm::sys::fs::createUniqueFile(TempPath, fd, TempPath);
}
}
std::error_code EC;
SmallString<128> ModuleCachePathNative;
llvm::sys::path::native(HSOpts.ModuleCachePath, ModuleCachePathNative);
- for (llvm::sys::fs::directory_iterator
- Dir(ModuleCachePathNative.str(), EC), DirEnd;
+ for (llvm::sys::fs::directory_iterator Dir(ModuleCachePathNative, EC), DirEnd;
Dir != DirEnd && !EC; Dir.increment(EC)) {
// If we don't have a directory, there's nothing to look into.
if (!llvm::sys::fs::is_directory(Dir->path()))
llvm::sys::path::append(systemVersionFile, "SystemVersion.plist");
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> buffer =
- llvm::MemoryBuffer::getFile(systemVersionFile.str());
+ llvm::MemoryBuffer::getFile(systemVersionFile);
if (buffer) {
code = hash_combine(code, buffer.get()->getBuffer());
SmallString<128> DirNative;
llvm::sys::path::native(PCHDir->getName(), DirNative);
bool Found = false;
- for (llvm::sys::fs::directory_iterator Dir(DirNative.str(), EC), DirEnd;
+ for (llvm::sys::fs::directory_iterator Dir(DirNative, EC), DirEnd;
Dir != DirEnd && !EC; Dir.increment(EC)) {
// Check whether this is an acceptable AST file.
if (ASTReader::isAcceptableASTFile(Dir->path(), FileMgr,
std::error_code EC;
SmallString<128> DirNative;
llvm::sys::path::native(UmbrellaDir->getName(), DirNative);
- for (llvm::sys::fs::recursive_directory_iterator Dir(DirNative.str(), EC),
+ for (llvm::sys::fs::recursive_directory_iterator Dir(DirNative, EC),
DirEnd;
Dir != DirEnd && !EC; Dir.increment(EC)) {
// Check whether this entry has an extension typically associated with
// supplied path.
SmallString<128> P = StringRef(HSOpts.ResourceDir);
llvm::sys::path::append(P, "include");
- AddUnmappedPath(P.str(), ExternCSystem, false);
+ AddUnmappedPath(P, ExternCSystem, false);
}
// All remaining additions are for system include directories, early exit if
// <sysroot>/<triple>/include
SmallString<128> P = StringRef(HSOpts.ResourceDir);
llvm::sys::path::append(P, "../../..", triple.str(), "include");
- AddPath(P.str(), System, false);
+ AddPath(P, System, false);
break;
}
// <sysroot>/i686-w64-mingw32/include
SmallString<128> P = StringRef(HSOpts.ResourceDir);
llvm::sys::path::append(P, "../../../i686-w64-mingw32/include");
- AddPath(P.str(), System, false);
+ AddPath(P, System, false);
// <sysroot>/x86_64-w64-mingw32/include
P.resize(HSOpts.ResourceDir.size());
llvm::sys::path::append(P, "../../../x86_64-w64-mingw32/include");
- AddPath(P.str(), System, false);
+ AddPath(P, System, false);
// mingw.org crt include paths
// <sysroot>/include
P.resize(HSOpts.ResourceDir.size());
llvm::sys::path::append(P, "../../../include");
- AddPath(P.str(), System, false);
+ AddPath(P, System, false);
AddPath("/mingw/include", System, false);
#if defined(LLVM_ON_WIN32)
AddPath("c:/mingw/include", System, false);
// Get foo/include/c++/v1
llvm::sys::path::append(P, "include", "c++", "v1");
- AddUnmappedPath(P.str(), CXXSystem, false);
+ AddUnmappedPath(P, CXXSystem, false);
}
}
// On Solaris, include the support directory for things like xlocale and
// Set up the builtin include directory in the module map.
SmallString<128> P = StringRef(HSOpts.ResourceDir);
llvm::sys::path::append(P, "include");
- if (const DirectoryEntry *Dir = HS.getFileMgr().getDirectory(P.str()))
+ if (const DirectoryEntry *Dir = HS.getFileMgr().getDirectory(P))
HS.getModuleMap().setBuiltinIncludeDir(Dir);
}
if (std::error_code EC = fs::create_directories(path::parent_path(Dest),
/*IgnoreExisting=*/true))
return EC;
- if (std::error_code EC = fs::copy_file(AbsoluteSrc.str(), Dest.str()))
+ if (std::error_code EC = fs::copy_file(AbsoluteSrc, Dest))
return EC;
// Use the absolute path under the root for the file mapping.
- Collector.addFileMapping(AbsoluteSrc.str(), Dest.str());
+ Collector.addFileMapping(AbsoluteSrc, Dest);
return std::error_code();
}
"Unexpected diagnostic with valid location outside of a source file");
SDiagsRenderer Renderer(*this, *LangOpts, &*State->DiagOpts);
Renderer.emitDiagnostic(Info.getLocation(), DiagLevel,
- State->diagBuf.str(),
+ State->diagBuf,
Info.getRanges(),
Info.getFixItHints(),
&Info.getSourceManager(),
SmallString<128> HashStr;
llvm::APInt(64, size_t(Hash)).toStringUnsigned(HashStr, /*Radix*/36);
- llvm::sys::path::append(Result, ModuleName + "-" + HashStr.str() + ".pcm");
+ llvm::sys::path::append(Result, ModuleName + "-" + HashStr + ".pcm");
}
return Result.str().str();
}
RelativePath->append(Filename.begin(), Filename.end());
}
- return getFileAndSuggestModule(HS, TmpDir.str(), getDir(),
+ return getFileAndSuggestModule(HS, TmpDir, getDir(),
isSystemHeaderDirectory(),
SuggestedModule);
}
HS.IncrementFrameworkLookupCount();
// If the framework dir doesn't exist, we fail.
- const DirectoryEntry *Dir = FileMgr.getDirectory(FrameworkName.str());
+ const DirectoryEntry *Dir = FileMgr.getDirectory(FrameworkName);
if (!Dir) return nullptr;
// Otherwise, if it does, remember that this is the right direntry for this
if (getDirCharacteristic() == SrcMgr::C_User) {
SmallString<1024> SystemFrameworkMarker(FrameworkName);
SystemFrameworkMarker += ".system_framework";
- if (llvm::sys::fs::exists(SystemFrameworkMarker.str())) {
+ if (llvm::sys::fs::exists(SystemFrameworkMarker)) {
CacheEntry.IsUserSpecifiedSystemFramework = true;
}
}
}
FrameworkName.append(Filename.begin()+SlashPos+1, Filename.end());
- const FileEntry *FE = FileMgr.getFile(FrameworkName.str(),
+ const FileEntry *FE = FileMgr.getFile(FrameworkName,
/*openFile=*/!SuggestedModule);
if (!FE) {
// Check "/System/Library/Frameworks/Cocoa.framework/PrivateHeaders/file.h"
SearchPath->insert(SearchPath->begin()+OrigSize, Private,
Private+strlen(Private));
- FE = FileMgr.getFile(FrameworkName.str(), /*openFile=*/!SuggestedModule);
+ FE = FileMgr.getFile(FrameworkName, /*openFile=*/!SuggestedModule);
}
// If we found the header and are allowed to suggest a module, do so now.
bool IncluderIsSystemHeader =
Includer && getFileInfo(Includer).DirInfo != SrcMgr::C_User;
if (const FileEntry *FE = getFileAndSuggestModule(
- *this, TmpDir.str(), IncluderAndDir.second,
+ *this, TmpDir, IncluderAndDir.second,
IncluderIsSystemHeader, SuggestedModule)) {
if (!Includer) {
assert(First && "only first includer can have no file");
++NumSubFrameworkLookups;
// If the framework dir doesn't exist, we fail.
- const DirectoryEntry *Dir = FileMgr.getDirectory(FrameworkName.str());
+ const DirectoryEntry *Dir = FileMgr.getDirectory(FrameworkName);
if (!Dir) return nullptr;
// Otherwise, if it does, remember that this is the right direntry for this
}
HeadersFilename.append(Filename.begin()+SlashPos+1, Filename.end());
- if (!(FE = FileMgr.getFile(HeadersFilename.str(), /*openFile=*/true))) {
+ if (!(FE = FileMgr.getFile(HeadersFilename, /*openFile=*/true))) {
// Check ".../Frameworks/HIToolbox.framework/PrivateHeaders/HIToolbox.h"
HeadersFilename = FrameworkName;
}
HeadersFilename.append(Filename.begin()+SlashPos+1, Filename.end());
- if (!(FE = FileMgr.getFile(HeadersFilename.str(), /*openFile=*/true)))
+ if (!(FE = FileMgr.getFile(HeadersFilename, /*openFile=*/true)))
return nullptr;
}
DirNative);
// Search each of the ".framework" directories to load them as modules.
- for (llvm::sys::fs::directory_iterator Dir(DirNative.str(), EC), DirEnd;
+ for (llvm::sys::fs::directory_iterator Dir(DirNative, EC), DirEnd;
Dir != DirEnd && !EC; Dir.increment(EC)) {
if (llvm::sys::path::extension(Dir->path()) != ".framework")
continue;
std::error_code EC;
SmallString<128> DirNative;
llvm::sys::path::native(SearchDir.getDir()->getName(), DirNative);
- for (llvm::sys::fs::directory_iterator Dir(DirNative.str(), EC), DirEnd;
+ for (llvm::sys::fs::directory_iterator Dir(DirNative, EC), DirEnd;
Dir != DirEnd && !EC; Dir.increment(EC)) {
bool IsFramework = llvm::sys::path::extension(Dir->path()) == ".framework";
if (IsFramework == SearchDir.isFramework())
= StringRef(FrameworkDir->getName());
llvm::sys::path::append(SubframeworksDirName, "Frameworks");
llvm::sys::path::native(SubframeworksDirName);
- for (llvm::sys::fs::directory_iterator
- Dir(SubframeworksDirName.str(), EC), DirEnd;
+ for (llvm::sys::fs::directory_iterator Dir(SubframeworksDirName, EC), DirEnd;
Dir != DirEnd && !EC; Dir.increment(EC)) {
if (!StringRef(Dir->path()).endswith(".framework"))
continue;
if (llvm::sys::path::is_relative(FileNameRef)) {
ModuleMapFileName += Directory->getName();
llvm::sys::path::append(ModuleMapFileName, FileName);
- FileNameRef = ModuleMapFileName.str();
+ FileNameRef = ModuleMapFileName;
}
if (const FileEntry *File = SourceMgr.getFileManager().getFile(FileNameRef))
Map.parseModuleMapFile(
// Check whether this file is in the public headers.
llvm::sys::path::append(RelativePathName, "Headers", Header.FileName);
- llvm::sys::path::append(FullPathName, RelativePathName.str());
+ llvm::sys::path::append(FullPathName, RelativePathName);
File = SourceMgr.getFileManager().getFile(FullPathName);
if (!File) {
FullPathName.resize(FullPathLength);
llvm::sys::path::append(RelativePathName, "PrivateHeaders",
Header.FileName);
- llvm::sys::path::append(FullPathName, RelativePathName.str());
+ llvm::sys::path::append(FullPathName, RelativePathName);
File = SourceMgr.getFileManager().getFile(FullPathName);
}
} else {
// Lookup for normal headers.
llvm::sys::path::append(RelativePathName, Header.FileName);
- llvm::sys::path::append(FullPathName, RelativePathName.str());
+ llvm::sys::path::append(FullPathName, RelativePathName);
File = SourceMgr.getFileManager().getFile(FullPathName);
// If this is a system module with a top-level header, this header
// Find the first non-whitespace character, so that we can make the
// diagnostic more succinct.
- StringRef Msg = Message.str().ltrim(" ");
+ StringRef Msg = StringRef(Message).ltrim(" ");
if (isWarning)
Diag(Tok, diag::pp_hash_warning) << Msg;
FilenameBuffer.push_back('<');
if (ConcatenateIncludeName(FilenameBuffer, End))
return; // Found <eod> but no ">"? Diagnostic already emitted.
- Filename = FilenameBuffer.str();
+ Filename = FilenameBuffer;
CharEnd = End.getLocWithOffset(1);
break;
default:
CharSourceRange ReplaceRange(SourceRange(HashLoc, CharEnd),
/*IsTokenRange=*/false);
Diag(HashLoc, diag::warn_auto_module_import)
- << IncludeKind << PathString
- << FixItHint::CreateReplacement(ReplaceRange,
- "@import " + PathString.str().str() + ";");
+ << IncludeKind << PathString
+ << FixItHint::CreateReplacement(
+ ReplaceRange, ("@import " + PathString + ";").str());
}
// Load the module. Only make macros visible. We'll make the declarations
Tok.setKind(tok::eod);
return false; // Found <eod> but no ">"? Diagnostic already emitted.
}
- Filename = FilenameBuffer.str();
+ Filename = FilenameBuffer;
break;
default:
PP.Diag(Tok.getLocation(), diag::err_pp_expects_filename);
SourceLocation End;
if (ConcatenateIncludeName(FileNameBuffer, End))
return; // Diagnostic already emitted
- SourceFileName = FileNameBuffer.str();
+ SourceFileName = FileNameBuffer;
} else {
Diag(Tok, diag::warn_pragma_include_alias_expected_filename);
return;
SourceLocation End;
if (ConcatenateIncludeName(FileNameBuffer, End))
return; // Diagnostic already emitted
- ReplaceFileName = FileNameBuffer.str();
+ ReplaceFileName = FileNameBuffer;
} else {
Diag(Tok, diag::warn_pragma_include_alias_expected_filename);
return;
// disabling it.
PP.Diag(Loc, PP.getLangOpts().MicrosoftExt ? diag::ext_pp_bad_paste_ms
: diag::err_pp_bad_paste)
- << Buffer.str();
+ << Buffer;
}
// An error has occurred so exit loop.
Diag(NameLoc, diag::ext_gnu_old_style_field_designator)
<< FixItHint::CreateReplacement(SourceRange(NameLoc, ColonLoc),
- NewSyntax.str());
+ NewSyntax);
Designation D;
D.AddDesignator(Designator::getField(FieldName, SourceLocation(), NameLoc));
<< " int " << FTI.Params[i].Ident->getName() << ";\n";
Diag(FTI.Params[i].IdentLoc, diag::ext_param_not_declared)
<< FTI.Params[i].Ident
- << FixItHint::CreateInsertion(LocAfterDecls, Code.str());
+ << FixItHint::CreateInsertion(LocAfterDecls, Code);
// Implicitly declare the argument as type 'int' for lack of a better
// type.
// turned off separately if needed.
if (LeftBits == ResultBits - 1) {
S.Diag(Loc, diag::warn_shift_result_sets_sign_bit)
- << HexResult.str() << LHSType
+ << HexResult << LHSType
<< LHS.get()->getSourceRange() << RHS.get()->getSourceRange();
return;
}
if (PrevString == CurrString)
Diag(CaseVals[i].second->getLHS()->getLocStart(),
diag::err_duplicate_case) <<
- (PrevString.empty() ? CaseValStr.str() : PrevString);
+ (PrevString.empty() ? CaseValStr : PrevString);
else
Diag(CaseVals[i].second->getLHS()->getLocStart(),
diag::err_duplicate_case_differing_expr) <<
- (PrevString.empty() ? CaseValStr.str() : PrevString) <<
- (CurrString.empty() ? CaseValStr.str() : CurrString) <<
+ (PrevString.empty() ? CaseValStr : PrevString) <<
+ (CurrString.empty() ? CaseValStr : CurrString) <<
CaseValStr;
Diag(CaseVals[i-1].second->getLHS()->getLocStart(),
// Read string data
SmallString<16> Str(&Record[Idx], &Record[Idx] + Len);
- E->setString(Reader.getContext(), Str.str(), kind, isPascal);
+ E->setString(Reader.getContext(), Str, kind, isPascal);
Idx += Len;
// Read source locations
Record.push_back(NumHeaderSearchEntries);
Record.push_back(TableData.size());
TableData.append(GeneratorTrait.strings_begin(),GeneratorTrait.strings_end());
- Stream.EmitRecordWithBlob(TableAbbrev, Record, TableData.str());
+ Stream.EmitRecordWithBlob(TableAbbrev, Record, TableData);
// Free all of the strings we had to duplicate.
for (unsigned I = 0, N = SavedStrings.size(); I != N; ++I)
Record.push_back(MACRO_TABLE);
Record.push_back(BucketOffset);
- Stream.EmitRecordWithBlob(MacroTableAbbrev, Record, MacroTable.str());
+ Stream.EmitRecordWithBlob(MacroTableAbbrev, Record, MacroTable);
Record.clear();
// Write the offsets table for macro IDs.
Record.push_back(METHOD_POOL);
Record.push_back(BucketOffset);
Record.push_back(NumTableEntries);
- Stream.EmitRecordWithBlob(MethodPoolAbbrev, Record, MethodPool.str());
+ Stream.EmitRecordWithBlob(MethodPoolAbbrev, Record, MethodPool);
// Create a blob abbreviation for the selector table offsets.
Abbrev = new BitCodeAbbrev();
RecordData Record;
Record.push_back(IDENTIFIER_TABLE);
Record.push_back(BucketOffset);
- Stream.EmitRecordWithBlob(IDTableAbbrev, Record, IdentifierTable.str());
+ Stream.EmitRecordWithBlob(IDTableAbbrev, Record, IdentifierTable);
}
// Write the offsets table for identifier IDs.
Record.push_back(DECL_CONTEXT_VISIBLE);
Record.push_back(BucketOffset);
Stream.EmitRecordWithBlob(DeclContextVisibleLookupAbbrev, Record,
- LookupTable.str());
+ LookupTable);
++NumVisibleDeclContexts;
return Offset;
}
Record.push_back(UPDATE_VISIBLE);
Record.push_back(getDeclID(cast<Decl>(DC)));
Record.push_back(BucketOffset);
- Stream.EmitRecordWithBlob(UpdateVisibleAbbrev, Record, LookupTable.str());
+ Stream.EmitRecordWithBlob(UpdateVisibleAbbrev, Record, LookupTable);
}
/// \brief Write an FP_PRAGMA_OPTIONS block for the given FPOptions.
Record.clear();
Record.push_back(IDENTIFIER_INDEX);
Record.push_back(BucketOffset);
- Stream.EmitRecordWithBlob(IDTableAbbrev, Record, IdentifierTable.str());
+ Stream.EmitRecordWithBlob(IDTableAbbrev, Record, IdentifierTable);
}
Stream.ExitBlock();
return EC_IOError;
// Remove the old index file. It isn't relevant any more.
- llvm::sys::fs::remove(IndexPath.str());
+ llvm::sys::fs::remove(IndexPath);
// Rename the newly-written index file to the proper name.
- if (llvm::sys::fs::rename(IndexTmpPath.str(), IndexPath.str())) {
+ if (llvm::sys::fs::rename(IndexTmpPath, IndexPath)) {
// Rename failed; just remove the
- llvm::sys::fs::remove(IndexTmpPath.str());
+ llvm::sys::fs::remove(IndexTmpPath);
return EC_IOError;
}
os.flush();
BugReport *report =
new BugReport(*BT_null,
- buf.empty() ? BT_null->getDescription() : buf.str(),
+ buf.empty() ? BT_null->getDescription() : buf,
N);
bugreporter::trackNullOrUndefValue(N, bugreporter::getDerefExpr(S), *report);
llvm::raw_svector_ostream os(PropNameWithUnderscore);
os << '_' << PropName;
}
- if (IvarName == PropNameWithUnderscore.str())
+ if (IvarName == PropNameWithUnderscore)
return Iv;
}
llvm::sys::path::append(Model, Directory, "report-%%%%%%.html");
if (std::error_code EC =
- llvm::sys::fs::createUniqueFile(Model.str(), FD, ResultPath)) {
+ llvm::sys::fs::createUniqueFile(Model, FD, ResultPath)) {
llvm::errs() << "warning: could not create file in '" << Directory
<< "': " << EC.message() << '\n';
return;
<< "-" << i << ".html";
llvm::sys::path::append(Model, Directory,
filename.str());
- EC = llvm::sys::fs::openFileForWrite(Model.str(),
+ EC = llvm::sys::fs::openFileForWrite(Model,
FD,
llvm::sys::fs::F_RW |
llvm::sys::fs::F_Excl);
if (EC && EC != std::errc::file_exists) {
- llvm::errs() << "warning: could not create file '" << Model.str()
+ llvm::errs() << "warning: could not create file '" << Model
<< "': " << EC.message() << '\n';
return;
}
std::string Error;
llvm::raw_string_ostream ES(Error);
- StringRef Match = MatchTrie.findEquivalent(NativeFilePath.str(), ES);
+ StringRef Match = MatchTrie.findEquivalent(NativeFilePath, ES);
if (Match.empty())
return std::vector<CompileCommand>();
llvm::StringMap< std::vector<CompileCommandRef> >::const_iterator
SmallString<128> AbsolutePath(
Directory->getValue(DirectoryStorage));
llvm::sys::path::append(AbsolutePath, FileName);
- llvm::sys::path::native(AbsolutePath.str(), NativeFilePath);
+ llvm::sys::path::native(AbsolutePath, NativeFilePath);
} else {
llvm::sys::path::native(FileName, NativeFilePath);
}
IndexByFile[NativeFilePath].push_back(
CompileCommandRef(Directory, Command));
- MatchTrie.insert(NativeFilePath.str());
+ MatchTrie.insert(NativeFilePath);
}
return true;
}
Replacement += (*I)->ExplicitDef->getName();
Replacement += ">";
}
- SMFixIt FixIt(InGroupRange, Replacement.str());
+ SMFixIt FixIt(InGroupRange, Replacement);
SrcMgr.PrintMessage(NextDiagGroup->getLoc().front(),
SourceMgr::DK_Error,
~FileRemover() {
if (DeleteIt) {
// Ignore problems deleting the file.
- sys::fs::remove(Filename.str());
+ sys::fs::remove(Filename);
}
}
void setFile(const Twine& filename, bool deleteIt = true) {
if (DeleteIt) {
// Ignore problems deleting the file.
- sys::fs::remove(Filename.str());
+ sys::fs::remove(Filename);
}
Filename.clear();
}
CommentStream.flush();
- StringRef Comments = CommentToEmit.str();
+ StringRef Comments = CommentToEmit;
assert(Comments.back() == '\n' &&
"Comment array not newline terminated");
case MCFragment::FT_LEB: {
const MCLEBFragment &LF = cast<MCLEBFragment>(F);
- OW->WriteBytes(LF.getContents().str());
+ OW->WriteBytes(LF.getContents());
break;
}
case MCFragment::FT_Dwarf: {
const MCDwarfLineAddrFragment &OF = cast<MCDwarfLineAddrFragment>(F);
- OW->WriteBytes(OF.getContents().str());
+ OW->WriteBytes(OF.getContents());
break;
}
case MCFragment::FT_DwarfFrame: {
const MCDwarfCallFrameFragment &CF = cast<MCDwarfCallFrameFragment>(F);
- OW->WriteBytes(CF.getContents().str());
+ OW->WriteBytes(CF.getContents());
break;
}
}
Augmentation += "R";
if (IsSignalFrame)
Augmentation += "S";
- streamer.EmitBytes(Augmentation.str());
+ streamer.EmitBytes(Augmentation);
}
streamer.EmitIntValue(0, 1);
void APInt::print(raw_ostream &OS, bool isSigned) const {
SmallString<40> S;
this->toString(S, 10, isSigned, /* formatAsCLiteral = */false);
- OS << S.str();
+ OS << S;
}
// This implements a variety of operations on a representation of
UniqueLockFileName += "-%%%%%%%%";
int UniqueLockFileID;
if (std::error_code EC = sys::fs::createUniqueFile(
- UniqueLockFileName.str(), UniqueLockFileID, UniqueLockFileName)) {
+ UniqueLockFileName, UniqueLockFileID, UniqueLockFileName)) {
Error = EC;
return;
}
// We failed to write out PID, so make up an excuse, remove the
// unique lock file, and fail.
Error = make_error_code(errc::no_space_on_device);
- sys::fs::remove(UniqueLockFileName.c_str());
+ sys::fs::remove(UniqueLockFileName);
return;
}
}
while (1) {
// Create a link from the lock file name. If this succeeds, we're done.
std::error_code EC =
- sys::fs::create_link(UniqueLockFileName.str(), LockFileName.str());
+ sys::fs::create_link(UniqueLockFileName, LockFileName);
if (!EC)
return;
// from the lock file.
if ((Owner = readLockFile(LockFileName))) {
// Wipe out our unique lock file (it's useless now)
- sys::fs::remove(UniqueLockFileName.str());
+ sys::fs::remove(UniqueLockFileName);
return;
}
- if (!sys::fs::exists(LockFileName.str())) {
+ if (!sys::fs::exists(LockFileName)) {
// The previous owner released the lock file before we could read it.
// Try to get ownership again.
continue;
// There is a lock file that nobody owns; try to clean it up and get
// ownership.
- if ((EC = sys::fs::remove(LockFileName.str()))) {
+ if ((EC = sys::fs::remove(LockFileName))) {
Error = EC;
return;
}
return;
// Since we own the lock, remove the lock file and our own unique lock file.
- sys::fs::remove(LockFileName.str());
- sys::fs::remove(UniqueLockFileName.str());
+ sys::fs::remove(LockFileName);
+ sys::fs::remove(UniqueLockFileName);
}
LockFileManager::WaitForUnlockResult LockFileManager::waitForUnlock() {
if (sys::fs::access(LockFileName.c_str(), sys::fs::AccessMode::Exist) ==
errc::no_such_file_or_directory) {
// If the original file wasn't created, somone thought the lock was dead.
- if (!sys::fs::exists(FileName.str()))
+ if (!sys::fs::exists(FileName))
return Res_OwnerDied;
return Res_Success;
}
}
std::error_code LockFileManager::unsafeRemoveLockFile() {
- return sys::fs::remove(LockFileName.str());
+ return sys::fs::remove(LockFileName);
}
Triple += getVendorName();
Triple += "-";
Triple += getOSAndEnvironmentName();
- setTriple(Triple.str());
+ setTriple(Triple);
}
void Triple::setVendorName(StringRef Str) {
it.IterationHandle = intptr_t(FindHandle.take());
SmallString<128> directory_entry_path(path);
- path::append(directory_entry_path, directory_entry_name_utf8.str());
- it.CurrentEntry = directory_entry(directory_entry_path.str());
+ path::append(directory_entry_path, directory_entry_name_utf8);
+ it.CurrentEntry = directory_entry(directory_entry_path);
return std::error_code();
}
// overkill for now, though.
// Make sure the predicate is in the table.
- Decoders.insert(Decoder.str());
+ Decoders.insert(StringRef(Decoder));
// Now figure out the index for when we write out the table.
DecoderSet::const_iterator P = std::find(Decoders.begin(),
Decoders.end(),