[all-commits] [llvm/llvm-project] a76df7: [lldb] Make the NSSet formatter faster and less pr...
Raphael Isemann via All-commits
all-commits at lists.llvm.org
Thu Apr 29 10:14:28 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a76df78470d7994f73df0353225cbddc463cce63
https://github.com/llvm/llvm-project/commit/a76df78470d7994f73df0353225cbddc463cce63
Author: Raphael Isemann <teemperor at gmail.com>
Date: 2021-04-29 (Thu, 29 Apr 2021)
Changed paths:
M lldb/source/Plugins/Language/ObjC/NSSet.cpp
Log Message:
-----------
[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
More information about the All-commits
mailing list