Skip to content

Commit

Permalink
Fix comparisons between presumed and buffer line numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
owenv committed May 26, 2020
1 parent 45bc578 commit dac9698
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/Parse/ParseStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -771,8 +771,8 @@ ParserResult<Stmt> Parser::parseStmtReturn(SourceLoc tryLoc) {

// Issue a warning when the returned expression is on a different line than
// the return keyword, but both have the same indentation.
if (SourceMgr.getPresumedLineAndColumnForLoc(ReturnLoc).second ==
SourceMgr.getPresumedLineAndColumnForLoc(ExprLoc).second) {
if (SourceMgr.getLineAndColumnInBuffer(ReturnLoc).second ==
SourceMgr.getLineAndColumnInBuffer(ExprLoc).second) {
diagnose(ExprLoc, diag::unindented_code_after_return);
diagnose(ExprLoc, diag::indent_expression_to_silence);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Sema/MiscDiagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3163,7 +3163,7 @@ static void checkSwitch(ASTContext &ctx, const SwitchStmt *stmt) {
continue;

auto &SM = ctx.SourceMgr;
auto prevLineCol = SM.getPresumedLineAndColumnForLoc(prevLoc);
auto prevLineCol = SM.getLineAndColumnInBuffer(prevLoc);
if (SM.getLineAndColumnInBuffer(thisLoc).first != prevLineCol.first)
continue;

Expand Down

0 comments on commit dac9698

Please sign in to comment.