Skip to content

Commit dfad6f7

Browse files
committed
[Basic] Extract isEditorPlaceholder from Identifier to standalone function
1 parent 3045067 commit dfad6f7

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

include/swift/AST/Identifier.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#ifndef SWIFT_AST_IDENTIFIER_H
1818
#define SWIFT_AST_IDENTIFIER_H
1919

20+
#include "swift/Basic/EditorPlaceholder.h"
2021
#include "swift/Basic/LLVM.h"
2122
#include "llvm/ADT/FoldingSet.h"
2223
#include "llvm/ADT/PointerUnion.h"
@@ -125,7 +126,7 @@ class Identifier {
125126
}
126127

127128
static bool isEditorPlaceholder(StringRef name) {
128-
return name.startswith("<#");
129+
return swift::isEditorPlaceholder(name);
129130
}
130131

131132
bool isEditorPlaceholder() const {

include/swift/Basic/EditorPlaceholder.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ struct EditorPlaceholderData {
4646
Optional<EditorPlaceholderData>
4747
parseEditorPlaceholder(StringRef PlaceholderText);
4848

49+
/// Checks if an identifier with the given text is an editor placeholder
50+
bool isEditorPlaceholder(StringRef IdentifierText);
4951
} // end namespace swift
5052

5153
#endif // SWIFT_BASIC_EDITORPLACEHOLDER_H

lib/Basic/EditorPlaceholder.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,7 @@ swift::parseEditorPlaceholder(StringRef PlaceholderText) {
7878

7979
return PHDataTyped;
8080
}
81+
82+
bool swift::isEditorPlaceholder(StringRef IdentifierText) {
83+
return IdentifierText.startswith("<#");
84+
}

0 commit comments

Comments
 (0)