Skip to content

Commit 2bb0d99

Browse files
author
git apple-llvm automerger
committed
Merge commit '2a66ce5edb25' from llvm.org/main into next
2 parents 465f282 + 2a66ce5 commit 2bb0d99

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

clang/lib/Basic/SourceManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,14 +1171,14 @@ unsigned SourceManager::getColumnNumber(FileID FID, unsigned FilePos,
11711171
if (Buf[FilePos - 1] == '\r' || Buf[FilePos - 1] == '\n')
11721172
--FilePos;
11731173
}
1174-
return FilePos - LineStart + 1;
1174+
return (FilePos - LineStart) + 1;
11751175
}
11761176
}
11771177

11781178
unsigned LineStart = FilePos;
11791179
while (LineStart && Buf[LineStart-1] != '\n' && Buf[LineStart-1] != '\r')
11801180
--LineStart;
1181-
return FilePos-LineStart+1;
1181+
return (FilePos - LineStart) + 1;
11821182
}
11831183

11841184
// isInvalid - Return the result of calling loc.isInvalid(), and

clang/lib/Frontend/TextDiagnostic.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,8 @@ prepareAndFilterRanges(const SmallVectorImpl<CharSourceRange> &Ranges,
10951095

10961096
unsigned StartColumn = SM.getExpansionColumnNumber(Begin);
10971097
unsigned EndColumn = SM.getExpansionColumnNumber(End);
1098+
assert(StartColumn && "StartColumn must be valid, 0 is invalid");
1099+
assert(EndColumn && "EndColumn must be valid, 0 is invalid");
10981100
if (R.isTokenRange())
10991101
EndColumn += Lexer::MeasureTokenLength(End, SM, LangOpts);
11001102

0 commit comments

Comments
 (0)