Skip to content

Commit e0ceb85

Browse files
committed
[AST] Remove unparsed case from FuncDecl::getSourceRange
This wasn't really sound since it could result in source ranges that have different buffers for the start and end loc. Instead, adjust the parser logic to look at the brace range.
1 parent 3c67271 commit e0ceb85

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

lib/AST/Decl.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11481,9 +11481,6 @@ SourceRange FuncDecl::getSourceRange() const {
1148111481
if (startLoc.isInvalid())
1148211482
return SourceRange();
1148311483

11484-
if (getBodyKind() == BodyKind::Unparsed)
11485-
return { startLoc, BodyRange.End };
11486-
1148711484
SourceLoc endLoc = getOriginalBodySourceRange().End;
1148811485
if (endLoc.isInvalid()) {
1148911486
if (isa<AccessorDecl>(this))

lib/Parse/ParseDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9009,7 +9009,7 @@ Parser::parseAbstractFunctionBodyDelayed(AbstractFunctionDecl *AFD) {
90099009
auto bodyRange = AFD->getBodySourceRange();
90109010
auto BeginParserPosition = getParserPosition(bodyRange.Start,
90119011
/*previousLoc*/ SourceLoc());
9012-
auto EndLexerState = L->getStateForEndOfTokenLoc(AFD->getEndLoc());
9012+
auto EndLexerState = L->getStateForEndOfTokenLoc(bodyRange.End);
90139013

90149014
// ParserPositionRAII needs a primed parser to restore to.
90159015
if (Tok.is(tok::NUM_TOKENS))

0 commit comments

Comments
 (0)