summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/LiteralSupport.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-6/+4
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Fix a nasty bug where inside StringLiteralParser:Argyrios Kyrtzidis2011-05-171-1/+18
| | | | | | | | | | | | | | | | 1. We would assume that the length of the string literal token was at least 2 2. We would allocate a buffer with size length-2 And when the stars aligned (one of which would be an invalid source location due to stale PCH) The length would be 0 and we would try to allocate a 4GB buffer. Add checks for this corner case and a bunch of asserts. (We really really should have had an assert for 1.). Note that there's no test case since I couldn't get one (it was major PITA to reproduce), maybe later. llvm-svn: 131492
* fix a bunch of comment typos found by codespell. Patch byChris Lattner2011-04-151-1/+1
| | | | | | Luis Felipe Strano Moraes! llvm-svn: 129559
* Microsoft integer suffix changes:Francois Pichet2011-01-111-7/+18
| | | | | | | | | i64 is like LL i32 is like L Also set isMicrosoftInteger to true only if the suffix is well formed. llvm-svn: 123230
* Fix diagnostic for reporting bad escape sequence.Ted Kremenek2010-12-031-1/+1
| | | | | | Patch by Paul Curtis! llvm-svn: 120759
* move getSpelling from Preprocessor to Lexer, which it is more conceptually ↵Chris Lattner2010-11-171-4/+4
| | | | | | related to. llvm-svn: 119479
* propagate preprocessor out of StringLiteralParser. It is nowChris Lattner2010-11-171-10/+18
| | | | | | possible to create one without a preprocessor. llvm-svn: 119476
* push the preprocessor out of EncodeUCNEscapeChris Lattner2010-11-171-21/+14
| | | | llvm-svn: 119475
* move AdvanceToTokenCharacter and getLocForEndOfToken fromChris Lattner2010-11-171-3/+5
| | | | | | Preprocessor to Lexer where they make more sense. llvm-svn: 119474
* add a static version of PP::AdvanceToTokenCharacter.Chris Lattner2010-11-171-10/+13
| | | | llvm-svn: 119472
* push use of Preprocessor out farther.Chris Lattner2010-11-171-22/+18
| | | | llvm-svn: 119471
* push use of Preprocessor out of getOffsetOfStringByte Chris Lattner2010-11-171-6/+5
| | | | llvm-svn: 119470
* add a static form of the efficient PP::getSpelling method.Chris Lattner2010-11-171-1/+4
| | | | llvm-svn: 119469
* refactor the interface to StringLiteralParser::getOffsetOfStringByte,Chris Lattner2010-11-171-32/+39
| | | | | | pushing the dependency on the preprocessor out a bit. llvm-svn: 119468
* allow I128 suffixes in msextensions mode just like i128 suffixes, patchChris Lattner2010-10-141-1/+1
| | | | | | by Martin Vejnar! llvm-svn: 116460
* Add support for UCNs for character literalsNico Weber2010-10-091-25/+55
| | | | llvm-svn: 116129
* Add support for 4-byte UCNs like \U12345678. Warn about UCNs in c90 mode.Nico Weber2010-10-061-9/+30
| | | | llvm-svn: 115743
* Prevent warning when built with assert off.Fariborz Jahanian2010-08-311-0/+1
| | | | llvm-svn: 112680
* Some support for unicode string constantsFariborz Jahanian2010-08-311-3/+18
| | | | | | in wide strings. radar 8360841. llvm-svn: 112672
* Revert my user-defined literal commits - r1124{58,60,67} pendingAlexis Hunt2010-08-301-18/+10
| | | | | | some issues being sorted out. llvm-svn: 112493
* Implement C++0x user-defined string literals.Alexis Hunt2010-08-291-10/+18
| | | | | | | | | | The extra data stored on user-defined literal Tokens is stored in extra allocated memory, which is managed by the PreprocessorLexer because there isn't a better place to put it that makes sure it gets deallocated, but only after it's used up. My testing has shown no significant slowdown as a result, but independent testing would be appreciated. llvm-svn: 112458
* Random temporary string cleanup.Benjamin Kramer2010-08-111-4/+4
| | | | llvm-svn: 110807
* Complain when string literals are too long for the active languageDouglas Gregor2010-07-201-0/+14
| | | | | | standard's minimum requirements. llvm-svn: 108837
* Remove a dead argument to ProcessUCNEscape.Chris Lattner2010-06-151-10/+5
| | | | | | | | | | Fix string concatenation to treat escapes in concatenated strings that are wide because of other string chunks to process the escapes as wide themselves. Before we would warn about and miscompile the attached testcase. This fixes rdar://8040728 - miscompile + warning: hex escape sequence out of range llvm-svn: 106012
* Fix a miscompile of wchar pascal strings.Fariborz Jahanian2010-05-281-0/+2
| | | | | | (radar 8020384) llvm-svn: 104996
* Tell the string literal parser when it's not permitted to emitDouglas Gregor2010-05-261-20/+35
| | | | | | | | diagnostics. That would be while we're parsing string literals for the sole purpose of producing a diagnostic about them. Fixes <rdar://problem/8026030>. llvm-svn: 104684
* emit warn_char_constant_too_large at most once per literal, fixing PR6852Chris Lattner2010-04-161-1/+4
| | | | llvm-svn: 101580
* Introduce optional "Invalid" parameters to routines that invoke theDouglas Gregor2010-03-161-2/+13
| | | | | | | | | | | | | SourceManager's getBuffer() and, therefore, could fail, along with Preprocessor::getSpelling(). Use the Invalid parameters in the literal parsers (string, floating point, integral, character) to make them robust against errors that stem from, e.g., PCH files that are not consistent with the underlying file system. I still need to audit every use caller to all of these routines, to determine which ones need specific handling of error conditions. llvm-svn: 98608
* ui64, etc. are valid VS suffixes.Fariborz Jahanian2010-01-221-1/+1
| | | | | | Fixes radar 7562363. llvm-svn: 94224
OpenPOWER on IntegriCloud