aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Lex/LiteralSupport.cpp7
-rw-r--r--test/CodeGen/pascal-string.c8
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/Lex/LiteralSupport.cpp b/lib/Lex/LiteralSupport.cpp
index 11bb1f25ad..345291382d 100644
--- a/lib/Lex/LiteralSupport.cpp
+++ b/lib/Lex/LiteralSupport.cpp
@@ -863,12 +863,13 @@ StringLiteralParser(const Token *StringToks, unsigned NumStringToks,
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;
+ }
}
}
diff --git a/test/CodeGen/pascal-string.c b/test/CodeGen/pascal-string.c
new file mode 100644
index 0000000000..fcd807cde7
--- /dev/null
+++ b/test/CodeGen/pascal-string.c
@@ -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;
+}
+