mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[libSyntax] Reference count SyntaxData
Instead of having a heap-allocated RefCountedBox to store a SyntaxData's parent, reference-count SyntaxData itself. This has a couple of advantages: - When passing SyntaxData around, only a pointer needs to be passed instead of the entire struct contents. This is faster. - We can later introduce a SyntaxDataRef, which behaves similar to SyntaxData, but delegates the responsibility that the parent stays alive to the user. While sacrificing guaranteed memory safety, this means that SyntaxData can then be stack-allocated without any ref-counting overhead.
This commit is contained in:
@@ -16,4 +16,4 @@
|
||||
using namespace swift;
|
||||
using namespace swift::syntax;
|
||||
|
||||
void UnknownSyntax::validate() const { assert(Data.getRaw()->isUnknown()); }
|
||||
void UnknownSyntax::validate() const { assert(Data->getRaw()->isUnknown()); }
|
||||
|
||||
Reference in New Issue
Block a user