diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2012-02-07 13:46:03 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2012-02-07 13:46:03 +0000 |
commit | b97a5addd54ed00345e940526dd1e32c75753e02 (patch) | |
tree | 13f1fc1c97f1b2b6d5cb9b91d890a670e24784fb /clang/lib/Lex/LiteralSupport.cpp | |
parent | db0fc5131ddd2be57c4a94e4cc5a31d855bf8e25 (diff) | |
download | bcm5719-llvm-b97a5addd54ed00345e940526dd1e32c75753e02.tar.gz bcm5719-llvm-b97a5addd54ed00345e940526dd1e32c75753e02.zip |
Hex literals without a significand no longer crash the lexer. Fixes bug 7910
Patch by Eitan Adler
llvm-svn: 149984
Diffstat (limited to 'clang/lib/Lex/LiteralSupport.cpp')
-rw-r--r-- | clang/lib/Lex/LiteralSupport.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp index 74c396ca965..c178d216ca8 100644 --- a/clang/lib/Lex/LiteralSupport.cpp +++ b/clang/lib/Lex/LiteralSupport.cpp @@ -546,6 +546,12 @@ void NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) { // Handle a hex number like 0x1234. if ((*s == 'x' || *s == 'X') && (isxdigit(s[1]) || s[1] == '.')) { s++; + if (!isxdigit(*s)) { + PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, s-ThisTokBegin), \ + diag::err_hexconstant_requires_digits); + hadError = true; + return; + } radix = 16; DigitsBegin = s; s = SkipHexDigits(s); |