aboutsummaryrefslogtreecommitdiff
path: root/test/Lexer
AgeCommit message (Collapse)Author
2013-05-21Merging r181342:Bill Wendling
------------------------------------------------------------------------ r181342 | rsmith | 2013-05-07 12:32:56 -0700 (Tue, 07 May 2013) | 4 lines C++1y: Update __cplusplus to temporary value 201305L to allow detection of provisional C++1y support. Add __has_feature and __has_extension checks for C++1y features (based on the provisional names from the C++ features study group), and update documentation to match. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_33@182340 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-04Reverting r181004 since it has broken test/Sema/wchar.c.Aaron Ballman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181122 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-03Support __wchar_t in -fms-extensions and -fms-compatibility modes.Hans Wennborg
MSVC provides __wchar_t, either as an alias for the built-in wchar_t type, or as a separate type depending on language (C vs C++) and flags (-fno-wchar). In -fms-extensions, Clang will simply accept __wchar_t as an alias for whatever type is used for wide character literals. In -fms-compatibility, we try to mimic MSVC's behavior by always making __wchar_t a builtin type. This fixes PR15815. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181004 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-02Use a triple ensure that __has_feature(c_thread_local) is 1 in C11 mode.Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180925 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-02Only evaluate __has_feature(c_thread_local) and ↵Douglas Gregor
__has_feature(cxx_thread_local) true when the target supports thread-local storage. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180909 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-19Note that we support (and in fact have supported since the dawn of time itself)Richard Smith
C++1y binary literals. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179883 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-19Keep the parentheses in #pragma message (partial revert of r179771).Andy Gibbs
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179862 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-19C++11 support is now feature-complete.Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179861 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-18Dropped the parentheses for #pragma message and its kin in the -E output ↵Andy Gibbs
generator. This was a suggestion by Jordan Rose since the documented format for these pragmas is without the parentheses. At the same time, I've increased test coverage too for the preprocessed output. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179771 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-17Implemented #pragma GCC warning/error in the same mould as #pragma message.Andy Gibbs
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179687 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-11Add -Wc99-compat warning for C11 unicode string and character literals.Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176817 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-09When lexing in C11 mode, accept unicode character and string literals, per C11Richard Smith
6.4.4.4/1 and 6.4.5/1. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176780 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-09Handle _Pragma on a u8, u, or U string literal per the C11 specification. AlsoRichard Smith
handle raw string literals here. C++11 doesn't yet specify how they will behave, but discussion on core suggests that we should just strip off everything but the r-char-sequence. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176779 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06After issuing a diagnostic for undefining or redefining a builtin macro,Richard Smith
continue parsing the directive rather than silently discarding it. Allowing undef or redef of __TIME__ and __DATE__ is important to folks who want stable, reproducible builds. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176540 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-31Lexer: Don't warn about Unicode in preprocessor directives.Jordan Rose
This allows people to use Unicode in their #pragma mark and in macros that exist only to be string-ized. <rdar://problem/13107323&13121362> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174081 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-30Fix comment in test/Lexer/utf8-invalid.c for updates in r173959.Jordan Rose
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173961 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-30Fix r173881 to properly skip invalid UTF-8 characters in raw lexing and -E.Jordan Rose
This caused hangs as we processed the same invalid byte over and over. <rdar://problem/13115651> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173959 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-30Don't warn about Unicode characters in -E mode.Jordan Rose
People use the C preprocessor for things other than C files. Some of them have Unicode characters. We shouldn't warn about Unicode characters appearing outside of identifiers in this case. There's not currently a way for the preprocessor to tell if it's in -E mode, so I added a new flag, derived from the PreprocessorOutputOptions. This is only used by the Unicode warnings for now, but could conceivably be used by other warnings or even behavioral differences later. <rdar://problem/13107323> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173881 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28FileCheck'ize and merge testsDmitri Gribenko
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173714 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28PR15067 (again): Don't warn about UCNs in C90 if we're raw-lexing.Jordan Rose
Fixes a crash. Thanks, Richard. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173701 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-27PR15067: Don't assert when a UCN appears in a C90 file.Jordan Rose
Unfortunately, we can't accept the UCN as an extension because we're required to treat it as two tokens for preprocessing purposes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173622 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-26Migrate tests to -verifyDmitri Gribenko
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173582 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-24FileCheck'ize testDmitri Gribenko
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173393 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-24As an extension, treat Unicode whitespace characters as whitespace.Jordan Rose
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173370 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-24Handle universal character names and Unicode characters outside of literals.Jordan Rose
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173369 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23Don't check lines beginning with '#', since they could contain a path with ↵Bill Wendling
the unexpected word in them. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173306 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23The diagnostic is now a warning instead of an error. Also don't check lines ↵Bill Wendling
beginning with '#', since they could contain a path with the unexpected word in them. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173305 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16Add raw string literal versus C preprocessor test, suggested by James Dennett.Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172660 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-20Add __has_feature(memory_sanitizer).Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170686 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-17tsan: add __has_feature(thread_sanitizer)Dmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170314 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-30Support for #pragma region/endregion for MSVC compatibility. Patch thanks ↵Aaron Ballman
to pravic! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169028 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-17Fix crash on end-of-file after \ in a char literal, fixes PR14369.Nico Weber
This makes LexCharConstant() look more like LexStringLiteral(), which doesn't have this bug. Add tests for eof after \ for several other cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168269 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-17Made the "expected string literal" diagnostic more expressiveAndy Gibbs
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168267 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-11FileCheckize testNico Weber
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167680 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-05Use the individual -fsanitize=<...> arguments to control which of the UBSanRichard Smith
checks to enable. Remove frontend support for -fcatch-undefined-behavior, -faddress-sanitizer and -fthread-sanitizer now that they don't do anything. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167413 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-19Prior to adding the new "expected-no-diagnostics" directive to ↵Andy Gibbs
VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166280 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-24Change the wording of the extension warning fromDmitri Gribenko
> '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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164545 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-08When a bad UTF-8 encoding or bogus escape sequence is encountered in aRichard Smith
string literal, produce a diagnostic pointing at the erroneous character range, not at the start of the literal. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163459 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-11Allow -verify directives to be filtered by preprocessing.Jordan Rose
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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160068 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-19Fix the location of the fixit for -Wnewline-eof.Jordan Rose
It turns out SourceManager treating the "one-past-the-end" location as invalid, but then failing to set the invalid flag properly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158699 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-15[-E] Emit a rewritten _Pragma on its own line.Jordan Rose
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) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158571 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-15PR12717: Clang supports hexadecimal floating-point literals in all languageRichard Smith
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158487 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-13Fix off-by-one error in UTF-16 encoding: don't try to use a surrogate pair ↵Richard Smith
for U+FFFF. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158391 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-04Add a predefine __WINT_UNSIGNED__, similar to __WCHAR_UNSIGNED__, and test ↵James Molloy
them both for ARM and X86. Use this to fully fix Sema/format-strings.c for non-x86 platforms. Reviewed by Chandler on IRC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156169 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-15Fix tests that weren't actually verifying anything.David Blaikie
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154776 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-15%clang -cc1 -> %clang_cc1Seth Cantrell
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154757 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-13Support -Wc++98-compat-pedantic as requested:Seth Cantrell
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120409/056126.html git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154655 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-13C++11 no longer requires files to end with a newlineSeth Cantrell
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154643 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-10Add a query macro for C++11 N3276, decltype does not require completeDouglas Gregor
return types, from Michel Morin! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154428 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-07ext_reserved_user_defined_literal must not default to Error in ↵Francois Pichet
MicrosoftMode. Hence create ext_ms_reserved_user_defined_literal that doesn't default to Error; otherwise MSVC headers won't parse. Fixes PR12383. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154273 91177308-0d34-0410-b5e6-96231b3b80d8