llvm-project/lldb/source/Plugins/Language/ObjC
Raphael Isemann a76df78470 [lldb] Make the NSSet formatter faster and less prone to infinite recursion
Right now to get the 'NSSet *` pointer value we first derefence it and then take
the address of the result.

Beside being inefficient this potentially can cause an infinite recursion if the
`pointer` value we get is a pointer of a type that the TypeSystem can't
derefence. If the pointer is for example some form of `void *` that the dynamic
type resolution can't resolve to an actual type, then the `Derefence` call goes
back to asking the formatters how to reference it. If the NSSet formatter then
checks if it's an NSSet variation under the hood then we just end infinitely
often recursion.

In practice this seems to happen with some form of Builtin.RawPointer we get
from a NSDictionary in Swift.

FWIW, no other formatter is doing the same deref->addressOf as here and there
doesn't seem to be any specific reason to do so in the git history (it's just
part of the initial formatter commit)

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D101537
2021-04-29 19:13:43 +02:00
..
CF.cpp [lldb] Fix NSDate test after Scalar change 2020-07-01 16:00:10 +02:00
CF.h [lldb] Update header guards to be consistent and compliant with LLVM (NFC) 2020-02-17 23:15:40 -08:00
CFBasicHash.cpp [lldb/Dataformatter] Add support for CoreFoundation Dictionaries and Sets. 2020-04-27 22:10:11 +02:00
CFBasicHash.h [lldb] Remove redundant access specifiers (NFC) 2020-06-15 21:34:13 -07:00
CMakeLists.txt [lldb/Dataformatter] Add support for CoreFoundation Dictionaries and Sets. 2020-04-27 22:10:11 +02:00
Cocoa.cpp [lldb] Format Plugins/Language/ObjC/Cocoa.cpp (NFC) 2021-04-06 09:47:46 -07:00
Cocoa.h [lldb] Update header guards to be consistent and compliant with LLVM (NFC) 2020-02-17 23:15:40 -08:00
CoreMedia.cpp [lldb] Remove assumption from Clang-based data formatters that their types are in the scratch AST 2020-12-10 17:35:03 +01:00
CoreMedia.h [lldb] Update header guards to be consistent and compliant with LLVM (NFC) 2020-02-17 23:15:40 -08:00
NSArray.cpp [lldb][NFC] Rename TypeSystemClang::GetScratch to ScratchTypeSystemClang::GetForTarget 2020-12-04 11:29:08 +01:00
NSDictionary.cpp [lldb][NFC] Rename TypeSystemClang::GetScratch to ScratchTypeSystemClang::GetForTarget 2020-12-04 11:29:08 +01:00
NSDictionary.h [lldb/Dataformatter] Add support for CoreFoundation Dictionaries and Sets. 2020-04-27 22:10:11 +02:00
NSError.cpp [lldb][NFC] Rename TypeSystemClang::GetScratch to ScratchTypeSystemClang::GetForTarget 2020-12-04 11:29:08 +01:00
NSException.cpp [lldb][NFC] Rename TypeSystemClang::GetScratch to ScratchTypeSystemClang::GetForTarget 2020-12-04 11:29:08 +01:00
NSIndexPath.cpp [lldb][NFC] Rename TypeSystemClang::GetScratch to ScratchTypeSystemClang::GetForTarget 2020-12-04 11:29:08 +01:00
NSSet.cpp [lldb] Make the NSSet formatter faster and less prone to infinite recursion 2021-04-29 19:13:43 +02:00
NSSet.h [lldb] Update header guards to be consistent and compliant with LLVM (NFC) 2020-02-17 23:15:40 -08:00
NSString.cpp [lldb][NFC] Rename TypeSystemClang::GetScratch to ScratchTypeSystemClang::GetForTarget 2020-12-04 11:29:08 +01:00
NSString.h [lldb] Update header guards to be consistent and compliant with LLVM (NFC) 2020-02-17 23:15:40 -08:00
ObjCLanguage.cpp [lldb/Dataformatter] Add support to CF{Dictionary,Set}Ref types 2020-05-15 22:14:39 +02:00
ObjCLanguage.h [lldb/DataFormatters] Display null C++ pointers as nullptr 2020-11-12 15:24:06 -08:00