summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/LiteralSupport.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Lex] A source-file new-line in a raw string literal results in a new-lineDavid Majnemer2015-09-231-4/+17
| | | | | | | | | Our string literal parser copied any source-file new-line characters into the execution string-literal. This is incorrect if the source-file new-line character was a \r\n sequence because new-line characters are merely \n. llvm-svn: 248392
* [MS Extensions] Remove support for the i128 integer literal suffixDavid Majnemer2015-07-261-4/+1
| | | | | | | | | | | | | There is currently no support in MSVC for using i128 as an integer literal suffix. In fact, there appears to be no evidence that they have ever supported this feature in any of their compilers. This was an over generalization of their actual feature and is a nasty source of bugs. Why is it a source of bugs? Because most code in clang expects that evaluation of an integer constant expression won't give them something that 'long long' can't represent. Instead of providing a meaningful feature, i128 gives us cute ways of exploding the compiler. llvm-svn: 243243
* [lex] Don't read past the end of the bufferBenjamin Kramer2015-03-291-3/+4
| | | | | | | | | While dereferencing ThisTokEnd is fine and we know that it's not in [a-zA-Z0-9_.], ThisTokEnd[1] is really past the end. Found by asan and with a little help from clang-fuzz. llvm-svn: 233491
* [lex] Turn range checks into asserts.Benjamin Kramer2015-03-291-44/+36
| | | | | | | We know that the last accessible char is not in [a-zA-Z0-9_.] so we can happily scan on as long as it is. No functionality change. llvm-svn: 233490
* Make Oveflow tracking more legible (CR feedback from Richard Smith on r232999)David Blaikie2015-03-231-1/+2
| | | | llvm-svn: 233006
* Refactor: Simplify boolean expresssions in lib/LexDavid Blaikie2015-03-231-1/+1
| | | | | | | | | | Simplify boolean expressions using `true` and `false` with `clang-tidy` Patch by Richard Thomson. Differential Revision: http://reviews.llvm.org/D8531 llvm-svn: 232999
* [c++1z] Support for u8 character literals.Richard Smith2014-11-081-2/+6
| | | | llvm-svn: 221576
* C++1y is now C++14!Aaron Ballman2014-08-191-4/+4
| | | | | | Changes diagnostic options, language standard options, diagnostic identifiers, diagnostic wording to use c++14 instead of c++1y. It also modifies related test cases to use the updated diagnostic wording. llvm-svn: 215982
* Convert StringLiteralParser constructor to use ArrayRef instead of a pointer ↵Craig Topper2014-06-261-13/+13
| | | | | | and count. llvm-svn: 211763
* Lex: Use the correct types for MS integer suffixesDavid Majnemer2014-06-211-11/+10
| | | | | | | | | | | | | | | | Something went wrong with r211426, it is an older version of this code and should not have been committed. It was reverted with r211434. Original commit message: We didn't properly implement support for the sized integer suffixes. Suffixes like i16 were essentially ignored instead of mapping them to the appropriately sized integer type. This fixes PR20008. Differential Revision: http://reviews.llvm.org/D4132 llvm-svn: 211441
* Revert "Lex: Use the correct types for MS integer suffixes"Rafael Espindola2014-06-211-10/+11
| | | | | | | | | This reverts commit r211426. This broke the arm bots. The crash can be reproduced on X86 by running. ./bin/clang -cc1 -fsyntax-only -verify -fms-extensions ~/llvm/clang/test/Lexer/ms-extensions.c -triple arm-linux llvm-svn: 211434
* Lex: Use the correct types for MS integer suffixesDavid Majnemer2014-06-211-11/+10
| | | | | | | | | | | | We didn't properly implement support for the sized integer suffixes. Suffixes like i16 were essentially ignored instead of mapping them to the appropriately sized integer type. This fixes PR20008. Differential Revision: http://reviews.llvm.org/D4132 llvm-svn: 211426
* Permit the "if" literal suffix with Microsoft extensions enabled.Peter Collingbourne2014-05-291-2/+7
| | | | | | Differential Revision: http://reviews.llvm.org/D3963 llvm-svn: 209859
* Remove limits on the number of fix-it hints and ranges in the DiagnosticsEngine.Alexander Kornienko2014-05-221-2/+1
| | | | | | | | | | | | | | | | | | | Summary: The limits on the number of fix-it hints and ranges attached to a diagnostic are arbitrary and don't apply universally to all users of the DiagnosticsEngine. The way the limits are enforced may lead to diagnostics generating invalid sets of fixes. I suggest removing the limits, which will also simplify the implementation. Reviewers: rsmith Reviewed By: rsmith Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D3879 llvm-svn: 209468
* [C++11] Use 'nullptr'. Lex edition.Craig Topper2014-05-171-4/+4
| | | | llvm-svn: 209083
* Add some missing checks for C++1y digit separators that don't in fact separateRichard Smith2014-04-221-0/+6
| | | | | | | | 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... =) llvm-svn: 206932
* Remove uses of SmallString::equals in favor of SmallVectorImpl<char>'s ↵David Blaikie2014-03-091-1/+1
| | | | | | operator== llvm-svn: 203373
* PR18855: Add support for UCNs and UTF-8 encoding within ud-suffixes.Richard Smith2014-02-171-12/+67
| | | | llvm-svn: 201532
* NumericLiteralParser::ParseNumberStartingWithZero(): Try to appease MSC16's ↵NAKAMURA Takumi2013-09-271-2/+5
| | | | | | | | miscompilation. Investigating yet. It seems msc16 miscompiles s[1] to be folded. llvm-svn: 191485
* Fix buildbot breakage.Richard Smith2013-09-261-4/+4
| | | | llvm-svn: 191424
* Replace a bool with an enum for clarity, based on review comment from James ↵Richard Smith2013-09-261-7/+8
| | | | | | Dennett. llvm-svn: 191420
* Implement C++1y digit separator proposal (' as a digit separator). This is notRichard Smith2013-09-261-4/+39
| | | | | | yet approved by full committee, but was unanimously supported by EWG. llvm-svn: 191417
* Handle standard libraries that miss out the space when defining the standardRichard Smith2013-09-241-0/+5
| | | | | | | | literal operators. Also, for now, allow the proposed C++1y "il", "i", and "if" suffixes too. (Will revert the latter if LWG decides not to go ahead with that change after all.) llvm-svn: 191274
* Fix CharByteWidth assertion in LiteralSupport.Eli Friedman2013-09-181-1/+1
| | | | | | Patch by Eelis van der Weegen. llvm-svn: 190971
* Revert r188863 which could propose wrong fixits for multibyte character ↵Nick Lewycky2013-08-211-9/+3
| | | | | | literals. llvm-svn: 188918
* Issue fixits replacing invalid character literals with the equivalent \xNNNick Lewycky2013-08-211-3/+9
| | | | | | escape code. llvm-svn: 188863
* No functionality change. Adjust a bunch of formatting issues in this code andNick Lewycky2013-08-211-20/+20
| | | | | | fix a typo in a comment. llvm-svn: 188857
* C++1y literal suffix support:Richard Smith2013-07-231-5/+51
| | | | | | | * Allow ns, us, ms, s, min, h as numeric ud-suffixes * Allow s as string ud-suffix llvm-svn: 186933
* Integers which are too large should be an error.Eli Friedman2013-07-231-2/+2
| | | | | | | | Switch some warnings over to errors which should never have been warnings in the first place. (Also, a minor fix to the preprocessor rules for integer literals while I'm here.) llvm-svn: 186903
* Note that we support (and in fact have supported since the dawn of time itself)Richard Smith2013-04-191-2/+7
| | | | | | C++1y binary literals. llvm-svn: 179883
* Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.Jordan Rose2013-02-081-10/+10
| | | | | | | Nearly all of these changes are one-to-one replacements; the few that aren't have to do with custom identifier validation. llvm-svn: 174768
* Move UTF conversion routines from clang/lib/Basic to llvm/lib/SupportDmitri Gribenko2013-01-301-1/+2
| | | | | | This is required to use them in TableGen. llvm-svn: 173924
* PR15067: Don't assert when a UCN appears in a C90 file.Jordan Rose2013-01-271-1/+1
| | | | | | | Unfortunately, we can't accept the UCN as an extension because we're required to treat it as two tokens for preprocessing purposes. llvm-svn: 173622
* Unify diagnostics for \x, \u, and \U without any following hex digits.Jordan Rose2013-01-241-2/+2
| | | | llvm-svn: 173368
* Adopt llvm::hexDigitValue.Jordan Rose2013-01-181-13/+4
| | | | llvm-svn: 172861
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-021-2/+2
| | | | llvm-svn: 171367
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-3/+3
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* LiteralSupport: Don't overflow the temporary buffer when decoding invalid ↵Benjamin Kramer2012-11-081-5/+6
| | | | | | | | | string parts. Instead just use a dummy buffer, we're not going to use the decoded string anyways. Fixes PR14292. llvm-svn: 167594
* LiteralSupport: Clean up style violations. No functionality change.Benjamin Kramer2012-11-081-15/+15
| | | | llvm-svn: 167593
* Handle string encoding diagnostics when there are too many invalid ranges.David Blaikie2012-10-301-1/+2
| | | | llvm-svn: 167059
* improve highlighting of invalid string encodingsSeth Cantrell2012-10-281-11/+49
| | | | | | | limit highlight to exactly the bad encoding, and highlight every bad encoding in a string. llvm-svn: 166900
* Rename CanFitInto64Bits to alwaysFitsInto64Bits per discussion on IRC.Jordan Rose2012-09-251-2/+2
| | | | | | | | | | | | | This makes the behavior clearer concerning literals with the maximum number of digits. For a 32-bit example, 4,000,000,000 is a valid uint32_t, but 5,000,000,000 is not, so we'd have to count 10-digit decimal numbers as "unsafe" (meaning we have to check for overflow when parsing them, just as we would for numbers with 11 digits or higher). This is the same, only with 64 bits to play with. No functionality change. llvm-svn: 164639
* Optimize NumericLiteralParser::GetIntegerValue().Dmitri Gribenko2012-09-251-9/+21
| | | | | | | It does a conservative estimate on the size of numbers that can fit into uint64_t. This bound is improved. llvm-svn: 164624
* Small cleanup of literal semantic analysis: hiding 'char *' pointers behindDmitri Gribenko2012-09-241-11/+11
| | | | | | | StringRef makes code cleaner. Also, make the temporary buffer smaller: 512 characters is unreasonably large for integer literals. llvm-svn: 164484
* When a bad UTF-8 encoding or bogus escape sequence is encountered in aRichard Smith2012-09-081-60/+101
| | | | | | | string literal, produce a diagnostic pointing at the erroneous character range, not at the start of the literal. llvm-svn: 163459
* Share ConvertUTF8toWide() between Lex and CodeGen.Nico Weber2012-07-031-36/+1
| | | | llvm-svn: 159634
* Documentation cleanup: add \verbatim markup for grammar productionsJames Dennett2012-06-191-1/+2
| | | | llvm-svn: 158740
* Documentation cleanup: added \verbatim...\verbatim markup to fix theJames Dennett2012-06-171-0/+2
| | | | | | formatting of Doxygen's output for StringLiteralParser::StringLiteralParser. llvm-svn: 158616
* Fix off-by-one error in UTF-16 encoding: don't try to use a surrogate pair ↵Richard Smith2012-06-131-1/+1
| | | | | | for U+FFFF. llvm-svn: 158391
* PR13099: Teach -Wformat about raw string literals, UTF-8 strings and Unicode ↵Richard Smith2012-06-131-9/+71
| | | | | | escape sequences. llvm-svn: 158390
OpenPOWER on IntegriCloud