summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-09-27 17:00:18 +0000
committerDouglas Gregor <dgregor@apple.com>2011-09-27 17:00:18 +0000
commit4d68366b2f280242401f5184dc4fc35ca32ae819 (patch)
treea7f81986501898c9f03eb62d217f98315555ee5e /clang/lib/Lex
parentff5d0965b0a89a6ccbe952b64b1e27ab128e6d93 (diff)
downloadbcm5719-llvm-4d68366b2f280242401f5184dc4fc35ca32ae819.tar.gz
bcm5719-llvm-4d68366b2f280242401f5184dc4fc35ca32ae819.zip
When parsing a character literal, extract the characters from the
buffer as an 'unsigned char', so that integer promotion doesn't sign-extend character values > 127 into oblivion. Fixes <rdar://problem/10188919>. llvm-svn: 140608
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r--clang/lib/Lex/LiteralSupport.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp
index ef385a8aedb..96550e6492b 100644
--- a/clang/lib/Lex/LiteralSupport.cpp
+++ b/clang/lib/Lex/LiteralSupport.cpp
@@ -784,7 +784,7 @@ CharLiteralParser::CharLiteralParser(const char *begin, const char *end,
// Is this a Universal Character Name escape?
if (begin[0] != '\\') // If this is a normal character, consume it.
- ResultChar = *begin++;
+ ResultChar = (unsigned char)*begin++;
else { // Otherwise, this is an escape character.
unsigned CharWidth = getCharWidth(Kind, PP.getTargetInfo());
// Check for UCN.
OpenPOWER on IntegriCloud