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/InitHeaderSearch.cpp | |
parent | 4a7baeab14a9f991752879bdc85ad4bf684cdf46 (diff) | |
download | bcm5719-llvm-92e1b62d45aa5a3cbd67eaf5903165d7d8efeada.tar.gz bcm5719-llvm-92e1b62d45aa5a3cbd67eaf5903165d7d8efeada.zip |
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/InitHeaderSearch.cpp')
-rw-r--r-- | clang/lib/Frontend/InitHeaderSearch.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/clang/lib/Frontend/InitHeaderSearch.cpp b/clang/lib/Frontend/InitHeaderSearch.cpp index c4d46853b93..9b4f7e5180c 100644 --- a/clang/lib/Frontend/InitHeaderSearch.cpp +++ b/clang/lib/Frontend/InitHeaderSearch.cpp @@ -247,7 +247,7 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple, // 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 @@ -275,7 +275,7 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple, // <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; } @@ -326,18 +326,18 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple, // <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); @@ -503,7 +503,7 @@ void InitHeaderSearch::AddDefaultIncludePaths(const LangOptions &Lang, // 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 @@ -714,7 +714,7 @@ void clang::ApplyHeaderSearchOptions(HeaderSearch &HS, // 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); } |