c5c27f2a1f 
								
							 
						 
						
							
							
								
								Note that we support (and in fact have supported since the dawn of time itself)  
							
							... 
							
							
							
							C++1y binary literals.
llvm-svn: 179883 
							
						 
						
							2013-04-19 20:47:20 +00:00  
				
					
						
							
							
								 
						
							
								a7d03840e6 
								
							 
						 
						
							
							
								
								Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.  
							
							... 
							
							
							
							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 
							
						 
						
							2013-02-08 22:30:41 +00:00  
				
					
						
							
							
								 
						
							
								9feeef40f5 
								
							 
						 
						
							
							
								
								Move UTF conversion routines from clang/lib/Basic to llvm/lib/Support  
							
							... 
							
							
							
							This is required to use them in TableGen.
llvm-svn: 173924 
							
						 
						
							2013-01-30 12:06:08 +00:00  
				
					
						
							
							
								 
						
							
								c0cba27230 
								
							 
						 
						
							
							
								
								PR15067: Don't assert when a UCN appears in a C90 file.  
							
							... 
							
							
							
							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 
							
						 
						
							2013-01-27 20:12:04 +00:00  
				
					
						
							
							
								 
						
							
								aa89cf1a66 
								
							 
						 
						
							
							
								
								Unify diagnostics for \x, \u, and \U without any following hex digits.  
							
							... 
							
							
							
							llvm-svn: 173368 
							
						 
						
							2013-01-24 20:50:13 +00:00  
				
					
						
							
							
								 
						
							
								78ed86a7e5 
								
							 
						 
						
							
							
								
								Adopt llvm::hexDigitValue.  
							
							... 
							
							
							
							llvm-svn: 172861 
							
						 
						
							2013-01-18 22:33:58 +00:00  
				
					
						
							
							
								 
						
							
								2bf7fdb723 
								
							 
						 
						
							
							
								
								s/CPlusPlus0x/CPlusPlus11/g  
							
							... 
							
							
							
							llvm-svn: 171367 
							
						 
						
							2013-01-02 11:42:31 +00:00  
				
					
						
							
							
								 
						
							
								3a02247dc9 
								
							 
						 
						
							
							
								
								Sort all of Clang's files under 'lib', and fix up the broken headers  
							
							... 
							
							
							
							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 
							
						 
						
							2012-12-04 09:13:33 +00:00  
				
					
						
							
							
								 
						
							
								7d574e269d 
								
							 
						 
						
							
							
								
								LiteralSupport: Don't overflow the temporary buffer when decoding invalid string parts.  
							
							... 
							
							
							
							Instead just use a dummy buffer, we're not going to use the decoded string anyways.
Fixes PR14292.
llvm-svn: 167594 
							
						 
						
							2012-11-08 19:22:31 +00:00  
				
					
						
							
							
								 
						
							
								f23a6e6f80 
								
							 
						 
						
							
							
								
								LiteralSupport: Clean up style violations. No functionality change.  
							
							... 
							
							
							
							llvm-svn: 167593 
							
						 
						
							2012-11-08 19:22:26 +00:00  
				
					
						
							
							
								 
						
							
								a0613170b4 
								
							 
						 
						
							
							
								
								Handle string encoding diagnostics when there are too many invalid ranges.  
							
							... 
							
							
							
							llvm-svn: 167059 
							
						 
						
							2012-10-30 23:22:22 +00:00  
				
					
						
							
							
								 
						
							
								4cfc817a9a 
								
							 
						 
						
							
							
								
								improve highlighting of invalid string encodings  
							
							... 
							
							
							
							limit highlight to exactly the bad encoding, and highlight every
bad encoding in a string.
llvm-svn: 166900 
							
						 
						
							2012-10-28 18:24:46 +00:00  
				
					
						
							
							
								 
						
							
								de584de370 
								
							 
						 
						
							
							
								
								Rename CanFitInto64Bits to alwaysFitsInto64Bits per discussion on IRC.  
							
							... 
							
							
							
							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 
							
						 
						
							2012-09-25 22:32:51 +00:00  
				
					
						
							
							
								 
						
							
								511288b2b5 
								
							 
						 
						
							
							
								
								Optimize NumericLiteralParser::GetIntegerValue().  
							
							... 
							
							
							
							It does a conservative estimate on the size of numbers that can fit into
