Skip to content

Commit 2ec16f0

Browse files
committed
[Syntax] Make getRaw() return const reference
This saves reference-counting operations.
1 parent 8a03e08 commit 2ec16f0

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

include/swift/Syntax/Syntax.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class Syntax {
8282
SyntaxKind getKind() const;
8383

8484
/// Get the shared raw syntax.
85-
RC<RawSyntax> getRaw() const;
85+
const RC<RawSyntax> &getRaw() const;
8686

8787
/// Get an ID for this node that is stable across incremental parses
8888
SyntaxNodeId getId() const { return getRaw()->getId(); }

include/swift/Syntax/SyntaxData.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class SyntaxData final
182182
CursorIndex IndexInParent = 0);
183183

184184
/// Returns the raw syntax node for this syntax node.
185-
const RC<RawSyntax> getRaw() const {
185+
const RC<RawSyntax> &getRaw() const {
186186
return Raw;
187187
}
188188

lib/Syntax/Syntax.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
using namespace swift;
1818
using namespace swift::syntax;
1919

20-
RC<RawSyntax> Syntax::getRaw() const {
20+
const RC<RawSyntax> &Syntax::getRaw() const {
2121
return Data->getRaw();
2222
}
2323

0 commit comments

Comments
 (0)