[cfe-commits] r167059 - in /cfe/trunk: include/clang/Basic/Diagnostic.h lib/Lex/LiteralSupport.cpp test/Misc/wrong-encoding.c
David Blaikie
dblaikie at gmail.com
Tue Oct 30 16:22:23 PDT 2012
Author: dblaikie
Date: Tue Oct 30 18:22:22 2012
New Revision: 167059
URL: http://llvm.org/viewvc/llvm-project?rev=167059&view=rev
Log:
Handle string encoding diagnostics when there are too many invalid ranges.
Modified:
cfe/trunk/include/clang/Basic/Diagnostic.h
cfe/trunk/lib/Lex/LiteralSupport.cpp
cfe/trunk/test/Misc/wrong-encoding.c
Modified: cfe/trunk/include/clang/Basic/Diagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.h?rev=167059&r1=167058&r2=167059&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Diagnostic.h (original)
+++ cfe/trunk/include/clang/Basic/Diagnostic.h Tue Oct 30 18:22:22 2012
@@ -964,6 +964,10 @@
"Too many arguments to diagnostic!");
DiagObj->DiagFixItHints[NumFixits++] = Hint;
}
+
+ bool hasMaxRanges() const {
+ return NumRanges == DiagnosticsEngine::MaxRanges;
+ }
};
inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
Modified: cfe/trunk/lib/Lex/LiteralSupport.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/LiteralSupport.cpp?rev=167059&r1=167058&r2=167059&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/LiteralSupport.cpp (original)
+++ cfe/trunk/lib/Lex/LiteralSupport.cpp Tue Oct 30 18:22:22 2012
@@ -1425,7 +1425,8 @@
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());
Modified: cfe/trunk/test/Misc/wrong-encoding.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/wrong-encoding.c?rev=167059&r1=167058&r2=167059&view=diff
==============================================================================
--- cfe/trunk/test/Misc/wrong-encoding.c (original)
+++ cfe/trunk/test/Misc/wrong-encoding.c Tue Oct 30 18:22:22 2012
@@ -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 @@
"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
More information about the cfe-commits
mailing list