Skip to content

Commit dac9698

Browse files
committed
Fix comparisons between presumed and buffer line numbers
1 parent 45bc578 commit dac9698

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/Parse/ParseStmt.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -771,8 +771,8 @@ ParserResult<Stmt> Parser::parseStmtReturn(SourceLoc tryLoc) {
771771

772772
// Issue a warning when the returned expression is on a different line than
773773
// the return keyword, but both have the same indentation.
774-
if (SourceMgr.getPresumedLineAndColumnForLoc(ReturnLoc).second ==
775-
SourceMgr.getPresumedLineAndColumnForLoc(ExprLoc).second) {
774+
if (SourceMgr.getLineAndColumnInBuffer(ReturnLoc).second ==
775+
SourceMgr.getLineAndColumnInBuffer(ExprLoc).second) {
776776
diagnose(ExprLoc, diag::unindented_code_after_return);
777777
diagnose(ExprLoc, diag::indent_expression_to_silence);
778778
}

lib/Sema/MiscDiagnostics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3163,7 +3163,7 @@ static void checkSwitch(ASTContext &ctx, const SwitchStmt *stmt) {
31633163
continue;
31643164

31653165
auto &SM = ctx.SourceMgr;
3166-
auto prevLineCol = SM.getPresumedLineAndColumnForLoc(prevLoc);
3166+
auto prevLineCol = SM.getLineAndColumnInBuffer(prevLoc);
31673167
if (SM.getLineAndColumnInBuffer(thisLoc).first != prevLineCol.first)
31683168
continue;
31693169

0 commit comments

Comments
 (0)