forked from OSchip/llvm-project
Handle string encoding diagnostics when there are too many invalid ranges.
llvm-svn: 167059
This commit is contained in:
parent
2a523d864d
commit
a0613170b4
|
@ -964,6 +964,10 @@ public:
|
|||
"Too many arguments to diagnostic!");
|
||||
DiagObj->DiagFixItHints[NumFixits++] = Hint;
|
||||
}
|
||||
|
||||
bool hasMaxRanges() const {
|
||||
return NumRanges == DiagnosticsEngine::MaxRanges;
|
||||
}
|
||||
};
|
||||
|
||||
inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
|
||||
|
|
|
@ -1425,7 +1425,8 @@ bool StringLiteralParser::CopyStringFragment(const Token &Tok,
|
|||
const char *NextStart = resync_utf8(ErrorPtr, Fragment.end());
|
||||
StringRef NextFragment(NextStart, Fragment.end()-NextStart);
|
||||
|
||||
while (!ConvertUTF8toWide(CharByteWidth, NextFragment, ResultPtr,
|
||||
while (!Builder.hasMaxRanges() &&
|
||||
!ConvertUTF8toWide(CharByteWidth, NextFragment, ResultPtr,
|
||||
ErrorPtrTmp)) {
|
||||
const char *ErrorPtr = reinterpret_cast<const char *>(ErrorPtrTmp);
|
||||
NextStart = resync_utf8(ErrorPtr, Fragment.end());
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value %s 2>&1 | FileCheck -strict-whitespace %s
|
||||
// REQUIRES: asserts
|
||||
|
||||
void foo() {
|
||||
|
||||
|
@ -30,4 +31,7 @@ void foo() {
|
|||
"xxé¿xxxxxxxxxxxxxxxxxxxxxé¿xx";
|
||||
// CHECK: {{^ "xx<E9><BF>xxxxxxxxxxxxxxxxxxxxx<E9><BF>xx";}}
|
||||
// CHECK: {{^ \^~~~~~~~ ~~~~~~~~}}
|
||||
|
||||
"xé¿xé¿xé¿xé¿xé¿xé¿xé¿xé¿xé¿xé¿xé¿xé¿x";
|
||||
}
|
||||
// CHECK-NOT:Assertion
|
||||
|
|
Loading…
Reference in New Issue