[clangd] Use SmallString::operator std::string (NFC)
This commit is contained in:
parent
196a71ec4b
commit
5b2772e1fa
@ -82,7 +82,7 @@ std::string resolve(std::string Path) {
|
||||
log("Failed to resolve possible symlink {0}", Path);
|
||||
return Path;
|
||||
}
|
||||
return std::string(Resolved.str());
|
||||
return std::string(Resolved);
|
||||
}
|
||||
|
||||
// Get a plausible full `clang` path.
|
||||
@ -114,7 +114,7 @@ std::string detectClangPath() {
|
||||
SmallString<128> ClangPath;
|
||||
ClangPath = llvm::sys::path::parent_path(ClangdExecutable);
|
||||
llvm::sys::path::append(ClangPath, "clang");
|
||||
return std::string(ClangPath.str());
|
||||
return std::string(ClangPath);
|
||||
}
|
||||
|
||||
// On mac, /usr/bin/clang sets SDKROOT and then invokes the real clang.
|
||||
|
||||
@ -663,7 +663,7 @@ static void fillNonLocationData(DiagnosticsEngine::Level DiagLevel,
|
||||
llvm::SmallString<64> Message;
|
||||
Info.FormatDiagnostic(Message);
|
||||
|
||||
D.Message = std::string(Message.str());
|
||||
D.Message = std::string(Message);
|
||||
D.Severity = DiagLevel;
|
||||
D.Category = DiagnosticIDs::getCategoryNameFromID(
|
||||
DiagnosticIDs::getCategoryNumberForDiag(Info.getID()))
|
||||
@ -798,7 +798,7 @@ void StoreDiags::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
|
||||
if (Message.empty()) // either !SyntheticMessage, or we failed to make one.
|
||||
Info.FormatDiagnostic(Message);
|
||||
LastDiag->Fixes.push_back(
|
||||
Fix{std::string(Message.str()), std::move(Edits), {}});
|
||||
Fix{std::string(Message), std::move(Edits), {}});
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
@ -71,7 +71,7 @@ std::optional<OpaqueType> OpaqueType::encode(ASTContext &Ctx, QualType T) {
|
||||
llvm::SmallString<128> Encoded;
|
||||
if (index::generateUSRForType(QualType(C, 0), Ctx, Encoded))
|
||||
return std::nullopt;
|
||||
return OpaqueType(std::string(Encoded.str()));
|
||||
return OpaqueType(std::string(Encoded));
|
||||
}
|
||||
|
||||
OpaqueType::OpaqueType(std::string Data) : Data(std::move(Data)) {}
|
||||
|
||||
@ -20,7 +20,7 @@ PreambleFileStatusCache::PreambleFileStatusCache(llvm::StringRef MainFilePath){
|
||||
assert(llvm::sys::path::is_absolute(MainFilePath));
|
||||
llvm::SmallString<256> MainFileCanonical(MainFilePath);
|
||||
llvm::sys::path::remove_dots(MainFileCanonical, /*remove_dot_dot=*/true);
|
||||
this->MainFilePath = std::string(MainFileCanonical.str());
|
||||
this->MainFilePath = std::string(MainFileCanonical);
|
||||
}
|
||||
|
||||
void PreambleFileStatusCache::update(const llvm::vfs::FileSystem &FS,
|
||||
|
||||
@ -1619,7 +1619,7 @@ std::vector<SymbolDetails> getSymbolInfo(ParsedAST &AST, Position Pos) {
|
||||
}
|
||||
llvm::SmallString<32> USR;
|
||||
if (!index::generateUSRForDecl(D, USR)) {
|
||||
NewSymbol.USR = std::string(USR.str());
|
||||
NewSymbol.USR = std::string(USR);
|
||||
NewSymbol.ID = SymbolID(NewSymbol.USR);
|
||||
}
|
||||
if (const NamedDecl *Def = getDefinition(D))
|
||||
@ -1642,7 +1642,7 @@ std::vector<SymbolDetails> getSymbolInfo(ParsedAST &AST, Position Pos) {
|
||||
llvm::SmallString<32> USR;
|
||||
if (!index::generateUSRForMacro(NewMacro.name, M->Info->getDefinitionLoc(),
|
||||
SM, USR)) {
|
||||
NewMacro.USR = std::string(USR.str());
|
||||
NewMacro.USR = std::string(USR);
|
||||
NewMacro.ID = SymbolID(NewMacro.USR);
|
||||
}
|
||||
Results.push_back(std::move(NewMacro));
|
||||
|
||||
@ -30,7 +30,7 @@ std::string getShardPathFromFilePath(llvm::StringRef ShardRoot,
|
||||
llvm::sys::path::append(ShardRootSS, llvm::sys::path::filename(FilePath) +
|
||||
"." + llvm::toHex(digest(FilePath)) +
|
||||
".idx");
|
||||
return std::string(ShardRootSS.str());
|
||||
return std::string(ShardRootSS);
|
||||
}
|
||||
|
||||
// Uses disk as a storage for index shards.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user