summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaOpenCLCXX
Commit message (Collapse)AuthorAgeFilesLines
* [OpenCL] Restrict addr space conversions in nested pointersAnastasia Stulova2020-02-123-1/+26
| | | | | | | | | | | | | | | | | | | | | | Address space conversion changes pointer representation. This commit disallows such conversions when they are not legal i.e. for the nested pointers even with compatible address spaces. Because the address space conversion in the nested levels can't be generated to modify the pointers correctly. The behavior implemented is as follows: - Any implicit conversions of nested pointers with different address spaces is rejected. - Any conversion of address spaces in nested pointers in safe casts (e.g. const_cast or static_cast) is rejected. - Conversion in low level C-style or reinterpret_cast is accepted but with a warning (this aligns with OpenCL C behavior). Fixes PR39674 Differential Revision: https://reviews.llvm.org/D73360 (cherry picked from commit 6064f426a18304e16b51cc79e74c9c2d55ef5a9c)
* Make address-space-lambda.cl pass on 32-bit WindowsHans Wennborg2020-01-241-6/+6
| | | | | | Member functions will have the thiscall attribute on them. (cherry picked from commit 698d1cd3b8154b3b74423386d3e111e6b756e87a)
* Clean up and slightly generalize implementation of composite pointerRichard Smith2020-01-101-0/+23
| | | | | | | | | | | type computation, in preparation for P0388R4, which adds another few cases here. We now properly handle forming multi-level composite pointer types involving nested Objective-C pointer types (as is consistent with including them as part of the notion of 'similar types' on which this rule is based). We no longer lose non-CVR qualifiers on nested pointer types.
* [OpenCL] Pretty print __private addr spaceAnastasia Stulova2019-12-274-29/+29
| | | | | | | | | | Add printing of __private address space to TypePrinter to allow it appears in diagnostics and AST dumps as all other language addr spaces. Tags: #clang Differential Revision: https://reviews.llvm.org/D71272
* [Sema] Improve diagnostic about addr spaces for overload candidatesAnastasia Stulova2019-12-132-8/+8
| | | | | | | | | | Allow sending address spaces into diagnostics to simplify and improve error reporting. Improved wording of diagnostics for address spaces in overloading. Tags: #clang Differential Revision: https://reviews.llvm.org/D71111
* [OpenCL] Allow addr space qualifiers on lambda call expressionsAnastasia Stulova2019-12-041-1/+29
| | | | | | | | | | | | | | | | | | | | | | | | | The addr space qualifier can be added optionally for lambdas after the attributes. They will alter the default addr space of lambda call operator that is in generic address space by default for OpenCL. Syntax: [ captures ] ( params ) specifiers exception attr opencl_addrspace -> ret { body } Example: [&] (int i) mutable __global { ... }; On the call into lambda a compatibility check will be performed to determine whether address space of lambda object and its call operator are compatible. This will follow regular addr space conversion rules and there will be no difference to how addr spaces work in method qualifiers. Tags: #clang Differential Revision: https://reviews.llvm.org/D70242
* [OpenCL] Use generic addr space for lambda call operatorAnastasia Stulova2019-12-031-0/+25
| | | | | | | | | | | | | | | Since lambdas are represented by callable objects, we add generic addr space for implicit object parameter in call operator. Any lambda variable declared in __constant addr space (which is not convertible to generic) fails to compile with a diagnostic. To support constant addr space we need to add a way to qualify the lambda call operators. Tags: #clang Differential Revision: https://reviews.llvm.org/D69938
* [OpenCL] Move addr space deduction to Sema.Anastasia Stulova2019-11-273-9/+58
| | | | | | | | | | | | | | | | In order to simplify implementation we are moving add space deduction into Sema while constructing variable declaration and on template instantiation. Pointee are deduced to generic addr space during creation of types. This commit also - fixed addr space dedution for auto type; - factors out in a separate helper function OpenCL specific logic from type diagnostics in var decl. Tags: #clang Differential Revision: https://reviews.llvm.org/D65744
* Quote the token being diagnosed for C11 extensions.Aaron Ballman2019-08-271-1/+1
| | | | llvm-svn: 370059
* Updating a test case that was missed in r369957.Aaron Ballman2019-08-261-1/+1
| | | | llvm-svn: 369968
* Diagnose use of _Thread_local as an extension when not in C11 mode.Aaron Ballman2019-08-261-0/+2
| | | | llvm-svn: 369954
* [OpenCL] Fix addr space deduction for pointers/references to arrays.Anastasia Stulova2019-08-191-0/+22
| | | | | | | | | | | Rewrite the logic for detecting if we are deducing addr space of a pointee type to take into account special logic for arrays. For pointers/references to arrays we can have any number of parentheses expressions as well as nested pointers. Differential Revision: https://reviews.llvm.org/D66137 llvm-svn: 369251
* [OpenCL] Rename lang mode flag for C++ modeAnastasia Stulova2019-07-2510-10/+10
| | | | | | | | | | | | Rename lang mode flag to -cl-std=clc++/-cl-std=CLC++ or -std=clc++/-std=CLC++. This aligns with OpenCL C conversion and removes ambiguity with OpenCL C++. Differential Revision: https://reviews.llvm.org/D65102 llvm-svn: 367008
* [OpenCL] Update comments/diagnostics to refer to C++ for OpenCLAnastasia Stulova2019-07-182-13/+13
| | | | | | | | | Clang doesn't implement OpenCL C++, change the comments to reflect that. Differential Revision: https://reviews.llvm.org/D64867 llvm-svn: 366421
* [OpenCL][PR42033] Fix addr space deduction with template parametersAnastasia Stulova2019-07-182-1/+16
| | | | | | | | | | | | | | | If dependent types appear in pointers or references we allow addr space deduction because the addr space in template argument will belong to the pointee and not the pointer or reference itself. We also don't diagnose addr space on a function return type after template instantiation. If any addr space for the return type was provided on a template parameter this will be diagnosed during the parsing of template definition. Differential Revision: https://reviews.llvm.org/D62584 llvm-svn: 366417
* Fix OpenCLCXX test on 32-bit Windows where thiscall is presentReid Kleckner2019-07-161-6/+6
| | | | llvm-svn: 366284
* [OpenCL] Deduce addr space for pointee of dependent types in instantiation.Anastasia Stulova2019-07-151-0/+39
| | | | | | | | | | Since pointee doesn't require context sensitive addr space deduction it's easier to handle pointee of dependent types during templ instantiation. Differential Revision: https://reviews.llvm.org/D64400 llvm-svn: 366063
* [OpenCL] Improve diagnostic for placement newSven van Haastregt2019-06-261-1/+1
| | | | | | | | | | | | | Without an explicit declaration for placement new, clang would reject uses of placement new with "'default new' is not supported in OpenCL C++". This may mislead users into thinking that placement new is not supported, see e.g. PR42060. Clarify that placement new requires an explicit declaration. Differential Revision: https://reviews.llvm.org/D63561 llvm-svn: 364423
* [Sema] Fix diagnostic for addr spaces in reference bindingAnastasia Stulova2019-06-211-0/+10
| | | | | | | | Extend reference binding behavior to account for address spaces. Differential Revision: https://reviews.llvm.org/D62914 llvm-svn: 364032
* [OpenCL][PR42031] Prevent deducing addr space in type alias.Anastasia Stulova2019-06-051-3/+17
| | | | | | | | | Similar to typedefs we shouldn't deduce addr space in type alias. Differential Revision: https://reviews.llvm.org/D62591 llvm-svn: 362611
* [Sema] Prevent binding incompatible addr space ref to temporariesAnastasia Stulova2019-06-051-0/+5
| | | | | | | | | | | | References to arbitrary address spaces can't always be bound to temporaries. This change extends the reference binding logic to check that the address space of a temporary can be implicitly converted to the address space in a reference when temporary materialization is performed. Differential Revision: https://reviews.llvm.org/D61318 llvm-svn: 362604
* [OpenCL] Prevent mangling kernel functions.Anastasia Stulova2019-05-071-0/+17
| | | | | | | | | | | | Kernel function names have to be preserved as in the original source to be able to access them from the host API side. This commit also adds restriction to kernels that prevents them from being used in overloading, templates, etc. Differential Revision: https://reviews.llvm.org/D60454 llvm-svn: 360152
* [OpenCL] Deduce static data members to __global addr space.Anastasia Stulova2019-05-021-0/+12
| | | | | | | | | Similarly to static variables in OpenCL, static class data members should be deduced to __global addr space. Differential Revision: https://reviews.llvm.org/D61304 llvm-svn: 359789
* [PR41247] Fixed parsing of private keyword in C++.Anastasia Stulova2019-03-281-0/+13
| | | | | | | | | Fixed bug in C++ to prevent parsing 'private' as a valid address space qualifier. Differential Revision: https://reviews.llvm.org/D59874 llvm-svn: 357162
* [OpenCL][PR40707] Allow OpenCL C types in C++ mode.Anastasia Stulova2019-02-151-22/+0
| | | | | | Allow all OpenCL types to be parsed in C++ mode. llvm-svn: 354121
* Fix ICE on reference binding with mismatching addr spaces.Anastasia Stulova2019-02-051-0/+14
| | | | | | | | | | | | When we attempt to add an addr space qual to a type already qualified by an addr space ICE is triggered. Before creating a type with new address space, remove the old addr space. Fixing PR38614! Differential Revision: https://reviews.llvm.org/D57524 llvm-svn: 353160
* [OpenCL] Add generic addr space to the return of implicit assignment.Anastasia Stulova2019-01-301-4/+3
| | | | | | | | | | When creating the prototype of implicit assignment operators the returned reference to the class should be qualified with the same addr space as 'this' (i.e. __generic in OpenCL). Differential Revision: https://reviews.llvm.org/D57101 llvm-svn: 352617
* [OpenCL] Allow address spaces as method qualifiers.Anastasia Stulova2019-01-213-3/+41
| | | | | | | | | | | | | | | Methods can now be qualified with address spaces to prevent undesirable conversions to generic or to provide custom implementation to be used if the object is located in certain memory segments. This commit extends parsing and standard C++ overloading to work for an address space of a method (i.e. implicit 'this' parameter). Differential Revision: https://reviews.llvm.org/D55850 llvm-svn: 351747
* [OpenCL] Fix overloading ranking rules for addrspace conversions.Anastasia Stulova2019-01-181-0/+23
| | | | | | | | | Extend ranking to work with address spaces correctly when resolving overloads. Differential Revision: https://reviews.llvm.org/D56735 llvm-svn: 351546
* [OpenCL] Set generic addr space of 'this' in special class members.Anastasia Stulova2019-01-141-3/+1
| | | | | | | | | | | | | | | | | Set address spaces of 'this' param correctly for implicit special class members. This also changes initialization conversion sequence to separate address space conversion from other qualifiers in case of binding reference to a temporary. In this case address space conversion should happen after the binding (unlike for other quals). This is needed to materialize it correctly in the alloca address space. Initial patch by Mikael Nilssoni! Differential Revision: https://reviews.llvm.org/D56066 llvm-svn: 351053
* [OpenCL] Add generic AS to 'this' pointerMikael Nilsson2018-12-131-1/+3
| | | | | | | | | | | | | Address spaces are cast into generic before invoking the constructor. Added support for a trailing Qualifiers object in FunctionProtoType. Note: This recommits the previously reverted patch, but now it is commited together with a fix for lldb. Differential Revision: https://reviews.llvm.org/D54862 llvm-svn: 349019
* Revert "[OpenCL] Add generic AS to 'this' pointer"Mikael Nilsson2018-12-121-3/+1
| | | | | | Reverting because the patch broke lldb. llvm-svn: 348931
* [OpenCL] Add generic AS to 'this' pointerMikael Nilsson2018-12-121-1/+3
| | | | | | | | | | Address spaces are cast into generic before invoking the constructor. Added support for a trailing Qualifiers object in FunctionProtoType. Differential Revision: https://reviews.llvm.org/D54862 llvm-svn: 348927
* [OpenCL] Diagnose conflicting address spaces in templates.Anastasia Stulova2018-12-051-0/+19
| | | | | | | | | | | | | Added new diagnostic when templates are instantiated with different address space from the one provided in its definition. This also prevents deducing generic address space in pointer type of templates to allow giving them concrete address space during instantiation. Differential Revision: https://reviews.llvm.org/D55127 llvm-svn: 348382
* [OpenCL] Improve diags for addr spaces in templatesAnastasia Stulova2018-11-291-0/+12
| | | | | | | | | | | Fix ICEs on template instantiations that were leading to the creation of invalid code patterns with address spaces. Incorrect cases are now diagnosed properly. Differential Revision: https://reviews.llvm.org/D54858 llvm-svn: 347865
* [OpenCL] Support new/delete in SemaSven van Haastregt2018-06-141-0/+55
| | | | | | | | | Reject uses of the default new/delete operators with a diagnostic instead of a crash in OpenCL C++ mode and accept user-defined forms. Differential Revision: https://reviews.llvm.org/D46651 llvm-svn: 334700
* [OpenCL] Restrict various keywords in OpenCL C++ modeSven van Haastregt2018-05-091-0/+63
Restrict the following keywords in the OpenCL C++ language mode, according to Sections 2.2 & 2.9 of the OpenCL C++ 1.0 Specification. - dynamic_cast - typeid - register (already restricted in OpenCL C, update the diagnostic) - thread_local - exceptions (try/catch/throw) - access qualifiers read_only, write_only, read_write Support the `__global`, `__local`, `__constant`, `__private`, and `__generic` keywords in OpenCL C++. Leave the unprefixed address space qualifiers such as global available, i.e., do not mark them as reserved keywords in OpenCL C++. libclcxx provides explicit address space pointer classes such as `global_ptr` and `global<T>` that are implemented using the `__`-prefixed qualifiers. Differential Revision: https://reviews.llvm.org/D46022 llvm-svn: 331874
OpenPOWER on IntegriCloud