forked from OSchip/llvm-project
Fix an assertion failure printing the unused-label fixit in files using CRLF line endings. <rdar://problem/12639047>.
llvm-svn: 167900
This commit is contained in:
parent
41ae3288fd
commit
b699e619fe
|
@ -1319,8 +1319,15 @@ SourceLocation Lexer::findLocationAfterToken(SourceLocation Loc,
|
|||
C = *(++TokenEnd);
|
||||
NumWhitespaceChars++;
|
||||
}
|
||||
if (isVerticalWhitespace(C))
|
||||
|
||||
// Skip \r, \n, \r\n, or \n\r
|
||||
if (C == '\n' || C == '\r') {
|
||||
char PrevC = C;
|
||||
C = *(++TokenEnd);
|
||||
NumWhitespaceChars++;
|
||||
if ((C == '\n' || C == '\r') && C != PrevC)
|
||||
NumWhitespaceChars++;
|
||||
}
|
||||
}
|
||||
|
||||
return TokenLoc.getLocWithOffset(Tok.getLength() + NumWhitespaceChars);
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
// RUN: %clang_cc1 -pedantic -Wunused-label -x c %s 2>&1 | FileCheck %s -strict-whitespace
|
||||
|
||||
// This file intentionally uses a CRLF newline style
|
||||
// <rdar://problem/12639047>
|
||||
// CHECK: warning: unused label 'ddd'
|
||||
// CHECK-NEXT: {{^ ddd:}}
|
||||
// CHECK-NEXT: {{^ \^~~~$}}
|
||||
void f() {
|
||||
ddd:
|
||||
;
|
||||
}
|
Loading…
Reference in New Issue