summaryrefslogtreecommitdiffstats
path: root/clang/test/Lexer
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix test from r256596Nico Weber2015-12-291-1/+1
| | | | llvm-svn: 256599
* Emit a -Wmicrosoft warning when treating ^Z as EOF in MS mode.Nico Weber2015-12-291-2/+2
| | | | llvm-svn: 256596
* In Objective-C, ignore attempts to redefine the ARC/GC qualifier macros.John McCall2015-12-101-0/+22
| | | | | | | | | | | | | | This works around existing system headers which unconditionally redefine these macros. This is reasonably safe to do because we used to warn about it anyway (outside of system headers). Continue to warn if the redefinition would have changed the expansion. Still permit redefinition if the macro is explicitly #undef'ed first. rdar://23788307 llvm-svn: 255311
* [coroutines] Add forgotten test for lexing coroutines keywords.Richard Smith2015-10-221-0/+12
| | | | llvm-svn: 250992
* [coroutines] Add feature-test macro for coroutines, defined to 1 to indicateRichard Smith2015-10-221-0/+5
| | | | | | the implementation is incomplete. llvm-svn: 250982
* When pretty-printing a C++11 literal operator, don't insert whitespace betweenRichard Smith2015-10-081-1/+1
| | | | | | | the "" and the suffix; that breaks names such as 'operator""if'. For symmetry, also remove the space between the 'operator' and the '""'. llvm-svn: 249641
* Add -f[no-]declspec to control recognition of __declspec as a keywordSaleem Abdulrasool2015-10-042-0/+37
| | | | | | | | | | | | | | | In versions of clang prior to r238238, __declspec was recognized as a keyword in all modes. It was then changed to only be enabled when Microsoft or Borland extensions were enabled (and for CUDA, as a temporary measure). There is a desire to support __declspec in Playstation code, and possibly other environments. This commit adds a command-line switch to allow explicit enabling/disabling of the recognition of __declspec as a keyword. Recognition is enabled by default in Microsoft, Borland, CUDA, and PS4 environments, and disabled in all other environments. Patch by Warren Ristow! llvm-svn: 249279
* Add test that we correctly allow some non-letter unicode characters inRichard Smith2015-09-191-1/+10
| | | | | | identifiers, and extend existing test to also cover C++. llvm-svn: 248079
* Split off the binary literal warning into a subgroup of C++14 warningsRichard Trieu2015-09-181-0/+5
| | | | | | | | | Binary literals predate C++14, but they are listed as a C++14 extension since this was the first time they were standardized in the language. Move the warning into a subgroup so it can be selectively disabled when checking for other C++14 features. llvm-svn: 248064
* Turn off __has_feature(cxx_rtti) when -fno-rtti-data is presentReid Kleckner2015-08-131-0/+1
| | | | | | | | | | | -fno-rtti-data makes it so that vtables emitted in the current TU lack RTTI data. This means that dynamic_cast usually fails at runtime. Users of the existing cxx_rtti feature expect all of RTTI to work, not just some of it. Chromium bug for context: http://crbug.com/518191 llvm-svn: 244922
* [Tests] Add explicit -std=lang option to a number of tests.Yunzhong Gao2015-08-013-3/+3
| | | | | | | | | | | This patch should not change the test results, but it is useful if clang's default C++ language is ever changed from gnu++98. Patch by: Charles Li http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20150727/134667.html llvm-svn: 243819
* [MS Extensions] Remove support for the i128 integer literal suffixDavid Majnemer2015-07-261-4/+0
| | | | | | | | | | | | | There is currently no support in MSVC for using i128 as an integer literal suffix. In fact, there appears to be no evidence that they have ever supported this feature in any of their compilers. This was an over generalization of their actual feature and is a nasty source of bugs. Why is it a source of bugs? Because most code in clang expects that evaluation of an integer constant expression won't give them something that 'long long' can't represent. Instead of providing a meaningful feature, i128 gives us cute ways of exploding the compiler. llvm-svn: 243243
* Add missing files for objc_boxable feature.Alex Denisov2015-07-232-0/+16
| | | | | | Original patch [r240761] is missing all new files because of committer's mistake. llvm-svn: 243018
* [ASan] Initial support for Kernel AddressSanitizerAlexander Potapenko2015-06-191-0/+1
| | | | | | | | | This patch adds initial support for the -fsanitize=kernel-address flag to Clang. Right now it's quite restricted: only out-of-line instrumentation is supported, globals are not instrumented, some GCC kasan flags are not supported. Using this patch I am able to build and boot the KASan tree with LLVMLinux patches from github.com/ramosian-glider/kasan/tree/kasan_llvmlinux. To disable KASan instrumentation for a certain function attribute((no_sanitize("kernel-address"))) can be used. llvm-svn: 240131
* [Concepts] lex keywords: concept and requiresHubert Tong2015-06-051-0/+11
| | | | | | | | | | | | | | | | | | | | | | Summary: This patch enables lexing of `concept` and `requires` as keywords. Further changes which add messages for future keyword compat are to follow. Test Plan: Testing of C++14 + Concepts TS mode is added to `test/Lexer/keywords_test.cpp`, which expects that the new keywords are enabled under said mode. Reviewers: faisalv, fraggamuffin, rsmith Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D10233 llvm-svn: 239128
* Apply existing checks to C++1Z (has_feature_cxx0x); NFCFaisal Vali2015-05-221-43/+85
| | | | | | | | | | | | This applies the existing checks in has_feature_cxx0x to -std=c++1z. In addition, references to C++1y are updated to refer to C++14 No functional change. Testing of __has_feature for C++1z features is not added in this change. Patch by Hubert Tong! llvm-svn: 237992
* "This adds -fconcepts-ts as a cc1 option for enabling theFaisal Vali2015-05-221-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | in-progress implementation of the Concepts TS. The recommended feature test macro __cpp_experimental_concepts is set to 1 (as opposed to 201501) to indicate that the feature is enabled, but the implementation is incomplete. The link to the Concepts TS in cxx_status is updated to refer to the PDTS (N4377). Additional changes related to __has_feature and __has_extension are to follow in a later change. Relevant tests include: test/Lexer/cxx-features.cpp The test file is updated with testing of the C++14 + Concepts TS mode. The expected behaviour is the same as that of the C++14 modes except for the case of __cpp_experimental_concepts." - Hubert Tong. Being committed for Hubert (as per his understanding with Richard Smith) as we start work on the concepts-ts following our preliminary strategy session earlier today. The patch is tiny and seems quite standard. Thanks Hubert! llvm-svn: 237982
* Have '__have_extension(cxx_variadic_templates)' return true for any C++ ↵Eric Fiselier2015-05-121-0/+5
| | | | | | standard. llvm-svn: 237202
* Fix buffer overflow in LexerKostya Serebryany2015-05-041-0/+8
| | | | | | | | | | | | | | | | | | | | | Summary: Fix PR22407, where the Lexer overflows the buffer when parsing #include<\ (end of file after slash) Test Plan: Added a test that will trigger in asan build. This case is also covered by the clang-fuzzer bot. Reviewers: rnk Reviewed By: rnk Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D9489 llvm-svn: 236466
* [lex] Don't read past the end of the bufferBenjamin Kramer2015-03-291-0/+9
| | | | | | | | | While dereferencing ThisTokEnd is fine and we know that it's not in [a-zA-Z0-9_.], ThisTokEnd[1] is really past the end. Found by asan and with a little help from clang-fuzz. llvm-svn: 233491
* C++14: Disable sized deallocation by default due to ABI breakageReid Kleckner2015-03-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are no widely deployed standard libraries providing sized deallocation functions, so we have to punt and ask the user if they want us to use sized deallocation. In the future, when such libraries are deployed, we can teach the driver to detect them and enable this feature. N3536 claimed that a weak thunk from sized to unsized deallocation could be emitted to avoid breaking backwards compatibility with standard libraries not providing sized deallocation. However, this approach and other variations don't work in practice. With the weak function approach, the thunk has to have default visibility in order to ensure that it is overridden by other DSOs providing sized deallocation. Weak, default visibility symbols are particularly expensive on MachO, so John McCall was considering disabling this feature by default on Darwin. It also changes behavior ELF linking behavior, causing certain otherwise unreferenced object files from an archive to be pulled into the link. Our second approach was to use an extern_weak function declaration and do an inline conditional branch at the deletion call site. This doesn't work because extern_weak only works on MachO if you have some archive providing the default value of the extern_weak symbol. Arranging to provide such an archive has the same challenges as providing the symbol in the standard library. Not to mention that extern_weak doesn't really work on COFF. Reviewers: rsmith, rjmccall Differential Revision: http://reviews.llvm.org/D8467 llvm-svn: 232788
* Add -fuse-line-directive flag to control usage of #line with -EReid Kleckner2015-02-261-1/+1
| | | | | | | | | | | | | | | | | | Currently -fms-extensions controls this behavior, which doesn't make much sense. It means we can't identify what is and isn't a system header when compiling our own preprocessed output, because #line doesn't represent this information. If someone is feeding Clang's preprocessed output to another compiler, they can use this flag. Fixes PR20553. Reviewers: rsmith Differential Revision: http://reviews.llvm.org/D5217 llvm-svn: 230587
* Add driver flags -ftrigraphs, -fno-trigraphs.Nico Weber2014-12-235-12/+12
| | | | | | | | | | | | | | | | | -trigraphs is now an alias for -ftrigraphs. -fno-trigraphs makes it possible to explicitly disable trigraphs, which couldn't be done before. clang -std=c++11 -fno-trigraphs now builds without GNU extensions, but with trigraphs disabled. Previously, trigraphs were only disabled in GNU modes or with -std=c++1z. Make the new -f flags the cc1 interface too. This requires changing -trigraphs to -ftrigraphs in a few cc1 tests. Related to PR21974. llvm-svn: 224790
* MSVC: A wide string literal from L#macro_arg in a macroAlexey Bataev2014-12-151-0/+11
| | | | | | | | Clang should form a wide string literal from L#macro_arg in a function-like macro in -fms-compatibility mode. Fix for http://llvm.org/PR9984. Differential Revision: http://reviews.llvm.org/D6604 llvm-svn: 224228
* Lex: Don't crash if both conflict markers are on the same lineDavid Majnemer2014-12-141-0/+2
| | | | | | | | | | We would check if the terminator marker is on a newline. However, the logic would end up out-of-bounds if the terminator marker immediately follows the start marker. This fixes PR21820. llvm-svn: 224210
* Add support for has_feature(cxx_alignof) and has_feature(c_alignof).Nico Weber2014-12-033-4/+26
| | | | | | | r142020 added support for has_feature(cxx_alignas). This does the same for alignof. llvm-svn: 223186
* Update Clang's SD-6 support to match N4200 (except for __has_cpp_attribute,Richard Smith2014-11-121-0/+36
| | | | | | which we don't yet implement). llvm-svn: 221816
* [c++1z] Support for u8 character literals.Richard Smith2014-11-081-0/+9
| | | | llvm-svn: 221576
* [Thumb] Clang thinks "char" is signed when using a thumb tripleOliver Stannard2014-10-241-0/+1
| | | | | | | | 'char' is unsigned on all ARM and Thumb architectures. Clang gets this right for ARM, and for thumb when using and arm triple and the -mthumb option, but gets it wrong for thumb triples. This fixes that. llvm-svn: 220555
* Switch C compilations to C11 by default.Richard Smith2014-10-202-4/+10
| | | | | | | | This is long-since overdue, and matches GCC 5.0. This should also be backwards-compatible, because we already supported all of C11 as an extension in C99 mode. llvm-svn: 220244
* Don't destroy MacroInfos if we find the macro definition is invalid; it'll getRichard Smith2014-08-031-0/+2
| | | | | | destroyed on shutdown regardless. Fixes a double-delete. llvm-svn: 214675
* Improving the "integer constant too large" diagnostics based on post-commit ↵Aaron Ballman2014-07-241-2/+2
| | | | | | feedback from Richard Smith. Amends r213657. llvm-svn: 213865
* Provide extra information in the "integer constant is too large" diagnostic. ↵Aaron Ballman2014-07-221-2/+2
| | | | | | This will be used to improve other diagnostics. llvm-svn: 213657
* Make MS i128 suffix test from r211446 more robustAlp Toker2014-06-211-2/+4
| | | | | | We want to catch both negative and positive failure conditions. llvm-svn: 211449
* The i128 suffix isn't always available.David Majnemer2014-06-211-0/+2
| | | | | | | | This Lexer test unconditionally used the i128 integer literal suffix. This suffix is only available to targets that have 128-bit arithmetic support. llvm-svn: 211446
* [C++1z] Implement N3981: Disable trigraphs by default in C++1z mode.Richard Smith2014-06-201-0/+9
| | | | llvm-svn: 211392
* Show -Wdate-time in system headersAlp Toker2014-06-101-0/+15
| | | | | | | | | | Anyone enabling this warning would expect to hear about all occurrences including those in system headers that can cause non-reproducible builds. To achieve this, rework ShowInSystemHeader to remove broken unused mapping code that didn't make sense with a simpler and correct scheme. llvm-svn: 210512
* Implement -Wdate-time preprocessor warningAlp Toker2014-06-101-0/+8
| | | | | | | This GCC warning is useful for validating reproducible builds and might help when tracking down issues with modules too. llvm-svn: 210511
* Permit the "if" literal suffix with Microsoft extensions enabled.Peter Collingbourne2014-05-291-0/+4
| | | | | | Differential Revision: http://reviews.llvm.org/D3963 llvm-svn: 209859
* Fixing some comments in this test. No functional changes.Aaron Ballman2014-05-191-3/+3
| | | | llvm-svn: 209128
* PR19698, PR19674: enable __has_feature checks for cxx_generic_lambdas andRichard Smith2014-05-091-0/+20
| | | | | | | cxx_decltype_auto, and fix documentation of cxx_generic_lambdas and cxx_init_captures to specify the right feature-check name. llvm-svn: 208445
* Clean up some existing keyword tests in the test/Lexer directory by using theYunzhong Gao2014-05-074-19/+34
| | | | | | | | pre-defined __is_identifier() macro. Differential Revision: http://reviews.llvm.org/D3460 llvm-svn: 208147
* Add some missing checks for C++1y digit separators that don't in fact separateRichard Smith2014-04-221-0/+14
| | | | | | | | digits. Turns out we have completely separate lexing codepaths for floating point numbers depending on whether or not they start with a zero. Who knew... =) llvm-svn: 206932
* Lex: Fix __has_feature(cxx_exceptions) for objective C++Justin Bogner2014-04-161-1/+7
| | | | | | | | | | | | | | | At one point, -fexceptions was a synonym for -fcxx-exceptions. While the driver options still enables cxx-exceptions by default, the cc1 flag is purely about exception tables and this doesn't account for objective C exceptions. Because of this, checking for the cxx_exceptions feature in objective C++ often gives the wrong answer. The cxx_exceptions feature should be based on the -fcxx-exceptions cc1 flag, not -fexceptions. Furthermore, at some point the tests were changed to use cc1 even though they were testing the driver behaviour. We're better off testing both the driver and cc1 here. llvm-svn: 206352
* Add a test to distinguish between reserved tokens and normal identifiers.Yunzhong Gao2014-04-111-0/+29
| | | | | | | | | | | | The -fms-extensions option affects a number of subtle front-end C/C++ behaviors, and it would be useful to be able to distinguish MS keywords from regular identifiers in the ms-extensions mode even if the triple does not define a Windows target. It should make life easier if anyone needs to port their Windows codes to elsewhere. Differential Revision: http://reviews.llvm.org/D3034 llvm-svn: 206069
* Added a __has_feature() for 'is_constructible'Marshall Clow2014-03-181-0/+5
| | | | llvm-svn: 204153
* Disable cross-windows-on-linux.cpp for now. It may or may not fail. :/NAKAMURA Takumi2014-03-121-0/+3
| | | | llvm-svn: 203642
* Lexer: split test into separate filesSaleem Abdulrasool2014-03-122-10/+14
| | | | | | | | Unfortunately, XFAIL applies to the entire file. Split the test into two different units, enabling the proper application of XFAIL on the test which is expected to fail on Windows. llvm-svn: 203633
* Lex: reduce buffer size, add a testSaleem Abdulrasool2014-03-122-0/+15
| | | | | | | Reduce the stack usage as hopefully include paths are usually not too long. Add a test case for the path normalisation behaviour. llvm-svn: 203632
* Tests for lexing of digit separators versus UCNs.Richard Smith2014-02-281-0/+20
| | | | llvm-svn: 202534
OpenPOWER on IntegriCloud