mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Syntax] Unify RawSyntax and RawTokenSyntax using union and TrailingObjects
It better matches with SwiftSyntax model. Using TrailingObjects reduces the number of heap allocation which gains 18% performance improvement.
This commit is contained in:
@@ -25,8 +25,7 @@ class Token;
|
||||
class DiagnosticEngine;
|
||||
|
||||
namespace syntax {
|
||||
struct RawTokenSyntax;
|
||||
struct RawSyntax;
|
||||
class RawSyntax;
|
||||
enum class SyntaxKind;
|
||||
|
||||
enum class SyntaxContextKind {
|
||||
@@ -201,7 +200,7 @@ public:
|
||||
|
||||
TokenSyntax popToken() {
|
||||
assert(Storage.size() > Offset);
|
||||
assert(Storage.back()->Kind == SyntaxKind::Token);
|
||||
assert(Storage.back()->getKind() == SyntaxKind::Token);
|
||||
auto Node = make<TokenSyntax>(std::move(Storage.back()));
|
||||
Storage.pop_back();
|
||||
return Node;
|
||||
|
||||
Reference in New Issue
Block a user