aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Basic/Diagnostic.h4
-rw-r--r--lib/Lex/LiteralSupport.cpp3
-rw-r--r--test/Misc/wrong-encoding.c4
3 files changed, 10 insertions, 1 deletions
diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h
index 9990222daa..e47f3e1857 100644
--- a/include/clang/Basic/Diagnostic.h
+++ b/include/clang/Basic/Diagnostic.h
@@ -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,
diff --git a/lib/Lex/LiteralSupport.cpp b/lib/Lex/LiteralSupport.cpp
index 2896dc3bf7..91edf4f4a0 100644
--- a/lib/Lex/LiteralSupport.cpp
+++ b/lib/Lex/LiteralSupport.cpp
@@ -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());
diff --git a/test/Misc/wrong-encoding.c b/test/Misc/wrong-encoding.c
index db37af9d2b..1f186b7939 100644
--- a/test/Misc/wrong-encoding.c
+++ b/test/Misc/wrong-encoding.c
@@ -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