diff options
author | Yaron Keren <yaron.keren@gmail.com> | 2015-03-18 10:17:07 +0000 |
---|---|---|
committer | Yaron Keren <yaron.keren@gmail.com> | 2015-03-18 10:17:07 +0000 |
commit | 92e1b62d45aa5a3cbd67eaf5903165d7d8efeada (patch) | |
tree | 1444da86136cbaaadf6bf12dd03c51eda0f728a3 /clang/lib/Frontend/CompilerInstance.cpp | |
parent | 4a7baeab14a9f991752879bdc85ad4bf684cdf46 (diff) | |
download | llvm-92e1b62d45aa5a3cbd67eaf5903165d7d8efeada.zip llvm-92e1b62d45aa5a3cbd67eaf5903165d7d8efeada.tar.gz llvm-92e1b62d45aa5a3cbd67eaf5903165d7d8efeada.tar.bz2 |
Remove many superfluous SmallString::str() calls.
Now that SmallString is a first-class citizen, most SmallString::str()
calls are not required. This patch removes a whole bunch of them, yet
there are lots more.
There are two use cases where str() is really needed:
1) To use one of StringRef member functions which is not available in
SmallString.
2) To convert to std::string, as StringRef implicitly converts while
SmallString do not. We may wish to change this, but it may introduce
ambiguity.
llvm-svn: 232622
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index ee8c403..b23baa5 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -536,7 +536,7 @@ void CompilerInstance::clearOutputFiles(bool EraseFiles) { // 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(); @@ -641,14 +641,14 @@ llvm::raw_fd_ostream *CompilerInstance::createOutputFile( 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); } } @@ -1191,8 +1191,7 @@ static void pruneModuleCache(const HeaderSearchOptions &HSOpts) { 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())) |