[llvm-branch-commits] [clang-tools-extra] ca64c89 - [NFC] SmallVector<char...> to SmallString<...>
Nathan James via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Nov 27 12:41:06 PST 2020
Author: Nathan James
Date: 2020-11-27T20:36:09Z
New Revision: ca64c8948f495ccdfb33f30675e72b7362b390ff
URL: https://github.com/llvm/llvm-project/commit/ca64c8948f495ccdfb33f30675e72b7362b390ff
DIFF: https://github.com/llvm/llvm-project/commit/ca64c8948f495ccdfb33f30675e72b7362b390ff.diff
LOG: [NFC] SmallVector<char...> to SmallString<...>
Added:
Modified:
clang-tools-extra/clang-move/Move.cpp
clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp
clang-tools-extra/clangd/tool/ClangdMain.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-move/Move.cpp b/clang-tools-extra/clang-move/Move.cpp
index 24f819ca4ca2..8e0ec0f73c4d 100644
--- a/clang-tools-extra/clang-move/Move.cpp
+++ b/clang-tools-extra/clang-move/Move.cpp
@@ -691,11 +691,10 @@ void ClangMoveTool::addIncludes(llvm::StringRef IncludeHeader, bool IsAngled,
llvm::StringRef FileName,
CharSourceRange IncludeFilenameRange,
const SourceManager &SM) {
- SmallVector<char, 128> HeaderWithSearchPath;
+ SmallString<128> HeaderWithSearchPath;
llvm::sys::path::append(HeaderWithSearchPath, SearchPath, IncludeHeader);
std::string AbsoluteIncludeHeader =
- MakeAbsolutePath(SM, llvm::StringRef(HeaderWithSearchPath.data(),
- HeaderWithSearchPath.size()));
+ MakeAbsolutePath(SM, HeaderWithSearchPath);
std::string IncludeLine =
IsAngled ? ("#include <" + IncludeHeader + ">\n").str()
: ("#include \"" + IncludeHeader + "\"\n").str();
diff --git a/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp b/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp
index f95b1c9cb2ad..43d2f6a69cd1 100644
--- a/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp
@@ -196,18 +196,16 @@ getParameterSourceDeclaration(const FunctionDecl *OriginalDeclaration) {
std::string joinParameterNames(
const DifferingParamsContainer &DifferingParams,
llvm::function_ref<StringRef(const DifferingParamInfo &)> ChooseParamName) {
- llvm::SmallVector<char, 40> Buffer;
- llvm::raw_svector_ostream Str(Buffer);
+ llvm::SmallString<40> Str;
bool First = true;
for (const DifferingParamInfo &ParamInfo : DifferingParams) {
if (First)
First = false;
else
- Str << ", ";
-
- Str << "'" << ChooseParamName(ParamInfo).str() << "'";
+ Str += ", ";
+ Str.append({"'", ChooseParamName(ParamInfo), "'"});
}
- return Str.str().str();
+ return std::string(Str);
}
void formatDifferingParamsDiagnostic(
diff --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp b/clang-tools-extra/clangd/tool/ClangdMain.cpp
index d0eab3650750..331241115302 100644
--- a/clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -529,10 +529,10 @@ class TestScheme : public URIScheme {
"Expect URI body to be an absolute path starting with '/': {0}",
Body);
Body = Body.ltrim('/');
- llvm::SmallVector<char, 16> Path(Body.begin(), Body.end());
+ llvm::SmallString<16> Path(Body);
path::native(Path);
fs::make_absolute(TestScheme::TestDir, Path);
- return std::string(Path.begin(), Path.end());
+ return std::string(Path);
}
llvm::Expected<URI>
More information about the llvm-branch-commits
mailing list