Skip to content

Commit 6784575

Browse files
committed
Introduce a special LLDB-only way to prepend decls
SwiftASTManipulator is installing declarations in the wrong order, and currently fails a REPL test if the right API is used. rdar://58355191 is tracking the removal of this entrypoint.
1 parent 96b3b9f commit 6784575

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

include/swift/AST/SourceFile.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,16 @@ class SourceFile final : public FileUnit {
137137
Decls.push_back(d);
138138
}
139139

140+
/// Prepends a declaration to the top-level decls list.
141+
///
142+
/// FIXME: This entrypoint exists to support LLDB. Calls to this function are
143+
/// always a mistake, and additional uses should not be added.
144+
///
145+
/// See rdar://58355191
146+
void prependTopLevelDecl(Decl *d) {
147+
Decls.insert(Decls.begin(), d);
148+
}
149+
140150
/// Retrieves an immutable view of the list of top-level decls in this file.
141151
ArrayRef<Decl *> getTopLevelDecls() const {
142152
return Decls;

0 commit comments

Comments
 (0)