summaryrefslogtreecommitdiffstats
path: root/clang/test/Lexer
Commit message (Collapse)AuthorAgeFilesLines
* Add -std=c++20 flag, replace C++2a with C++20 throughout the ClangRichard Smith2020-02-192-15/+15
| | | | | | | | | | | | | user interface and documentation, and update __cplusplus for C++20. WG21 considers the C++20 standard to be finished (even though it still has some more steps to pass through in the ISO process). The old flag names are accepted for compatibility, as usual, and we still have lots of references to C++2a in comments and identifiers; those can be cleaned up separately. (cherry picked from commit 24ad121582454e625bdad125c90d9ac0dae948c8)
* [Concepts] Deprecate -fconcepts-ts, enable Concepts under -std=c++2aSaar Raz2020-01-242-8/+7
| | | | | | | | | Now with concepts support merged and mostly complete, we do not need -fconcepts-ts (which was also misleading as we were not implementing the TS) and can enable concepts features under C++2a. A warning will be generated if users still attempt to use -fconcepts-ts. (cherry picked from commit 67c608a9695496cfc9d3fdf9d0b12b554ac6b4df)
* Fix crash on init-capture packs where the type of the initializer is ↵Richard Smith2019-12-191-1/+3
| | | | non-dependent.
* Implement latest C++ feature test macro recommendations.Richard Smith2019-12-191-1/+17
| | | | | | | | We don't yet advertise init capture packs, because I found some bugs while testing it. We reject-valid and then crash on both of these: template<int ...a> auto x = [...y = a] {}; template<int ...a> auto x = [y = a...] {};
* Mark the major papers for C++20 consistent comparisons as "done", andRichard Smith2019-12-151-0/+4
| | | | start publishing the corresponding feature-test macro.
* Revert "Revert "As a follow-up to my initial mail to llvm-dev here's a first ↵Eric Christopher2019-11-261-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | pass at the O1 described there."" This reapplies: 8ff85ed905a7306977d07a5cd67ab4d5a56fafb4 Original commit message: As a follow-up to my initial mail to llvm-dev here's a first pass at the O1 described there. This change doesn't include any change to move from selection dag to fast isel and that will come with other numbers that should help inform that decision. There also haven't been any real debuggability studies with this pipeline yet, this is just the initial start done so that people could see it and we could start tweaking after. Test updates: Outside of the newpm tests most of the updates are coming from either optimization passes not run anymore (and without a compelling argument at the moment) that were largely used for canonicalization in clang. Original post: http://lists.llvm.org/pipermail/llvm-dev/2019-April/131494.html Tags: #llvm Differential Revision: https://reviews.llvm.org/D65410 This reverts commit c9ddb02659e3ece7a0d9d6b4dac7ceea4ae46e6d.
* Revert "As a follow-up to my initial mail to llvm-dev here's a first pass at ↵Muhammad Omair Javaid2019-11-261-16/+16
| | | | | | | | | | | | | | | | | | | | | | | the O1 described there." This reverts commit 8ff85ed905a7306977d07a5cd67ab4d5a56fafb4. This commit introduced 9 new failures on lldb buildbot host at http://lab.llvm.org:8014/builders/lldb-aarch64-ubuntu Following tests were failing: lldb-api :: functionalities/tail_call_frames/ambiguous_tail_call_seq1/TestAmbiguousTailCallSeq1.py lldb-api :: functionalities/tail_call_frames/ambiguous_tail_call_seq2/TestAmbiguousTailCallSeq2.py lldb-api :: functionalities/tail_call_frames/disambiguate_call_site/TestDisambiguateCallSite.py lldb-api :: functionalities/tail_call_frames/disambiguate_paths_to_common_sink/TestDisambiguatePathsToCommonSink.py lldb-api :: functionalities/tail_call_frames/disambiguate_tail_call_seq/TestDisambiguateTailCallSeq.py lldb-api :: functionalities/tail_call_frames/inlining_and_tail_calls/TestInliningAndTailCalls.py lldb-api :: functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py lldb-api :: functionalities/tail_call_frames/thread_step_out_message/TestArtificialFrameStepOutMessage.py lldb-api :: functionalities/tail_call_frames/thread_step_out_or_return/TestSteppingOutWithArtificialFrames.py lldb-api :: functionalities/tail_call_frames/unambiguous_sequence/TestUnambiguousTailCalls.py Tags: #llvm Differential Revision: https://reviews.llvm.org/D65410
* As a follow-up to my initial mail to llvm-dev here's a first pass at the O1 ↵Eric Christopher2019-11-251-16/+16
| | | | | | | | | | | | | | | | | | | | | described there. This change doesn't include any change to move from selection dag to fast isel and that will come with other numbers that should help inform that decision. There also haven't been any real debuggability studies with this pipeline yet, this is just the initial start done so that people could see it and we could start tweaking after. Test updates: Outside of the newpm tests most of the updates are coming from either optimization passes not run anymore (and without a compelling argument at the moment) that were largely used for canonicalization in clang. Original post: http://lists.llvm.org/pipermail/llvm-dev/2019-April/131494.html Tags: #llvm Differential Revision: https://reviews.llvm.org/D65410
* Mark P0784R7 as complete and start defining its feature-test macro.Richard Smith2019-10-031-0/+4
| | | | | | | Note that this only covers the language side of this feature. (The library side has its own feature test macro.) llvm-svn: 373548
* Move normalization of `\` in #includes from -fms-compatibility to ↵Reid Kleckner2019-09-262-8/+6
| | | | | | | | | -fms-extensions Handling backslashes in include paths in the implementation isn't non-conforming. llvm-svn: 372999
* [clang] [Basic] Enable __has_feature(leak_sanitizer)Michal Gorny2019-09-221-0/+11
| | | | | | | | | | Add a 'leak_sanitizer' feature akin to existing '*_sanitizer' features to let programmers switch code paths accounting for leak sanitizers being enabled. Differential Revision: https://reviews.llvm.org/D67719 llvm-svn: 372527
* [c++20] P1143R2: Add support for the C++20 'constinit' keyword.Richard Smith2019-09-042-0/+6
| | | | | | | | | | | | | This is mostly the same as the [[clang::require_constant_initialization]] attribute, but has a couple of additional syntactic and semantic restrictions. In passing, I added a warning for the attribute form being added after we have already seen the initialization of the variable (but before we see the definition); that case previously slipped between the cracks and the attribute was silently ignored. llvm-svn: 370972
* Try fixing CRLF issues in Git with [clang-scan-deps] Minimizer: Correctly ↵Alexandre Ganea2019-08-281-0/+16
| | | | | | | | handle multi-line content with CR+LF line endings Differential Revision: https://reviews.llvm.org/D66556 llvm-svn: 370219
* Delete minimize_source_to_dependency_directives_invalid_error.cHans Wennborg2019-08-281-16/+0
| | | | | | | | It was added in r370129 with a .gitattributes file that means the file always shows up as having a local diff in Git checkouts (at least on Linux). Deleting it until we can figure out the right way to do this. llvm-svn: 370175
* Re-land [clang-scan-deps] Minimizer: Correctly handle multi-line content ↵Alexandre Ganea2019-08-281-0/+16
| | | | | | | | | | with CR+LF line endings Previously, an #error directive with quoted, multi-line content, along with CR+LF line endings wasn't handled correctly. Differential Revision: https://reviews.llvm.org/D66556 llvm-svn: 370129
* Revert "[clang-scan-deps] Minimizer: Correctly handle multi-line content ↵Richard Smith2019-08-271-16/+0
| | | | | | | | | | | | with CR+LF line endings" This reverts commit r369986. This change added a dependency on the 'dos2unix' tool, which is not one of our accepted test dependencies and may not exist on all machines that build Clang. llvm-svn: 370000
* [clang-scan-deps] Skip UTF-8 BOM in source minimizerAlexandre Ganea2019-08-271-0/+10
| | | | | | Differential Revision: https://reviews.llvm.org/D66511 llvm-svn: 369993
* [clang-scan-deps] Minimizer: Correctly skip over double slashes in angle ↵Alexandre Ganea2019-08-261-0/+8
| | | | | | | | | | bracket #include Previously, double slashes (//) occurring in angle brackets #include were incorrectly interpreted as comments. eg. #include <dir//file.h> Differential Revision: https://reviews.llvm.org/D66550 llvm-svn: 369988
* [clang-scan-deps] Minimizer: Correctly handle multi-line content with CR+LF ↵Alexandre Ganea2019-08-261-0/+16
| | | | | | | | | | line endings Previously, an #error directive with quoted, multi-line content, along with CR+LF line endings wasn't handled correctly. Differential Revision: https://reviews.llvm.org/D66556 llvm-svn: 369986
* Implement P1668R1Erich Keane2019-08-191-1/+1
| | | | | | | Allow inline assembly statements in unexecuted branches of constexpr functions. llvm-svn: 369281
* ARM MTE stack sanitizer.Evgeniy Stepanov2019-07-151-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | Add "memtag" sanitizer that detects and mitigates stack memory issues using armv8.5 Memory Tagging Extension. It is similar in principle to HWASan, which is a software implementation of the same idea, but there are enough differencies to warrant a new sanitizer type IMHO. It is also expected to have very different performance properties. The new sanitizer does not have a runtime library (it may grow one later, along with a "debugging" mode). Similar to SafeStack and StackProtector, the instrumentation pass (in a follow up change) will be inserted in all cases, but will only affect functions marked with the new sanitize_memtag attribute. Reviewers: pcc, hctim, vitalybuka, ostannard Subscribers: srhines, mehdi_amini, javed.absar, kristof.beyls, hiraditya, cryptoad, steven_wu, dexonsmith, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D64169 llvm-svn: 366123
* Add clang source minimizer that reduces source to directivesAlex Lorenz2019-06-033-0/+9
| | | | | | | | | | | | | | | | | | | | | that might affect the dependency list for a compilation This commit introduces a dependency directives source minimizer to clang that minimizes header and source files to the minimum necessary preprocessor directives for evaluating includes. It reduces the source down to #define, #include, The source minimizer works by lexing the input with a custom fast lexer that recognizes the preprocessor directives it cares about, and emitting those directives in the minimized source. It ignores source code, comments, and normalizes whitespace. It gives up and fails if seems any directives that it doesn't recognize as valid (e.g. #define 0). In addition to the source minimizer this patch adds a -print-dependency-directives-minimized-source CC1 option that allows you to invoke the minimizer from clang directly. Differential Revision: https://reviews.llvm.org/D55463 llvm-svn: 362459
* Factor out repeated code parsing and concatenating header-names fromRichard Smith2019-03-191-2/+2
| | | | | | | | | | | tokens. We now actually form an angled_string_literal token for a header name by concatenation rather than just working out what its contents would be. This substantially simplifies downstream processing and is necessary for C++20 header unit imports. llvm-svn: 356433
* Remove esan.Nico Weber2019-03-111-12/+0
| | | | | | | | | | | It hasn't seen active development in years, and it hasn't reached a state where it was useful. Remove the code until someone is interested in working on it again. Differential Revision: https://reviews.llvm.org/D59133 llvm-svn: 355862
* Enable coroutines under -std=c++2a.Richard Smith2019-02-232-1/+5
| | | | llvm-svn: 354736
* [MSVC] Recognize `static_assert` keyword in C and C++98Reid Kleckner2019-02-152-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The main effect is that clang now accepts the following conforming C11 code with MSVC headers: #include <assert.h> static_assert(1, "true"); This is a non-conforming extension (the keyword is outside the implementer's namespace), so it is placed under -fms-compatibility instead of -fms-extensions like most MSVC-specific keyword extensions. Normally, in C11, the compiler is supposed to provide the _Static_assert keyword, and assert.h should define static_assert to _Static_assert. However, that is not what MSVC does, and MSVC doesn't even provide _Static_assert. This also has the less important side effect of enabling static_assert in C++98 mode with -fms-compatibility. It's exceptionally difficult to use modern MSVC headers without C++14 even, so this is relatively unimportant. Fixes PR26672 Patch by Andrey Bokhanko! Reviewers: rsmith, thakis Subscribers: cfe-commits, STL_MSFT Differential Revision: https://reviews.llvm.org/D17444 llvm-svn: 354162
* [NFC] Explicitly add -std=c++14 option to tests that rely on the C++14 defaultNemanja Ivanovic2019-02-052-4/+4
| | | | | | | | | | | When Clang/LLVM is built with the CLANG_DEFAULT_STD_CXX CMake macro that sets the default standard to something other than C++14, there are a number of lit tests that fail as they rely on the C++14 default. This patch just adds the language standard option explicitly to such test cases. Differential revision: https://reviews.llvm.org/D57581 llvm-svn: 353163
* Disable _Float16 for non ARM/SPIR TargetsErich Keane2019-01-251-1/+1
| | | | | | | | | | | | | | As Discussed here: http://lists.llvm.org/pipermail/llvm-dev/2019-January/129543.html There are problems exposing the _Float16 type on architectures that haven't defined the ABI/ISel for the type yet, so we're temporarily disabling the type and making it opt-in. Differential Revision: https://reviews.llvm.org/D57188 Change-Id: I5db7366dedf1deb9485adb8948b1deb7e612a736 llvm-svn: 352221
* Implementation Feature Test Macros for P0722R3Chris Kennelly2019-01-111-0/+4
| | | | | | | | | | | | | | | | | Summary: P1353R0, adopted in San Diego, specified an implementation feature test macro for destroying delete (P0722R3). The implementation of the feature (https://reviews.llvm.org/rL315662) is not guarded behind a flag, so the macro is not conditional on language version. Reviewers: rsmith Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55741 llvm-svn: 350934
* [c++20] Implement P0482R6: enable -fchar8_t by default in C++20 mode.Richard Smith2018-11-141-64/+70
| | | | | | | | | | | | | This unfortunately results in a substantial breaking change when switching to C++20, but it's not yet clear what / how much we should do about that. We may want to add a compatibility conversion from u8 string literals to const char*, similar to how C++98 provided a compatibility conversion from string literals to non-const char*, but that's not handled by this patch. The feature can be disabled in C++20 mode with -fno-char8_t. llvm-svn: 346892
* Don't emit "will be treated as an identifier character" warning forRichard Smith2018-09-251-0/+5
| | | | | | | UTF-8 characters that aren't identifier characters in the current language mode. llvm-svn: 343040
* [Lexer] Add udefined_behavior_sanitizer featureLeonard Chan2018-09-221-0/+13
| | | | | | | | | This can be used to detect whether the code is being built with UBSan using the __has_feature(undefined_behavior_sanitizer) predicate. Differential Revision: https://reviews.llvm.org/D52386 llvm-svn: 342793
* [Lexer] Add xray_instrument featurePetr Hosek2018-09-171-0/+11
| | | | | | | | | This can be used to detect whether the code is being built with XRay instrumentation using the __has_feature(xray_instrument) predicate. Differential Revision: https://reviews.llvm.org/D52159 llvm-svn: 342358
* PR38870: Add warning for zero-width unicode characters appearing inRichard Smith2018-09-071-0/+7
| | | | | | identifiers. llvm-svn: 341700
* [MSan] add KMSAN support to Clang driverAlexander Potapenko2018-09-071-0/+1
| | | | | | | | | | | | | | | Boilerplate code for using KMSAN instrumentation in Clang. We add a new command line flag, -fsanitize=kernel-memory, with a corresponding SanitizerKind::KernelMemory, which, along with SanitizerKind::Memory, maps to the memory_sanitizer feature. KMSAN is only supported on x86_64 Linux. It's incompatible with other sanitizers, but supports code coverage instrumentation. llvm-svn: 341641
* [CMake] Use normalized Windows target triplesPetr Hosek2018-08-091-1/+1
| | | | | | | | | | | Changes the default Windows target triple returned by GetHostTriple.cmake from the old environment names (which we wanted to move away from) to newer, normalized ones. This also requires updating all tests to use the new systems names in constraints. Differential Revision: https://reviews.llvm.org/D47381 llvm-svn: 339307
* [Preprocessor] Allow libc++ to detect when aligned allocation is unavailable.Volodymyr Sapsai2018-08-031-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Libc++ needs to know when aligned allocation is supported by clang, but is otherwise unavailable at link time. Otherwise, libc++ will incorrectly end up generating calls to `__builtin_operator_new`/`__builtin_operator_delete` with alignment arguments. This patch implements the following changes: * The `__cpp_aligned_new` feature test macro to no longer be defined when aligned allocation is otherwise enabled but unavailable. * The Darwin driver no longer passes `-faligned-alloc-unavailable` when the user manually specifies `-faligned-allocation` or `-fno-aligned-allocation`. * Instead of a warning Clang now generates a hard error when an aligned allocation or deallocation function is referenced but unavailable. Patch by Eric Fiselier. Reviewers: rsmith, vsapsai, erik.pilkington, ahatanak, dexonsmith Reviewed By: rsmith Subscribers: Quuxplusone, cfe-commits Differential Revision: https://reviews.llvm.org/D45015 llvm-svn: 338934
* [Driver] Add -fno-digraphsJacob Bandes-Storch2018-07-171-2/+21
| | | | | | | | | | | | | | Summary: Add a flag `-fno-digraphs` to disable digraphs in the lexer, similar to `-fno-operator-names` which disables alternative names for C++ operators. Reviewers: rsmith Reviewed By: rsmith Subscribers: rsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D48266 llvm-svn: 337232
* P0096R5, P0941R2: Update to match latest feature test macro specification.Richard Smith2018-06-141-8/+23
| | | | llvm-svn: 334677
* As discussed with SG10, bump version of __cpp_deduction_guides macro to ↵Richard Smith2018-05-301-1/+1
| | | | | | indicate support for P0620R0. llvm-svn: 333587
* Implement P0482R2, support for char8_t type.Richard Smith2018-05-012-0/+24
| | | | | | | | | | | | This is not yet part of any C++ working draft, and so is controlled by the flag -fchar8_t rather than a -std= flag. (The GCC implementation is controlled by a flag with the same name.) This implementation is experimental, and will be removed or revised substantially to match the proposal as it makes its way through the C++ committee. llvm-svn: 331244
* hwasan: add -fsanitize=kernel-hwaddress flagAndrey Konovalov2018-04-131-0/+1
| | | | | | | | | This patch adds -fsanitize=kernel-hwaddress flag, that essentially enables -hwasan-kernel=1 -hwasan-recover=1 -hwasan-match-all-tag=0xff. Differential Revision: https://reviews.llvm.org/D45046 llvm-svn: 330044
* [ObjC] Allow declaring __strong pointer fields in structs in Objective-CAkira Hatanaka2018-02-281-0/+8
| | | | | | | | | | | | | | | | | | | | | ARC mode. Declaring __strong pointer fields in structs was not allowed in Objective-C ARC until now because that would make the struct non-trivial to default-initialize, copy/move, and destroy, which is not something C was designed to do. This patch lifts that restriction. Special functions for non-trivial C structs are synthesized that are needed to default-initialize, copy/move, and destroy the structs and manage the ownership of the objects the __strong pointer fields point to. Non-trivial structs passed to functions are destructed in the callee function. rdar://problem/33599681 Differential Revision: https://reviews.llvm.org/D41228 llvm-svn: 326307
* [Lex] Fix handling numerical literals ending with ' and signed exponent.Volodymyr Sapsai2018-02-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | For input `0'e+1` lexer tokenized as numeric constant only `0'e`. Later NumericLiteralParser skipped 0 and ' as digits and parsed `e+1` as valid exponent going past the end of the token. Because it didn't mark numeric literal as having an error, it continued parsing and tried to expandUCNs with StringRef of length -2. The fix is not to parse exponent when we reached the end of token. Discovered by OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4588 rdar://problem/36076719 Reviewers: rsmith, t.p.northover Reviewed By: rsmith Subscribers: cfe-commits, jkorous-apple Differential Revision: https://reviews.llvm.org/D41834 llvm-svn: 324419
* [Lex] Avoid out-of-bounds dereference in LexAngledStringLiteral.Volodymyr Sapsai2018-01-121-0/+0
| | | | | | | | | | | | | | | | | | | | | | Fix makes the loop in LexAngledStringLiteral more like the loops in LexStringLiteral, LexCharConstant. When we skip a character after backslash, we need to check if we reached the end of the file instead of reading the next character unconditionally. Discovered by OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3832 rdar://problem/35572754 Reviewers: arphaman, kcc, rsmith, dexonsmith Reviewed By: rsmith, dexonsmith Subscribers: cfe-commits, rsmith, dexonsmith Differential Revision: https://reviews.llvm.org/D41423 llvm-svn: 322390
* Warn if we find a Unicode homoglyph for a symbol in an identifier.Richard Smith2017-12-141-0/+5
| | | | | | | | | | | | | | | | Specifically, warn if: * we find a character that the language standard says we must treat as an identifier, and * that character is not reasonably an identifier character (it's a punctuation character or similar), and * it renders identically to a valid non-identifier character in common fixed-width fonts. Some tools "helpfully" substitute the surprising characters for the expected characters, and replacing semicolons with Greek question marks is a common "prank". llvm-svn: 320697
* Switch to gnu++14 as the default dialect.Tim Northover2017-12-092-3/+3
| | | | | | This is C++14 with conforming GNU extensions. llvm-svn: 320250
* Hardware-assisted AddressSanitizer (clang part).Evgeniy Stepanov2017-12-091-0/+13
| | | | | | | | | | | | | | Summary: Driver, frontend and LLVM codegen for HWASan. A clone of ASan, basically. Reviewers: kcc, pcc, alekseyshl Subscribers: srhines, javed.absar, cfe-commits Differential Revision: https://reviews.llvm.org/D40936 llvm-svn: 320232
* [c++2a] P0515R3: Support for overloaded operator<=>.Richard Smith2017-12-011-2/+2
| | | | | | No CodeGen support for MSABI yet, we don't know how to mangle this there. llvm-svn: 319513
* [c++2a] P0515R3: lexer support for new <=> token.Richard Smith2017-12-011-0/+73
| | | | llvm-svn: 319509
OpenPOWER on IntegriCloud