Skip to content

Commit 7e27d99

Browse files
committed
[Parse] Remove 'Flags' from 'PersistentParserState'
This is not used anymore.
1 parent 5862d34 commit 7e27d99

File tree

5 files changed

+17
-26
lines changed

5 files changed

+17
-26
lines changed

include/swift/Parse/Parser.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -953,8 +953,7 @@ class Parser {
953953
/// Options that control the parsing of declarations.
954954
using ParseDeclOptions = OptionSet<ParseDeclFlags>;
955955

956-
void consumeDecl(ParserPosition BeginParserPosition, ParseDeclOptions Flags,
957-
bool IsTopLevel);
956+
void consumeDecl(ParserPosition BeginParserPosition, bool IsTopLevel);
958957

959958
ParserResult<Decl> parseDecl(bool IsAtStartOfLineOrPreviousHadSemi,
960959
bool IfConfigsAreDeclAttrs,

include/swift/Parse/PersistentParserState.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,17 @@ enum class IDEInspectionDelayedDeclKind {
3434
class IDEInspectionDelayedDeclState {
3535
public:
3636
IDEInspectionDelayedDeclKind Kind;
37-
unsigned Flags;
3837
DeclContext *ParentContext;
3938
unsigned StartOffset;
4039
unsigned EndOffset;
4140
unsigned PrevOffset;
4241

4342
IDEInspectionDelayedDeclState(IDEInspectionDelayedDeclKind Kind,
44-
unsigned Flags, DeclContext *ParentContext,
43+
DeclContext *ParentContext,
4544
unsigned StartOffset, unsigned EndOffset,
4645
unsigned PrevOffset)
47-
: Kind(Kind), Flags(Flags), ParentContext(ParentContext),
48-
StartOffset(StartOffset), EndOffset(EndOffset), PrevOffset(PrevOffset) {
49-
}
46+
: Kind(Kind), ParentContext(ParentContext), StartOffset(StartOffset),
47+
EndOffset(EndOffset), PrevOffset(PrevOffset) {}
5048
};
5149

5250
/// Parser state persistent across multiple parses.
@@ -60,7 +58,6 @@ class PersistentParserState {
6058

6159
void setIDEInspectionDelayedDeclState(SourceManager &SM, unsigned BufferID,
6260
IDEInspectionDelayedDeclKind Kind,
63-
unsigned Flags,
6461
DeclContext *ParentContext,
6562
SourceRange BodyRange,
6663
SourceLoc PreviousLoc);

lib/Parse/ParseDecl.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5695,9 +5695,7 @@ bool Parser::isStartOfFreestandingMacroExpansion() {
56955695
return false;
56965696
}
56975697

5698-
void Parser::consumeDecl(ParserPosition BeginParserPosition,
5699-
ParseDeclOptions Flags,
5700-
bool IsTopLevel) {
5698+
void Parser::consumeDecl(ParserPosition BeginParserPosition, bool IsTopLevel) {
57015699
SourceLoc CurrentLoc = Tok.getLoc();
57025700

57035701
SourceLoc EndLoc = PreviousLoc;
@@ -5706,8 +5704,7 @@ void Parser::consumeDecl(ParserPosition BeginParserPosition,
57065704

57075705
State->setIDEInspectionDelayedDeclState(
57085706
SourceMgr, L->getBufferID(), IDEInspectionDelayedDeclKind::Decl,
5709-
Flags.toRaw(), CurDeclContext, {BeginLoc, EndLoc},
5710-
BeginParserPosition.PreviousLoc);
5707+
CurDeclContext, {BeginLoc, EndLoc}, BeginParserPosition.PreviousLoc);
57115708

57125709
while (SourceMgr.isBeforeInBuffer(Tok.getLoc(), CurrentLoc))
57135710
consumeToken();
@@ -5823,8 +5820,7 @@ ParserResult<Decl> Parser::parseDecl(bool IsAtStartOfLineOrPreviousHadSemi,
58235820
}
58245821
});
58255822
if (IfConfigResult.hasCodeCompletion() && isIDEInspectionFirstPass()) {
5826-
consumeDecl(BeginParserPosition, Flags,
5827-
CurDeclContext->isModuleScopeContext());
5823+
consumeDecl(BeginParserPosition, CurDeclContext->isModuleScopeContext());
58285824
return makeParserError();
58295825
}
58305826

@@ -6165,7 +6161,7 @@ ParserResult<Decl> Parser::parseDecl(bool IsAtStartOfLineOrPreviousHadSemi,
61656161
!isa<TopLevelCodeDecl>(CurDeclContext) &&
61666162
!isa<AbstractClosureExpr>(CurDeclContext)) {
61676163
// Only consume non-toplevel decls.
6168-
consumeDecl(BeginParserPosition, Flags, /*IsTopLevel=*/false);
6164+
consumeDecl(BeginParserPosition, /*IsTopLevel=*/false);
61696165

61706166
return makeParserError();
61716167
}
@@ -8903,7 +8899,7 @@ void Parser::parseAbstractFunctionBody(AbstractFunctionDecl *AFD) {
89038899
State->takeIDEInspectionDelayedDeclState();
89048900
State->setIDEInspectionDelayedDeclState(
89058901
SourceMgr, L->getBufferID(), IDEInspectionDelayedDeclKind::FunctionBody,
8906-
PD_Default, AFD, BodyRange, BodyPreviousLoc);
8902+
AFD, BodyRange, BodyPreviousLoc);
89078903
};
89088904

89098905
bool HasNestedTypeDeclarations;

lib/Parse/ParseStmt.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,8 @@ void Parser::consumeTopLevelDecl(ParserPosition BeginParserPosition,
275275
SourceLoc BeginLoc = Tok.getLoc();
276276
State->setIDEInspectionDelayedDeclState(
277277
SourceMgr, L->getBufferID(),
278-
IDEInspectionDelayedDeclKind::TopLevelCodeDecl,
279-
PD_Default, TLCD, {BeginLoc, EndLoc}, BeginParserPosition.PreviousLoc);
278+
IDEInspectionDelayedDeclKind::TopLevelCodeDecl, TLCD, {BeginLoc, EndLoc},
279+
BeginParserPosition.PreviousLoc);
280280

281281
// Skip the rest of the file to prevent the parser from constructing the AST
282282
// for it. Forward references are not allowed at the top level.
@@ -376,7 +376,7 @@ ParserStatus Parser::parseBraceItems(SmallVectorImpl<ASTNode> &Entries,
376376
IsFollowingGuard);
377377
});
378378
if (IfConfigResult.hasCodeCompletion() && isIDEInspectionFirstPass()) {
379-
consumeDecl(BeginParserPosition, llvm::None, IsTopLevel);
379+
consumeDecl(BeginParserPosition, IsTopLevel);
380380
return IfConfigResult;
381381
}
382382
BraceItemsStatus |= IfConfigResult;
@@ -426,7 +426,7 @@ ParserStatus Parser::parseBraceItems(SmallVectorImpl<ASTNode> &Entries,
426426
NeedParseErrorRecovery = true;
427427
if (DeclResult.hasCodeCompletion() && IsTopLevel &&
428428
isIDEInspectionFirstPass()) {
429-
consumeDecl(BeginParserPosition, llvm::None, IsTopLevel);
429+
consumeDecl(BeginParserPosition, IsTopLevel);
430430
return DeclResult;
431431
}
432432
}

lib/Parse/PersistentParserState.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ PersistentParserState::~PersistentParserState() { }
2828

2929
void PersistentParserState::setIDEInspectionDelayedDeclState(
3030
SourceManager &SM, unsigned BufferID, IDEInspectionDelayedDeclKind Kind,
31-
unsigned Flags, DeclContext *ParentContext, SourceRange BodyRange,
32-
SourceLoc PreviousLoc) {
31+
DeclContext *ParentContext, SourceRange BodyRange, SourceLoc PreviousLoc) {
3332
assert(!IDEInspectionDelayedDeclStat.get() &&
3433
"only one decl can be delayed for code completion");
3534
unsigned startOffset = SM.getLocOffsetInBuffer(BodyRange.Start, BufferID);
@@ -39,12 +38,12 @@ void PersistentParserState::setIDEInspectionDelayedDeclState(
3938
prevOffset = SM.getLocOffsetInBuffer(PreviousLoc, BufferID);
4039

4140
IDEInspectionDelayedDeclStat.reset(new IDEInspectionDelayedDeclState(
42-
Kind, Flags, ParentContext, startOffset, endOffset, prevOffset));
41+
Kind, ParentContext, startOffset, endOffset, prevOffset));
4342
}
4443

4544
void PersistentParserState::restoreIDEInspectionDelayedDeclState(
4645
const IDEInspectionDelayedDeclState &other) {
4746
IDEInspectionDelayedDeclStat.reset(new IDEInspectionDelayedDeclState(
48-
other.Kind, other.Flags, other.ParentContext,
49-
other.StartOffset, other.EndOffset, other.PrevOffset));
47+
other.Kind, other.ParentContext, other.StartOffset, other.EndOffset,
48+
other.PrevOffset));
5049
}

0 commit comments

Comments
 (0)