summaryrefslogtreecommitdiffstats
path: root/clang/test/Lexer
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix a minor bug in lexing pp-numbers with digit separators: if a pp-number ↵Richard Smith2014-02-281-0/+2
| | | | | | contains "'e+", the pp-number ends between the 'e' and the '+'. llvm-svn: 202533
* Lexer: Issue -Wbackslash-newline-escape for line commentsAlp Toker2013-12-141-0/+1
| | | | | | | | | | | | The warning for backslash and newline separated by whitespace was missed in this code path. backslash<whitespace><newline> is handled differently from compiler to compiler so it's important to warn consistently where there's ambiguity. Matches similar handling of block comments and non-comment lines. llvm-svn: 197331
* Revert "Don't require -re suffix on -verify directives with regexes."Alp Toker2013-12-141-1/+1
| | | | | | | | | | This patch was submitted to the list for review and didn't receive a LGTM. (In fact one explicit objection and one query were raised.) This reverts commit r197295. llvm-svn: 197299
* Don't require -re suffix on -verify directives with regexes.Hans Wennborg2013-12-141-1/+1
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D2392 llvm-svn: 197295
* Change semantics of regex expectations in the diagnostic verifierHans Wennborg2013-12-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Previously, a line like // expected-error-re {{foo}} treats the entirety of foo as a regex. This is inconvenient when matching type names containing regex characters. For example, to match "void *(class test8::A::*)(void)" inside such a regex, one would have to type "void \*\(class test8::A::\*\)\(void\)". This patch changes the semantics of expected-error-re to only treat the parts of the directive wrapped in double curly braces as regexes. This avoids the escaping problem and leads to nicer patterns for those cases; see e.g. the change to test/Sema/format-strings-scanf.c. (The balanced search for closing }} of a directive also makes us handle the full directive in test\SemaCXX\constexpr-printing.cpp:41 and :53.) Differential Revision: http://llvm-reviews.chandlerc.com/D2388 llvm-svn: 197092
* Add support for C++'s SD6 feature test macros.Richard Smith2013-11-271-0/+89
| | | | llvm-svn: 195888
* Relax header guard mismatch warning with edit distance heuristic.Ismail Pazarbasi2013-10-122-0/+6
| | | | | | If the edit distance between the two macros is more than 50%, DefinedMacro may not be header guard or can be header guard of another header file or it might be defining something completely different set by the build environment. llvm-svn: 192547
* Mark lambda init-captures as complete.Richard Smith2013-09-282-1/+18
| | | | llvm-svn: 191607
* Mark variable template implementation as complete. Nearly all of the creditRichard Smith2013-09-272-5/+16
| | | | | | here goes to Larisse Voufo. llvm-svn: 191549
* Add macro test from N3781.Richard Smith2013-09-261-0/+5
| | | | llvm-svn: 191444
* Per updates to D3781, allow underscore under ' in a pp-number, and allow ' ↵Richard Smith2013-09-261-2/+6
| | | | | | in a #line directive. llvm-svn: 191443
* Implement C++1y digit separator proposal (' as a digit separator). This is notRichard Smith2013-09-262-0/+35
| | | | | | yet approved by full committee, but was unanimously supported by EWG. llvm-svn: 191417
* Lex and ignore Microsoft's #pragma warning(...)Reid Kleckner2013-09-131-0/+22
| | | | | | | | | | | | | | | | | Summary: This fixes PR17145 and avoids unknown pragma warnings. This change does not attempt to map MSVC warning numbers to clang warning flags. Perhaps in the future we will implement a mapping for some common subset of Microsoft warnings, but for now we don't. Reviewers: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1652 llvm-svn: 190726
* Add specific warning flags for GNU ext in lexer.Eli Friedman2013-09-051-0/+56
| | | | | | | | | | | | | This patch adds the following flags covering existing warnings: -Wgnu-zero-variadic-macro-arguments -Wgnu-imaginary-constant -Wgnu-binary-literal -Wgnu-zero-line-directive Patch by Peter Lewis. llvm-svn: 190017
* Revise -Wnewline-eof test per feedback from Dmitri.Jordan Rose2013-08-231-6/+6
| | | | llvm-svn: 189113
* Respect -Wnewline-eof even in C++11 mode.Jordan Rose2013-08-233-8/+10
| | | | | | | | | | | If the user has requested this warning, we should emit it, even if it's not an extension in the current language mode. However, being an extension is more important, so prefer the pedantic warning or the pedantic-compatibility warning if those are enabled. <rdar://problem/12922063> llvm-svn: 189110
* Revert r188863 which could propose wrong fixits for multibyte character ↵Nick Lewycky2013-08-211-11/+0
| | | | | | literals. llvm-svn: 188918
* Issue fixits replacing invalid character literals with the equivalent \xNNNick Lewycky2013-08-211-0/+11
| | | | | | escape code. llvm-svn: 188863
* Fix FileCheck --check-prefix lines.Tim Northover2013-08-122-3/+3
| | | | | | | | | | Various tests had sprung up over the years which had --check-prefix=ABC on the RUN line, but "CHECK-ABC:" later on. This happened to work before, but was strictly incorrect. FileCheck is getting stricter soon though. Patch by Ron Ofir. llvm-svn: 188174
* Partially revert r186903.Eli Friedman2013-07-261-1/+1
| | | | | | | | It turns out that Plum Hall depends on us not emitting an error on integer literals which fit into long long, but fit into unsigned long long. So C99 conformance requires not conforming to C99. :) llvm-svn: 187172
* Update documentation to match current C++1y feature set.Richard Smith2013-07-241-0/+20
| | | | llvm-svn: 187055
* Integers which are too large should be an error.Eli Friedman2013-07-231-1/+6
| | | | | | | | Switch some warnings over to errors which should never have been warnings in the first place. (Also, a minor fix to the preprocessor rules for integer literals while I'm here.) llvm-svn: 186903
* Add 'not' to commands that are expected to fail.Rafael Espindola2013-07-043-3/+3
| | | | | | | This is at least good documentation, but also opens the possibility of using pipefail. llvm-svn: 185652
* PR16339: Don't produce a diagnostic pointing at the whitespace between a '#if'Richard Smith2013-06-162-1/+15
| | | | | | | | and a '!defined(X)' if we find a broken header guard. This is suboptimal; we should point the diagnostic at the 'X' token not the 'if' token, but it fixes the crash. llvm-svn: 184054
* Introducing -Wheader-guard, a warning that checks header guards actually workRichard Trieu2013-06-128-0/+66
| | | | | | | | properly. This warning checks that the #ifndef and #define directives at the beginning of a header refer to the same macro name. Includes a fix-it hint to correct the header guard. llvm-svn: 183867
* Better diagnostics for string initialization.Hans Wennborg2013-05-151-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit improves Clang's diagnostics for string initialization. Where it would previously say: /tmp/a.c:3:9: error: array initializer must be an initializer list wchar_t s[] = "Hi"; ^ /tmp/a.c:4:6: error: array initializer must be an initializer list or string literal char t[] = L"Hi"; ^ It will now say /tmp/a.c:3:9: error: initializing wide char array with non-wide string literal wchar_t s[] = "Hi"; ^ /tmp/a.c:4:6: error: initializing char array with wide string literal char t[] = L"Hi"; ^ As a bonus, it also fixes the fact that Clang would previously reject this valid C11 code: char16_t s[] = u"hi"; char32_t t[] = U"hi"; because it would only recognize the built-in types for char16_t and char32_t, which do not exist in C. llvm-svn: 181880
* C++1y: provide full 'auto' return type deduction for lambda expressions. ThisRichard Smith2013-05-121-0/+10
| | | | | | completes the implementation of N3638. llvm-svn: 181669
* C++1y: Update __cplusplus to temporary value 201305L to allow detection of ↵Richard Smith2013-05-072-64/+124
| | | | | | | | | 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. llvm-svn: 181342
* Reverting r181004 since it has broken test/Sema/wchar.c.Aaron Ballman2013-05-042-24/+0
| | | | llvm-svn: 181122
* Support __wchar_t in -fms-extensions and -fms-compatibility modes.Hans Wennborg2013-05-032-0/+24
| | | | | | | | | | | | | | 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. llvm-svn: 181004
* Use a triple ensure that __has_feature(c_thread_local) is 1 in C11 mode.Douglas Gregor2013-05-021-1/+1
| | | | llvm-svn: 180925
* Only evaluate __has_feature(c_thread_local) and ↵Douglas Gregor2013-05-021-2/+4
| | | | | | __has_feature(cxx_thread_local) true when the target supports thread-local storage. llvm-svn: 180909
* Note that we support (and in fact have supported since the dawn of time itself)Richard Smith2013-04-191-0/+19
| | | | | | C++1y binary literals. llvm-svn: 179883
* Keep the parentheses in #pragma message (partial revert of r179771).Andy Gibbs2013-04-192-3/+3
| | | | llvm-svn: 179862
* C++11 support is now feature-complete.Richard Smith2013-04-192-0/+27
| | | | llvm-svn: 179861
* Dropped the parentheses for #pragma message and its kin in the -E output ↵Andy Gibbs2013-04-182-1/+20
| | | | | | | | 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. llvm-svn: 179771
* Implemented #pragma GCC warning/error in the same mould as #pragma message.Andy Gibbs2013-04-171-0/+16
| | | | llvm-svn: 179687
* Add -Wc99-compat warning for C11 unicode string and character literals.Richard Smith2013-03-111-0/+21
| | | | llvm-svn: 176817
* When lexing in C11 mode, accept unicode character and string literals, per C11Richard Smith2013-03-093-1/+33
| | | | | | 6.4.4.4/1 and 6.4.5/1. llvm-svn: 176780
* Handle _Pragma on a u8, u, or U string literal per the C11 specification. AlsoRichard Smith2013-03-091-1/+19
| | | | | | | | 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. llvm-svn: 176779
* After issuing a diagnostic for undefining or redefining a builtin macro,Richard Smith2013-03-061-0/+19
| | | | | | | | | 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. llvm-svn: 176540
* Lexer: Don't warn about Unicode in preprocessor directives.Jordan Rose2013-01-312-0/+15
| | | | | | | | | This allows people to use Unicode in their #pragma mark and in macros that exist only to be string-ized. <rdar://problem/13107323&13121362> llvm-svn: 174081
* Fix comment in test/Lexer/utf8-invalid.c for updates in r173959.Jordan Rose2013-01-301-2/+1
| | | | llvm-svn: 173961
* Fix r173881 to properly skip invalid UTF-8 characters in raw lexing and -E.Jordan Rose2013-01-301-0/+6
| | | | | | | | This caused hangs as we processed the same invalid byte over and over. <rdar://problem/13115651> llvm-svn: 173959
* Don't warn about Unicode characters in -E mode.Jordan Rose2013-01-301-0/+9
| | | | | | | | | | | | | | | 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> llvm-svn: 173881
* FileCheck'ize and merge testsDmitri Gribenko2013-01-282-6/+9
| | | | llvm-svn: 173714
* PR15067 (again): Don't warn about UCNs in C90 if we're raw-lexing.Jordan Rose2013-01-281-0/+3
| | | | | | Fixes a crash. Thanks, Richard. llvm-svn: 173701
* PR15067: Don't assert when a UCN appears in a C90 file.Jordan Rose2013-01-271-2/+4
| | | | | | | 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
* Migrate tests to -verifyDmitri Gribenko2013-01-262-2/+5
| | | | llvm-svn: 173582
* FileCheck'ize testDmitri Gribenko2013-01-241-6/+7
| | | | llvm-svn: 173393
OpenPOWER on IntegriCloud