uint64_t.  This bound is improved.
llvm-svn: 164624 
							
						 
						
							2012-09-25 19:09:15 +00:00  
				
					
						
							
							
								 
						
							
								7ba91723e7 
								
							 
						 
						
							
							
								
								Small cleanup of literal semantic analysis: hiding 'char *' pointers behind  
							
							... 
							
							
							
							StringRef makes code cleaner.  Also, make the temporary buffer smaller:
512 characters is unreasonably large for integer literals.
llvm-svn: 164484 
							
						 
						
							2012-09-24 09:53:54 +00:00  
				
					
						
							
							
								 
						
							
								639b8d05dd 
								
							 
						 
						
							
							
								
								When a bad UTF-8 encoding or bogus escape sequence is encountered in a  
							
							... 
							
							
							
							string literal, produce a diagnostic pointing at the erroneous character
range, not at the start of the literal.
llvm-svn: 163459 
							
						 
						
							2012-09-08 07:16:20 +00:00  
				
					
						
							
							
								 
						
							
								4b18c3ff40 
								
							 
						 
						
							
							
								
								Share ConvertUTF8toWide() between Lex and CodeGen.  
							
							... 
							
							
							
							llvm-svn: 159634 
							
						 
						
							2012-07-03 02:24:52 +00:00  
				
					
						
							
							
								 
						
							
								99c193b3c0 
								
							 
						 
						
							
							
								
								Documentation cleanup: add \verbatim markup for grammar productions  
							
							... 
							
							
							
							llvm-svn: 158740 
							
						 
						
							2012-06-19 21:04:25 +00:00  
				
					
						
							
							
								 
						
							
								1cc2203286 
								
							 
						 
						
							
							
								
								Documentation cleanup: added \verbatim...\verbatim markup to fix the  
							
							... 
							
							
							
							formatting of Doxygen's output for StringLiteralParser::StringLiteralParser.
llvm-svn: 158616 
							
						 
						
							2012-06-17 03:34:42 +00:00  
				
					
						
							
							
								 
						
							
								0948d93b7f 
								
							 
						 
						
							
							
								
								Fix off-by-one error in UTF-16 encoding: don't try to use a surrogate pair for U+FFFF.  
							
							... 
							
							
							
							llvm-svn: 158391 
							
						 
						
							2012-06-13 05:41:29 +00:00  
				
					
						
							
							
								 
						
							
								4060f77462 
								
							 
						 
						
							
							
								
								PR13099: Teach -Wformat about raw string literals, UTF-8 strings and Unicode escape sequences.  
							
							... 
							
							
							
							llvm-svn: 158390 
							
						 
						
							2012-06-13 05:37:23 +00:00  
				
					
						
							
							
								 
						
							
								9933e3ac88 
								
							 
						 
						
							
							
								
								In StringLiteralParser::init, make sure we emit an error when  
							
							... 
							
							
							
							failing to lex the string, as suggested by Eli.
Part of rdar://11305263.
llvm-svn: 156081 
							
						 
						
							2012-05-03 17:50:32 +00:00  
				
					
						
							
							
								 
						
							
								4e5b5c36f4 
								
							 
						 
						
							
							
								
								In StringLiteralParser::init(), fail gracefully if the string is  
							
							... 
							
							
							
							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 
							
						 
						
							2012-05-03 01:01:56 +00:00  
				
					
						
							
							
								 
						
							
								bbafb8a745 
								
							 
						 
						
							
							
								
								Unify naming of LangOptions variable/get function across the Clang stack (Lex to AST).  
							
							... 
							
							
							
							The member variable is always "LangOpts" and the member function is always "getLangOpts".
