[cfe-commits] r68181 - in /cfe/trunk: lib/Lex/LiteralSupport.cpp test/CodeGen/pascal-string.c
Eli Friedman
eli.friedman at gmail.com
Tue Mar 31 20:17:20 PDT 2009
Author: efriedma
Date: Tue Mar 31 22:17:08 2009
New Revision: 68181
URL: http://llvm.org/viewvc/llvm-project?rev=68181&view=rev
Log:
Fix pascal string support; testcase from mailing list message.
Added:
cfe/trunk/test/CodeGen/pascal-string.c
Modified:
cfe/trunk/lib/Lex/LiteralSupport.cpp
Modified: cfe/trunk/lib/Lex/LiteralSupport.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/LiteralSupport.cpp?rev=68181&r1=68180&r2=68181&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/LiteralSupport.cpp (original)
+++ cfe/trunk/lib/Lex/LiteralSupport.cpp Tue Mar 31 22:17:08 2009
@@ -863,12 +863,13 @@
ResultBuf[0] = ResultPtr-&ResultBuf[0]-1;
// Verify that pascal strings aren't too large.
- if (GetStringLength() > 256)
+ if (GetStringLength() > 256) {
PP.Diag(StringToks[0].getLocation(), diag::err_pascal_string_too_long)
<< SourceRange(StringToks[0].getLocation(),
StringToks[NumStringToks-1].getLocation());
- hadError = 1;
- return;
+ hadError = 1;
+ return;
+ }
}
}
Added: cfe/trunk/test/CodeGen/pascal-string.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pascal-string.c?rev=68181&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/pascal-string.c (added)
+++ cfe/trunk/test/CodeGen/pascal-string.c Tue Mar 31 22:17:08 2009
@@ -0,0 +1,8 @@
+// RUN: clang-cc -emit-llvm -o - %s -fpascal-strings | grep "05Hello"
+
+unsigned char * Foo( void )
+{
+ static unsigned char s[256] = "\pHello";
+ return s;
+}
+
More information about the cfe-commits
mailing list