Skip to content

Commit cfc7210

Browse files
committed
Revert "Fix use-after-free"
This reverts commit 1f06149.
1 parent 1f06149 commit cfc7210

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lldb/include/lldb/Symbol/SwiftASTContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1228,7 +1228,7 @@ class SwiftASTContext : public TypeSystemSwift {
12281228
void RemapClangImporterOptions(const PathMappingList &path_map);
12291229

12301230
/// Infer the appropriate Swift resource directory for a target triple.
1231-
std::string GetResourceDir(const llvm::Triple &target);
1231+
llvm::StringRef GetResourceDir(const llvm::Triple &target);
12321232

12331233
/// Implementation of \c GetResourceDir.
12341234
static std::string GetResourceDir(llvm::StringRef platform_sdk_path,

lldb/source/Symbol/SwiftASTContext.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ StringRef SwiftASTContext::GetSwiftStdlibOSDir(const llvm::Triple &target,
10061006
return target.getOSName();
10071007
}
10081008

1009-
std::string SwiftASTContext::GetResourceDir(const llvm::Triple &triple) {
1009+
StringRef SwiftASTContext::GetResourceDir(const llvm::Triple &triple) {
10101010
static std::mutex g_mutex;
10111011
std::lock_guard<std::mutex> locker(g_mutex);
10121012
StringRef platform_sdk_path = GetPlatformSDKPath();
@@ -1706,7 +1706,7 @@ lldb::TypeSystemSP SwiftASTContext::CreateInstance(lldb::LanguageType language,
17061706
}
17071707

17081708
triple = swift_ast_sp->GetTriple();
1709-
std::string resource_dir = swift_ast_sp->GetResourceDir(triple);
1709+
StringRef resource_dir = swift_ast_sp->GetResourceDir(triple);
17101710
ConfigureResourceDirs(swift_ast_sp->GetCompilerInvocation(),
17111711
FileSpec(resource_dir), triple);
17121712

@@ -2014,7 +2014,7 @@ lldb::TypeSystemSP SwiftASTContext::CreateInstance(lldb::LanguageType language,
20142014
}
20152015

20162016
llvm::Triple triple = swift_ast_sp->GetTriple();
2017-
std::string resource_dir = swift_ast_sp->GetResourceDir(triple);
2017+
StringRef resource_dir = swift_ast_sp->GetResourceDir(triple);
20182018
ConfigureResourceDirs(swift_ast_sp->GetCompilerInvocation(),
20192019
FileSpec(resource_dir), triple);
20202020

@@ -2679,7 +2679,7 @@ void SwiftASTContext::InitializeSearchPathOptions(
26792679
}
26802680

26812681
llvm::Triple triple(GetTriple());
2682-
std::string resource_dir = GetResourceDir(triple);
2682+
StringRef resource_dir = GetResourceDir(triple);
26832683
ConfigureResourceDirs(GetCompilerInvocation(), FileSpec(resource_dir),
26842684
triple);
26852685

@@ -3437,7 +3437,7 @@ swift::ASTContext *SwiftASTContext::GetASTContext() {
34373437
// Compute the prebuilt module cache path to use:
34383438
// <resource-dir>/<platform>/prebuilt-modules
34393439
llvm::Triple triple(GetTriple());
3440-
llvm::SmallString<128> prebuiltModuleCachePath(GetResourceDir(triple));
3440+
llvm::SmallString<128> prebuiltModuleCachePath = GetResourceDir(triple);
34413441
StringRef platform;
34423442
if (swift::tripleIsMacCatalystEnvironment(triple)) {
34433443
// The prebuilt cache for macCatalyst is the same as the one for macOS,

0 commit comments

Comments
 (0)