Reviewed by Chris Lattner
llvm-svn: 152536 
							
						 
						
							2012-03-11 07:00:24 +00:00  
				
					
						
							
							
								 
						
							
								2a70e65436 
								
							 
						 
						
							
							
								
								Improve diagnostics for UCNs referring to control characters and members of the  
							
							... 
							
							
							
							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 
							
						 
						
							2012-03-09 22:27:51 +00:00  
				
					
						
							
							
								 
						
							
								812924502b 
								
							 
						 
						
							
							
								
								When checking the encoding of an 8-bit string literal, don't just check the  
							
							... 
							
							
							
							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 
							
						 
						
							2012-03-08 21:59:28 +00:00  
				
					
						
							
							
								 
						
							
								39570d0020 
								
							 
						 
						
							
							
								
								Add support for cooked forms of user-defined-integer-literal and  
							
							... 
							
							
							
							user-defined-floating-literal. Support for raw forms of these literals
to follow.
llvm-svn: 152302 
							
						 
						
							2012-03-08 08:45:32 +00:00  
				
					
						
							
							
								 
						
							
								75b67d6dc5 
								
							 
						 
						
							
							
								
								User-defined literal support for character literals.  
							
							... 
							
							
							
							llvm-svn: 152277 
							
						 
						
							2012-03-08 01:34:56 +00:00  
				
					
						
							
							
								 
						
							
								e18f0faff2 
								
							 
						 
						
							
							
								
								Lexing support for user-defined literals. Currently these lex as the same token  
							
							... 
							
							
							
							kinds as the underlying string literals, and we silently drop the ud-suffix;
those issues will be fixed by subsequent patches.
llvm-svn: 152012 
							
						 
						
							2012-03-05 04:02:15 +00:00  
				
					
						
							
							
								 
						
							
								9436352a82 
								
							 
						 
						
							
							
								
								Implement warning for non-wide string literals with an unexpected encoding.  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 
							
						 
						
							2012-02-11 05:08:10 +00:00  
				
					
						
							
							
								 
						
							
								e1224a5067 
								
							 
						 
						
							
							
								
								Fixing hex floating literal support so that it handles 0x.2p2 properly.  
							
							... 
							
							
							
							llvm-svn: 150072 
							
						 
						
							2012-02-08 13:36:33 +00:00  
				
					
						
							
							
								 
						
							
								b97a5addd5 
								
							 
						 
						
							
							
								
								Hex literals without a significand no longer crash the lexer.  Fixes bug 7910  
							
							... 
							
							
							
							Patch by Eitan Adler
