llvm-project/lldb/source/Plugins/Language/ObjC
Adrian Prantl 6eaedbb52f Make CompilerType safe
When a process gets restarted TypeSystem objects associated with it
may get deleted, and any CompilerType objects holding on to a
reference to that type system are a use-after-free in waiting. Because
of the SBAPI, we don't have tight control over where CompilerTypes go
and when they are used. This is particularly a problem in the Swift
plugin, where the scratch TypeSystem can be restarted while the
process is still running. The Swift plugin has a lock to prevent
abuse, but where there's a lock there can be bugs.

This patch changes CompilerType to store a std::weak_ptr<TypeSystem>.
Most of the std::weak_ptr<TypeSystem>* uglyness is hidden by
introducing a wrapper class CompilerType::WrappedTypeSystem that has a
dyn_cast_or_null() method. The only sites that need to know about the
weak pointer implementation detail are the ones that deal with
creating TypeSystems.

rdar://101505232

Differential Revision: https://reviews.llvm.org/D136650
2022-11-16 15:51:26 -08:00
..
CF.cpp [lldb] Refactor DataBuffer so we can map files as read-only 2022-04-05 13:46:37 -07:00
CF.h
CFBasicHash.cpp
CFBasicHash.h [LLDB][NFC][Reliability] Fix uninitialized variables from Coverity scan 2022-07-20 14:50:48 -07:00
CMakeLists.txt
Cocoa.cpp [lldb] LLVM_FALLTHROUGH => [[fallthrough]]. NFC 2022-08-08 11:31:49 -07:00
Cocoa.h
CoreMedia.cpp Make CompilerType safe 2022-11-16 15:51:26 -08:00
CoreMedia.h
NSArray.cpp Make CompilerType safe 2022-11-16 15:51:26 -08:00
NSDictionary.cpp [LLDB][NFC] Fix incorrect return status Some functions always return 'false' for both success and fail return paths. 2022-08-02 15:56:23 -07:00
NSDictionary.h
NSError.cpp [LLDB][NFC][Reliability] Fix uninitialized variables from Coverity scan 2022-07-20 14:50:48 -07:00
NSException.cpp [LLDB] Replace use of double underscore in identifiers 2022-02-16 11:54:45 -08:00
NSIndexPath.cpp Make CompilerType safe 2022-11-16 15:51:26 -08:00
NSSet.cpp [LLDB][NFC] Fix incorrect return status Some functions always return 'false' for both success and fail return paths. 2022-08-02 15:56:23 -07:00
NSSet.h
NSString.cpp [lldb] Remove ProcessStructReader from NSStringSummaryProvider (NFC) 2022-01-09 12:09:02 -08:00
NSString.h
ObjCConstants.h
ObjCLanguage.cpp [lldb] Add matching based on Python callbacks for data formatters. 2022-10-19 12:53:38 -07:00
ObjCLanguage.h [lldb] Add matching based on Python callbacks for data formatters. 2022-10-19 12:53:38 -07:00