summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/LiteralSupport.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* In StringLiteralParser::init, make sure we emit an error whenArgyrios Kyrtzidis2012-05-031-14/+13
| | | | | | | | failing to lex the string, as suggested by Eli. Part of rdar://11305263. llvm-svn: 156081
* In StringLiteralParser::init(), fail gracefully if the string isArgyrios Kyrtzidis2012-05-031-1/+6
| | | | | | | | | not as we expect; it may be due to racing issue of a file coming from PCH changing after the PCH is loaded. rdar://11353109 llvm-svn: 156043
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-6/+6
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Improve diagnostics for UCNs referring to control characters and members of theRichard Smith2012-03-091-24/+41
| | | | | | | | | | basic source character set in C++98. Add -Wc++98-compat diagnostics for same in literals in C++11. Extend such support to cover string literals as well as character literals, and mark N2170 as done. This seems too minor to warrant a release note to me. Let me know if you disagree. llvm-svn: 152444
* When checking the encoding of an 8-bit string literal, don't just check theRichard Smith2012-03-081-13/+8
| | | | | | | first codepoint! Also, don't reject empty raw string literals for spurious "encoding" issues. Also, don't rely on undefined behavior in ConvertUTF.c. llvm-svn: 152344
* Add support for cooked forms of user-defined-integer-literal andRichard Smith2012-03-081-3/+15
| | | | | | | user-defined-floating-literal. Support for raw forms of these literals to follow. llvm-svn: 152302
* User-defined literal support for character literals.Richard Smith2012-03-081-0/+3
| | | | llvm-svn: 152277
* Lexing support for user-defined literals. Currently these lex as the same tokenRichard Smith2012-03-051-5/+52
| | | | | | | kinds as the underlying string literals, and we silently drop the ud-suffix; those issues will be fixed by subsequent patches. llvm-svn: 152012
* Implement warning for non-wide string literals with an unexpected encoding. ↵Eli Friedman2012-02-111-15/+40
| | | | | | Downgrade error for non-wide character literals with an unexpected encoding to a warning for compatibility with gcc and older versions of clang. <rdar://problem/10837678>. llvm-svn: 150295
* Fixing hex floating literal support so that it handles 0x.2p2 properly.Aaron Ballman2012-02-081-6/+11
| | | | llvm-svn: 150072
* Hex literals without a significand no longer crash the lexer. Fixes bug 7910Aaron Ballman2012-02-071-0/+6
| | | | | | Patch by Eitan Adler llvm-svn: 149984
* Basic: import SmallString<> into clang namespaceDylan Noblesmith2012-02-051-2/+2
| | | | | | | (I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) llvm-svn: 149799
* stop claiming unicode escape sequences are too long in strings, because they ↵Seth Cantrell2012-01-181-2/+0
| | | | | | never are llvm-svn: 148391
* Improves support for Unicode in character literalsSeth Cantrell2012-01-181-64/+115
| | | | | | | | | | | | | | | | | | | | Updates ProcessUCNExcape() for C++. C++11 allows UCNs in character and string literals that represent control characters and basic source characters. Also C++03 allows UCNs that refer to surrogate codepoints. UTF-8 sequences in character literals are now handled as single c-chars. Added error for multiple characters in Unicode character literals. Added errors for when a the execution charset encoding of a c-char cannot be represented as a single code unit in the associated character type. Note that for the purposes of this error the asso- ciated character type for a narrow character literal is char, not int, even though in C narrow character literals have type int. llvm-svn: 148389
* Fix a regression in wide character codegen. See PR11369.Nico Weber2011-11-141-2/+2
| | | | llvm-svn: 144521
* Fix one last place where we weren't writing into a string literal consistently.Eli Friedman2011-11-051-2/+14
| | | | llvm-svn: 143769
* Use native endianness for writing out character escapes to the result buffer ↵Eli Friedman2011-11-021-20/+32
| | | | | | for string literal parsing. No functional change on little-endian architectures; should fix test failures on PPC. llvm-svn: 143585
* Perform proper conversion for strings encoded in the source file as UTF-8. ↵Eli Friedman2011-11-011-11/+44
| | | | | | | | | | (For now, we are assuming the source character set is always UTF-8; this can be easily extended if necessary.) Tests will be coming up in a subsequent commit. Patch by Seth Cantrell. llvm-svn: 143416
* We do parse hexfloats in C++11; make it actually work.Douglas Gregor2011-10-121-3/+0
| | | | llvm-svn: 141798
* When parsing a character literal, extract the characters from theDouglas Gregor2011-09-271-1/+1
| | | | | | | | 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
* Rename Diagnostic to DiagnosticsEngine as per issue 5397David Blaikie2011-09-251-3/+4
| | | | llvm-svn: 140478
* Fix missing includes for llvm_unreachableDavid Blaikie2011-09-231-0/+1
| | | | llvm-svn: 140368
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-1/+1
| | | | llvm-svn: 140367
* Rename LangOptions::Microsoft to LangOptions::MicrosoftExt to make it clear ↵Francois Pichet2011-09-171-1/+1
| | | | | | | | that this flag must be used only for Microsoft extensions and not emulation; to avoid confusion with the new LangOptions::MicrosoftMode flag. Many of the code now under LangOptions::MicrosoftExt will eventually be moved under the LangOptions::MicrosoftMode flag. llvm-svn: 139987
* Allow C99 hexfloats in C++0x mode. This change resolves the standardsDouglas Gregor2011-08-301-4/+2
| | | | | | | | | collision between C99 hexfloats and C++0x user-defined literals by giving C99 hexfloats precedence. Also, warning about user-defined literals that conflict with hexfloats and those that have names that are reserved by the implementation. Fixes <rdar://problem/9940194>. llvm-svn: 138839
* Warn about and truncate UCNs that are too big for their character literal type.Craig Topper2011-08-191-5/+5
| | | | llvm-svn: 138031
* De-Unicode-ify.NAKAMURA Takumi2011-08-121-2/+2
| | | | llvm-svn: 137430
* Raw string followup. Pass a couple StringRefs by value.Craig Topper2011-08-111-1/+1
| | | | llvm-svn: 137301
* Add support for C++0x raw string literals.Craig Topper2011-08-111-74/+148
| | | | llvm-svn: 137298
* Fix comment (test commit)Craig Topper2011-08-081-1/+1
| | | | llvm-svn: 137039
* Add support for C++0x unicode string and character literals, from Craig Topper!Douglas Gregor2011-07-271-64/+93
| | | | llvm-svn: 136210
OpenPOWER on IntegriCloud