llvm-svn: 149984 
							
						 
						
							2012-02-07 13:46:03 +00:00  
				
					
						
							
							
								 
						
							
								2c1dd2716a 
								
							 
						 
						
							
							
								
								Basic: import SmallString<> into clang namespace  
							
							... 
							
							
							
							(I was going to fix the TODO about DenseMap too, but
that would break self-host right now. See PR11922.)
llvm-svn: 149799 
							
						 
						
							2012-02-05 02:13:05 +00:00  
				
					
						
							
							
								 
						
							
								9c2d6f0279 
								
							 
						 
						
							
							
								
								stop claiming unicode escape sequences are too long in strings, because they never are  
							
							... 
							
							
							
							llvm-svn: 148391 
							
						 
						
							2012-01-18 12:27:08 +00:00  
				
					
						
							
							
								 
						
							
								8b2b677f39 
								
							 
						 
						
							
							
								
								Improves support for Unicode in character literals  
							
							... 
							
							
							
							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 
							
						 
						
							2012-01-18 12:27:04 +00:00  
				
					
						
							
							
								 
						
							
								d60b72f696 
								
							 
						 
						
							
							
								
								Fix a regression in wide character codegen. See PR11369.  
							
							... 
							
							
							
							llvm-svn: 144521 
							
						 
						
							2011-11-14 05:17:37 +00:00  
				
					
						
							
							
								 
						
							
								20554708fb 
								
							 
						 
						
							
							
								
								Fix one last place where we weren't writing into a string literal consistently.  
							
							... 
							
							
							
							llvm-svn: 143769 
							
						 
						
							2011-11-05 00:41:04 +00:00  
				
					
						
							
							
								 
						
							
								d1370791c2 
								
							 
						 
						
							
							
								
								Use native endianness for writing out character escapes to the result buffer for string literal parsing.  No functional change on little-endian architectures; should fix test failures on PPC.  
							
							... 
							
							
							
							llvm-svn: 143585 
							
						 
						
							2011-11-02 23:06:23 +00:00  
				
					
						
							
							
								 
						
							
								703e7153af 
								
							 
						 
						
							
							
								
								Perform proper conversion for strings encoded in the source file as UTF-8.  (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 
							
						 
						
							2011-11-01 02:14:50 +00:00  
				
					
						
							
							
								 
						
							
								227c352bae 
								
							 
						 
						
							
							
								
								We do parse hexfloats in C++11; make it actually work.  
							
							... 
							
							
							
							llvm-svn: 141798 
							
						 
						
							2011-10-12 18:51:02 +00:00  
				
					
						
							
							
								 
						
							
								4d68366b2f 
								
							 
						 
						
							
							
								
								When parsing a character literal, extract the characters from the  
							
							... 
							
							
							
							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 
							
						 
						
							2011-09-27 17:00:18 +00:00  
				
					
						
							
							
								 
						
							
								9c902b5502 
								
							 
						 
						
							
							
								
								Rename Diagnostic to DiagnosticsEngine as per issue 5397  
							
							... 
							
							
							
							llvm-svn: 140478 
							
						 
						
							2011-09-25 23:23:43 +00:00  
				
					
						
							
							
								 
						
							
								76bd3c80d4 
								
							 
						 
						
							
							
								
								Fix missing includes for llvm_unreachable  
							
							... 
							
							
							
							llvm-svn: 140368 
							
						 
						
							2011-09-23 05:35:21 +00:00  
				
					
						
							
							
								 
						
							
								83d382b1ca 
								
							 
						 
						
							
							
								
								Switch assert(0/false) llvm_unreachable.  
							
							... 
							
							
							
							llvm-svn: 140367 
							
						 
						
							2011-09-23 05:06:16 +00:00  
				
					
						
							
							
								 
						
							
								0706d203cf 
								
							 
						 
						
							
							
								
								Rename LangOptions::Microsoft to LangOptions::MicrosoftExt to make it clear 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 
							
						 
						
							2011-09-17 17:15:52 +00:00  
				
					
						
							
							
								 
						
							
								86325ad2b5 
								
							 
						 
						
							
							
								
								Allow C99 hexfloats in C++0x mode. This change resolves the standards  
							
							... 
							
							
							
							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 
							
						 
						
							2011-08-30 22:40:35 +00:00  
				
					
						
							
							
								 
						
							
								6eb2058a6a 
								
							 
						 
						
							
							
								
								Warn about and truncate UCNs that are too big for their character literal type.  
							
							... 
							
							
							
							llvm-svn: 138031 
							
						 
						
							2011-08-19 03:20:12 +00:00  
				
					
						
							
							
								 
						
							
								9f8a02d34e 
								
							 
						 
						
							
							
								
								De-Unicode-ify.  
							
							... 
							
							
							
							llvm-svn: 137430 
							
						 
						
							2011-08-12 05:49:51 +00:00  
				
					
						
							
							
								 
						
							
								5265bb211d 
								
							 
						 
						
							
							
								
								Raw string followup. Pass a couple StringRefs by value.  
							
							... 
							
							
							
							llvm-svn: 137301 
							
						 
						
							2011-08-11 05:10:55 +00:00  
				
					
						
							
							
								 
						
							
								54edccafc5 
								
							 
						 
						
							
							
								
								Add support for C++0x raw string literals.  
							
							... 
							
							
							
							llvm-svn: 137298 
							
						 
						
							2011-08-11 04:06:15 +00:00