[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:
Alex Hoppen
2021-02-25 21:02:11 +01:00
parent 68877f987f
commit 56a923475f
11 changed files with 85 additions and 110 deletions

View File

@@ -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()); }