[clang-tools-extra] Use SmallString::operator std::string (NFC)

This commit is contained in:
Kazu Hirata 2024-01-26 23:46:24 -08:00
parent 6e6c506f3c
commit 2b00d449d2
8 changed files with 9 additions and 9 deletions

View File

@ -280,7 +280,7 @@ genStylesheetsHTML(StringRef InfoPath, const ClangDocContext &CDCtx) {
llvm::sys::path::filename(FilePath));
// Paths in HTML must be in posix-style
llvm::sys::path::native(StylesheetPath, llvm::sys::path::Style::posix);
LinkNode->Attributes.emplace_back("href", std::string(StylesheetPath.str()));
LinkNode->Attributes.emplace_back("href", std::string(StylesheetPath));
Out.emplace_back(std::move(LinkNode));
}
return Out;
@ -295,7 +295,7 @@ genJsScriptsHTML(StringRef InfoPath, const ClangDocContext &CDCtx) {
llvm::sys::path::append(ScriptPath, llvm::sys::path::filename(FilePath));
// Paths in HTML must be in posix-style
llvm::sys::path::native(ScriptPath, llvm::sys::path::Style::posix);
ScriptNode->Attributes.emplace_back("src", std::string(ScriptPath.str()));
ScriptNode->Attributes.emplace_back("src", std::string(ScriptPath));
Out.emplace_back(std::move(ScriptNode));
}
return Out;

View File

@ -377,7 +377,7 @@ ClangDocContext::ClangDocContext(tooling::ExecutionContext *ECtx,
if (SourceRoot.empty())
// If no SourceRoot was provided the current path is used as the default
llvm::sys::fs::current_path(SourceRootDir);
this->SourceRoot = std::string(SourceRootDir.str());
this->SourceRoot = std::string(SourceRootDir);
if (!RepositoryUrl.empty()) {
this->RepositoryUrl = std::string(RepositoryUrl);
if (!RepositoryUrl.empty() && RepositoryUrl.find("http://") != 0 &&

View File

@ -197,7 +197,7 @@ Example usage for a project using a compile commands database:
llvm::sys::path::native(AssetsPath, IndexJS);
llvm::sys::path::append(IndexJS, "index.js");
CDCtx.UserStylesheets.insert(CDCtx.UserStylesheets.begin(),
std::string(DefaultStylesheet.str()));
std::string(DefaultStylesheet));
CDCtx.FilesToCopy.emplace_back(IndexJS.str());
}

View File

@ -35,7 +35,7 @@ std::string getIncludePath(const SourceManager &SM, SourceLocation Loc,
SmallString<256> CleanedFilePath = FilePath;
llvm::sys::path::remove_dots(CleanedFilePath, /*remove_dot_dot=*/false);
return std::string(CleanedFilePath.str());
return std::string(CleanedFilePath);
}
} // namespace find_all_symbols

View File

@ -65,7 +65,7 @@ std::string CleanPath(StringRef PathRef) {
llvm::sys::path::remove_dots(Path, /*remove_dot_dot=*/true);
// FIXME: figure out why this is necessary.
llvm::sys::path::native(Path);
return std::string(Path.str());
return std::string(Path);
}
// Make the Path absolute using the CurrentDir if the Path is not an absolute

View File

@ -131,7 +131,7 @@ int main(int argc, const char **argv) {
Twine(EC.message()));
move::ClangMoveContext Context{Spec, Tool.getReplacements(),
std::string(InitialDirectory.str()), Style,
std::string(InitialDirectory), Style,
DumpDecls};
move::DeclarationReporter Reporter;
move::ClangMoveActionFactory Factory(&Context, &Reporter);

View File

@ -19,7 +19,7 @@ namespace clang::tidy::utils {
static std::string cleanPath(StringRef Path) {
SmallString<256> Result = Path;
llvm::sys::path::remove_dots(Result, true);
return std::string(Result.str());
return std::string(Result);
}
namespace {

View File

@ -487,7 +487,7 @@ std::string ModularizeUtilities::getDirectoryFromPath(StringRef Path) {
sys::path::remove_filename(Directory);
if (Directory.size() == 0)
return ".";
return std::string(Directory.str());
return std::string(Directory);
}
// Add unique problem file.