Skip to content

Commit 50d0b45

Browse files
Merge pull request #4082 from adrian-prantl/89836973-reject-list
Add more system paths to the reject list.
2 parents 305475e + 3061498 commit 50d0b45

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -875,22 +875,22 @@ SwiftASTContextSupportsLanguage(lldb::LanguageType language) {
875875
return language == eLanguageTypeSwift;
876876
}
877877

878-
static bool IsDeviceSupport(const char *path) {
878+
static bool IsDeviceSupport(StringRef path) {
879879
// The old-style check, which we preserve for safety.
880-
if (path && strstr(path, "iOS DeviceSupport"))
880+
if (path.contains("iOS DeviceSupport"))
881881
return true;
882882

883883
// The new-style check, which should cover more devices.
884-
if (path)
885-
if (const char *Developer_Xcode = strstr(path, "Developer"))
886-
if (const char *DeviceSupport = strstr(Developer_Xcode, "DeviceSupport"))
887-
if (strstr(DeviceSupport, "Symbols"))
888-
return true;
884+
StringRef Developer = path.substr(path.find("Developer"));
885+
StringRef DeviceSupport =
886+
Developer.substr(Developer.find("DeviceSupport"));
887+
if (DeviceSupport.contains("Symbols"))
888+
return true;
889889

890890
// Don't look in the simulator runtime frameworks either. They
891891
// either duplicate what the SDK has, or for older simulators
892892
// conflict with them.
893-
if (path && strstr(path, ".simruntime/Contents/Resources/"))
893+
if (path.contains(".simruntime/Contents/Resources/"))
894894
return true;
895895

896896
return false;
@@ -2012,13 +2012,14 @@ ProcessModule(ModuleSP module_sp, std::string m_description,
20122012
// framework_offset now points to the '/';
20132013

20142014
std::string parent_path = module_path.substr(0, framework_offset);
2015-
2016-
// Never add framework paths pointing into the
2017-
// system. These modules must be imported from the
2018-
// SDK instead.
2019-
if (!StringRef(parent_path).startswith("/System/Library") &&
2020-
!IsDeviceSupport(parent_path.c_str())) {
2021-
LOG_PRINTF(GetLog(LLDBLog::Types), "adding framework path \"%s\".",
2015+
StringRef p(parent_path);
2016+
2017+
// Never add framework paths pointing into the system. These
2018+
// modules must be imported from the SDK instead.
2019+
if (!p.startswith("/System/Library") && !IsDeviceSupport(p) &&
2020+
!p.startswith(
2021+
"/Library/Apple/System/Library/PrivateFrameworks")) {
2022+
LOG_PRINTF(GetLog(LLDBLog::Types), "adding framework path \"%s\"/.. .",
20222023
framework_path.c_str());
20232024
framework_search_paths.push_back(
20242025
{std::move(parent_path), /*system*/ false});

0 commit comments

Comments
 (0)