mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Basic] Move copyCString to Basic/StringExtras.
Also, use StringRef.copy() instead of copyString().
This commit is contained in:
@@ -760,7 +760,7 @@ static StringRef getModuleName(const ValueDecl *VD,
|
||||
static_cast<ClangImporter *>(Ctx.getClangModuleLoader());
|
||||
if (auto ClangNode = VD->getClangNode()) {
|
||||
if (const auto *ClangMod = Importer->getClangOwningModule(ClangNode))
|
||||
return copyString(Allocator, ClangMod->getFullModuleName());
|
||||
return StringRef(ClangMod->getFullModuleName()).copy(Allocator);
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -824,7 +824,7 @@ struct DeclInfo {
|
||||
|
||||
static StringRef copyAndClearString(llvm::BumpPtrAllocator &Allocator,
|
||||
SmallVectorImpl<char> &Str) {
|
||||
auto Ref = copyString(Allocator, StringRef(Str.data(), Str.size()));
|
||||
auto Ref = StringRef(Str.data(), Str.size()).copy(Allocator);
|
||||
Str.clear();
|
||||
return Ref;
|
||||
}
|
||||
@@ -998,7 +998,7 @@ fillSymbolInfo(CursorSymbolInfo &Symbol, const DeclInfo &DInfo,
|
||||
SmallVector<ParentInfo, 4> Parents;
|
||||
for (auto &Component : PathComponents) {
|
||||
SwiftLangSupport::printUSR(Component.VD, OS);
|
||||
Parents.emplace_back(copyString(Allocator, Component.Title),
|
||||
Parents.emplace_back(Component.Title.str().copy(Allocator),
|
||||
Component.Kind,
|
||||
copyAndClearString(Allocator, Buffer));
|
||||
};
|
||||
@@ -1009,7 +1009,7 @@ fillSymbolInfo(CursorSymbolInfo &Symbol, const DeclInfo &DInfo,
|
||||
SmallVector<ParentInfo, 4> FIParents;
|
||||
for (auto &Component: FI.ParentContexts) {
|
||||
SwiftLangSupport::printUSR(Component.VD, OS);
|
||||
FIParents.emplace_back(copyString(Allocator, Component.Title),
|
||||
FIParents.emplace_back(Component.Title.str().copy(Allocator),
|
||||
Component.Kind,
|
||||
copyAndClearString(Allocator, Buffer));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user