fix bug in SourceColumnMap::startOfPreviousColumn
authorSeth Cantrell <seth.cantrell@gmail.com>
Sat, 3 Nov 2012 21:21:14 +0000 (21:21 +0000)
committerSeth Cantrell <seth.cantrell@gmail.com>
Sat, 3 Nov 2012 21:21:14 +0000 (21:21 +0000)
llvm-svn: 167360

clang/lib/Frontend/TextDiagnostic.cpp
clang/test/Misc/wrong-encoding2.c [new file with mode: 0644]

index d622fb3..0eb3d60 100644 (file)
@@ -298,7 +298,7 @@ struct SourceColumnMap {
   /// \brief Map from a byte index to the previous byte which starts a column.
   int startOfPreviousColumn(int N) const {
     assert(0 < N && N < static_cast<int>(m_columnToByte.size()));
-    while (byteToColumn(N--) == -1) {}
+    while (byteToColumn(--N) == -1) {}
     return N;
   }
 
diff --git a/clang/test/Misc/wrong-encoding2.c b/clang/test/Misc/wrong-encoding2.c
new file mode 100644 (file)
index 0000000..43a0f4e
--- /dev/null
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -fmessage-length 100 %s 2>&1 | FileCheck -strict-whitespace %s
+// REQUIRES: asserts
+
+int main() {
+    "É#x#p\v)6Ò\13)ѽ\8a\9e>U êhÑüÃö|\9f à¦¥Ï»g\14\9fY|`\19?ò;\ 2\1e\11;Æ¿V\1djÇ\\\13ù\80\87ûݪW9úÐ\ 2¢:Ì\8aO EøÛ\90\ 5y?SKªy¦¹\87Øài&n";
+}
+
+// CHECK-NOT:Assertion