summaryrefslogtreecommitdiffstats
path: root/clang/test/Lexer
Commit message (Collapse)AuthorAgeFilesLines
...
* As an extension, treat Unicode whitespace characters as whitespace.Jordan Rose2013-01-241-0/+6
| | | | llvm-svn: 173370
* Handle universal character names and Unicode characters outside of literals.Jordan Rose2013-01-241-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | This is a missing piece for C99 conformance. This patch handles UCNs by adding a '\\' case to LexTokenInternal and LexIdentifier -- if we see a backslash, we tentatively try to read in a UCN. If the UCN is not syntactically well-formed, we fall back to the old treatment: a backslash followed by an identifier beginning with 'u' (or 'U'). Because the spelling of an identifier with UCNs still has the UCN in it, we need to convert that to UTF-8 in Preprocessor::LookUpIdentifierInfo. Of course, valid code that does *not* use UCNs will see only a very minimal performance hit (checks after each identifier for non-ASCII characters, checks when converting raw_identifiers to identifiers that they do not contain UCNs, and checks when getting the spelling of an identifier that it does not contain a UCN). This patch also adds basic support for actual UTF-8 in the source. This is treated almost exactly the same as UCNs except that we consider stray Unicode characters to be mistakes and offer a fixit to remove them. llvm-svn: 173369
* Don't check lines beginning with '#', since they could contain a path with ↵Bill Wendling2013-01-231-1/+1
| | | | | | the unexpected word in them. llvm-svn: 173306
* The diagnostic is now a warning instead of an error. Also don't check lines ↵Bill Wendling2013-01-231-1/+1
| | | | | | beginning with '#', since they could contain a path with the unexpected word in them. llvm-svn: 173305
* Add raw string literal versus C preprocessor test, suggested by James Dennett.Richard Smith2013-01-161-0/+9
| | | | llvm-svn: 172660
* Add __has_feature(memory_sanitizer).Evgeniy Stepanov2012-12-201-0/+11
| | | | llvm-svn: 170686
* tsan: add __has_feature(thread_sanitizer)Dmitry Vyukov2012-12-171-0/+11
| | | | llvm-svn: 170314
* Support for #pragma region/endregion for MSVC compatibility. Patch thanks ↵Aaron Ballman2012-11-301-0/+33
| | | | | | to pravic! llvm-svn: 169028
* Fix crash on end-of-file after \ in a char literal, fixes PR14369.Nico Weber2012-11-173-0/+24
| | | | | | | This makes LexCharConstant() look more like LexStringLiteral(), which doesn't have this bug. Add tests for eof after \ for several other cases. llvm-svn: 168269
* Made the "expected string literal" diagnostic more expressiveAndy Gibbs2012-11-171-0/+2
| | | | llvm-svn: 168267
* FileCheckize testNico Weber2012-11-111-4/+4
| | | | llvm-svn: 167680
* Use the individual -fsanitize=<...> arguments to control which of the UBSanRichard Smith2012-11-051-1/+1
| | | | | | | checks to enable. Remove frontend support for -fcatch-undefined-behavior, -faddress-sanitizer and -fthread-sanitizer now that they don't do anything. llvm-svn: 167413
* Prior to adding the new "expected-no-diagnostics" directive to ↵Andy Gibbs2012-10-199-4/+13
| | | | | | VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. llvm-svn: 166280
* Change the wording of the extension warning fromDmitri Gribenko2012-09-241-0/+22
| | | | | | | | | > 'long long' is an extension when C99 mode is not enabled to > 'long long' is a C++11 extension while compiling in C++98 mode. llvm-svn: 164545
* When a bad UTF-8 encoding or bogus escape sequence is encountered in aRichard Smith2012-09-081-0/+25
| | | | | | | string literal, produce a diagnostic pointing at the erroneous character range, not at the start of the literal. llvm-svn: 163459
* Allow -verify directives to be filtered by preprocessing.Jordan Rose2012-07-112-7/+8
| | | | | | | | | | | | | | | | | | | | | This is accomplished by making VerifyDiagnosticsConsumer a CommentHandler, which then only reads the -verify directives that are actually in live blocks of code. It also makes it simpler to handle -verify directives that appear in header files, though we still have to manually reparse some files depending on how they are generated. This requires some test changes. In particular, all PCH tests now have their -verify directives outside the "header" portion of the file, using the @line syntax added in r159978. Other tests have been modified mostly to make it clear what is being tested, and to prevent polluting the expected output with the directives themselves. Patch by Andy Gibbs! (with slight modifications) The new Frontend/verify-* tests exercise the functionality of this commit, as well as r159978, r159979, and r160053 (Andy's other -verify enhancements). llvm-svn: 160068
* Fix the location of the fixit for -Wnewline-eof.Jordan Rose2012-06-191-0/+4
| | | | | | | It turns out SourceManager treating the "one-past-the-end" location as invalid, but then failing to set the invalid flag properly. llvm-svn: 158699
* [-E] Emit a rewritten _Pragma on its own line.Jordan Rose2012-06-151-1/+0
| | | | | | | | | | | 1. Teach Lexer that pragma lexers are like macro expansions at EOF. 2. Treat pragmas like #define/#undef when printing. 3. If we just printed a directive, add a newline before any more tokens. (4. Miscellaneous cleanup in PrintPreprocessedOutput.cpp) PR10594 and <rdar://problem/11562490> (two separate related problems) llvm-svn: 158571
* PR12717: Clang supports hexadecimal floating-point literals in all languageRichard Smith2012-06-152-0/+15
| | | | | | | | | | | | | modes. For languages other than C99/C11, this isn't quite a conforming extension, and for C++11, it breaks some reasonable code containing user-defined literals. In languages which don't officially have hexfloats, pare back this extension to only apply in cases where the token starts 0x and does not contain an underscore. The extension is still not quite conforming, but it's a lot closer now. llvm-svn: 158487
* Fix off-by-one error in UTF-16 encoding: don't try to use a surrogate pair ↵Richard Smith2012-06-131-0/+3
| | | | | | for U+FFFF. llvm-svn: 158391
* Add a predefine __WINT_UNSIGNED__, similar to __WCHAR_UNSIGNED__, and test ↵James Molloy2012-05-041-0/+8
| | | | | | | | | | them both for ARM and X86. Use this to fully fix Sema/format-strings.c for non-x86 platforms. Reviewed by Chandler on IRC. llvm-svn: 156169
* Fix tests that weren't actually verifying anything.David Blaikie2012-04-151-1/+1
| | | | | | | | | | | | | | Passing -verify to clang without -cc1 or -Xclang silently passes (with a printed warning, but lit doesn't care about that). This change adds -cc1 or, as is necessary in one case, -Xclang to fix this so that these tests are actually verifying as intended. I'd like to change the driver so this kind of mistake could not be made, but I'm not entirely sure how. Further, since the driver only warns about unknown flags in general, we could have similar bugs with a misspellings of arguments that would be nice to find. llvm-svn: 154776
* %clang -cc1 -> %clang_cc1Seth Cantrell2012-04-152-2/+2
| | | | llvm-svn: 154757
* Support -Wc++98-compat-pedantic as requested:Seth Cantrell2012-04-131-0/+4
| | | | | | http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120409/056126.html llvm-svn: 154655
* C++11 no longer requires files to end with a newlineSeth Cantrell2012-04-132-2/+6
| | | | llvm-svn: 154643
* Add a query macro for C++11 N3276, decltype does not require completeDouglas Gregor2012-04-101-0/+10
| | | | | | return types, from Michel Morin! llvm-svn: 154428
* ext_reserved_user_defined_literal must not default to Error in ↵Francois Pichet2012-04-071-0/+6
| | | | | | | | MicrosoftMode. Hence create ext_ms_reserved_user_defined_literal that doesn't default to Error; otherwise MSVC headers won't parse. Fixes PR12383. llvm-svn: 154273
* Add feature check "cxx_local_type_template_args" describing supportDouglas Gregor2012-04-042-0/+17
| | | | | | | for templates with local template arguments, from Michel Morin! Fixes PR12337. llvm-svn: 153983
* User-defined literals are done.Richard Smith2012-03-091-0/+9
| | | | llvm-svn: 152396
* When checking the encoding of an 8-bit string literal, don't just check theRichard Smith2012-03-082-2/+21
| | | | | | | 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
* User-defined literals: reject string and character UDLs in all places where theRichard Smith2012-03-061-0/+19
| | | | | | | | | | grammar requires a string-literal and not a user-defined-string-literal. The two constructs are still represented by the same TokenKind, in order to prevent a combinatorial explosion of different kinds of token. A flag on Token tracks whether a ud-suffix is present, in order to prevent clients from needing to look at the token's spelling. llvm-svn: 152098
* Add a pile of tests for unrestricted unions, and advertise support for them.Richard Smith2012-03-031-0/+9
| | | | llvm-svn: 151992
* Merge __has_attribute tests. Patch by Jonathan Sauer!Jean-Daniel Dupas2012-03-011-12/+0
| | | | llvm-svn: 151819
* Initializer lists are now supported.Sebastian Redl2012-02-251-0/+9
| | | | llvm-svn: 151458
* Accept __has_feature(__feature__) as a synonym for __has_feature(feature) (andRichard Smith2012-02-251-0/+6
| | | | | | likewise for __has_extension). Patch by Jonathan Sauer! llvm-svn: 151445
* Clang now supports lambda expressions.Douglas Gregor2012-02-231-1/+1
| | | | llvm-svn: 151231
* Advertize support for constexpr.Richard Smith2012-02-141-0/+9
| | | | llvm-svn: 150524
* Implement warning for non-wide string literals with an unexpected encoding. ↵Eli Friedman2012-02-112-4/+12
| | | | | | 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-1/+3
| | | | llvm-svn: 150072
* Hex literals without a significand no longer crash the lexer. Fixes bug 7910Aaron Ballman2012-02-071-0/+1
| | | | | | Patch by Eitan Adler llvm-svn: 149984
* Improve the error message slightly for files that aren't using the expected ↵Eli Friedman2012-01-252-10/+10
| | | | | | UTF-8 encoding. Patch by Seth Cantrell. llvm-svn: 148991
* Add and update tests for character literalsSeth Cantrell2012-01-185-5/+40
| | | | llvm-svn: 148392
* Some improvements to the handling of C11 atomic types:David Chisnall2012-01-162-0/+18
| | | | | | | | | | | | | | | | | | - Add atomic-to/from-nonatomic cast types - Emit atomic operations for arithmetic on atomic types - Emit non-atomic stores for initialisation of atomic types, but atomic stores and loads for every other store / load - Add a __atomic_init() intrinsic which does a non-atomic store to an _Atomic() type. This is needed for the corresponding C11 stdatomic.h function. - Enables the relevant __has_feature() checks. The feature isn't 100% complete yet, but it's done enough that we want people testing it. Still to do: - Make the arithmetic operations on atomic types (e.g. Atomic(int) foo = 1; foo++;) use the correct LLVM intrinsic if one exists, not a loop with a cmpxchg. - Add a signal fence builtin - Properly set the fenv state in atomic operations on floating point values - Correctly handle things like _Atomic(_Complex double) which are too large for an atomic cmpxchg on some platforms (this requires working out what 'correctly' means in this context) - Fix the many remaining corner cases llvm-svn: 148242
* Add __has_feature(modules) to indicate when modules are available (inDouglas Gregor2012-01-041-1/+15
| | | | | | | | | any language variant), and restrict __has_feature(objc_modules) to mean that we also have the Objective-C @import syntax. I anticipate __has_feature(cxx_modules) and/or __has_feature(c_modules) for when we nail down the module syntax for C/C++. llvm-svn: 147548
* Add __has_feature(objc_modules)Douglas Gregor2012-01-031-0/+11
| | | | llvm-svn: 147482
* In Lexer::getCharAndSizeSlow[NoWarn] if we come up againstArgyrios Kyrtzidis2011-12-221-0/+1
| | | | | | | | | | \<newline><newline> don't consume the second newline. Thanks to David Blaikie for pointing out the crash! llvm-svn: 147138
* In Lexer::getCharAndSizeSlow[NoWarn] make sure we don't go over the end of ↵Argyrios Kyrtzidis2011-12-211-0/+3
| | | | | | | | | | the buffer when the end of the buffer is immediately after an escaped newline. Fixes http://llvm.org/PR10153. llvm-svn: 147091
* Modify how the -verify flag works. Currently, the verification string andRichard Trieu2011-12-153-31/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostic message are compared. If either is a substring of the other, then no error is given. This gives rise to an unexpected case: // expect-error{{candidate function has different number of parameters}} will match the following error messages from Clang: candidate function has different number of parameters (expected 1 but has 2) candidate function has different number of parameters It will also match these other error messages: candidate function function has different number of parameters number of parameters This patch will change so that the verification string must be a substring of the diagnostic message before accepting. Also, all the failing tests from this change have been corrected. Some stats from this cleanup: 87 - removed extra spaces around verification strings 70 - wording updates to diagnostics 40 - extra leading or trailing characters (typos, unmatched parens or quotes) 35 - diagnostic level was included (error:, warning:, or note:) 18 - flag name put in the warning (-Wprotocol) llvm-svn: 146619
* Implement support for the __is_final type trait, to determine whetherDouglas Gregor2011-12-031-0/+5
| | | | | | | a class is marked 'final', from Alberto Ganesh Barbati! Fixes PR11462. llvm-svn: 145775
* implement __has_feature(address_sanitizer); also use ↵Kostya Serebryany2011-11-221-0/+11
| | | | | | LangOpts.AddressSanitizer instead of CodeGenOpts.AddressSanitizer llvm-svn: 145054
OpenPOWER on IntegriCloud