Commit Graph

9 Commits

Author SHA1 Message Date
Volodymyr Sapsai 3173107098 [Lex] Fix handling numerical literals ending with ' and signed exponent.
For input `0'e+1` lexer tokenized as numeric constant only `0'e`. Later
NumericLiteralParser skipped 0 and ' as digits and parsed `e+1` as valid
exponent going past the end of the token. Because it didn't mark numeric
literal as having an error, it continued parsing and tried to expandUCNs
with StringRef of length -2.

The fix is not to parse exponent when we reached the end of token.

Discovered by OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4588

rdar://problem/36076719

Reviewers: rsmith, t.p.northover

Reviewed By: rsmith

Subscribers: cfe-commits, jkorous-apple

Differential Revision: https://reviews.llvm.org/D41834


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324419 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-06 22:39:25 +00:00
Richard Smith 3278448855 Update diagnostics now that hexadecimal literals look likely to be part of C++17.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262753 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-04 22:32:06 +00:00
Richard Smith d2a788ad62 PR26349: correctly check whether a digit sequence is empty in the presence of digit separators.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260307 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 22:34:35 +00:00
Richard Smith 431393eb91 Add some missing checks for C++1y digit separators that don't in fact separate
digits. Turns out we have completely separate lexing codepaths for floating
point numbers depending on whether or not they start with a zero. Who knew...
=)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206932 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-22 23:50:25 +00:00
Richard Smith d353a18fca Tests for lexing of digit separators versus UCNs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202534 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-28 20:13:19 +00:00
Richard Smith 008d8c0ad1 Fix a minor bug in lexing pp-numbers with digit separators: if a pp-number contains "'e+", the pp-number ends between the 'e' and the '+'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202533 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-28 20:06:02 +00:00
Richard Smith 65ea687b8a Add macro test from N3781.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191444 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-26 18:15:22 +00:00
Richard Smith 9a17677bb8 Per updates to D3781, allow underscore under ' in a pp-number, and allow ' in a #line directive.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191443 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-26 18:13:20 +00:00
Richard Smith 859b622769 Implement C++1y digit separator proposal (' as a digit separator). This is not
yet approved by full committee, but was unanimously supported by EWG.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191417 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-26 03:33:06 +00:00