summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix mishandling of invalid-but-non-empty nested name specifiers in nameRichard Smith2019-12-101-5/+8
| | | | | | | | classification. We were accidentally treating invalid scope specs as being empty, resulting in our trying to form an ADL-only call with a qualified callee, which tripped up an assert later on.
* [c++20] Implement P1185R2 (as modified by P2002R0).Richard Smith2019-12-104-39/+199
| | | | | | For each defaulted operator<=> in a class that doesn't explicitly declare any operator==, also inject a matching implicit defaulted operator==.
* Remove debugging printf and reformat code.Eric Christopher2019-12-101-4/+2
|
* [OPENMP50]Do not mark the function as used if referenced only in declareAlexey Bataev2019-12-101-1/+6
| | | | | | | | | variant directive. If the function is used only in declare variant directive as a variant function, it should not be marked as used to prevent emission of the target-specific functions. Build the reference in the unevaluated context.
* [c++20] Return type deduction for defaulted three-way comparisons.Richard Smith2019-12-102-47/+78
|
* [OPENMP50]Add if clause in target simd directive.Alexey Bataev2019-12-101-1/+7
| | | | | | According to OpenMP 5.0, if clause can be used in for simd directive. If condition in the if clause if false, the non-vectorized version of the loop must be executed.
* [OPENMP50]Add if clause in target parallel for simd directive.Alexey Bataev2019-12-101-1/+7
| | | | | | According to OpenMP 5.0, if clause can be used in for simd directive. If condition in the if clause is false, the non-vectorized version of the loop must be executed.
* [DebugInfo] Support to emit debugInfo for extern variablesYonghong Song2019-12-102-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extern variable usage in BPF is different from traditional pure user space application. Recent discussion in linux bpf mailing list has two use cases where debug info types are required to use extern variables: - extern types are required to have a suitable interface in libbpf (bpf loader) to provide kernel config parameters to bpf programs. https://lore.kernel.org/bpf/CAEf4BzYCNo5GeVGMhp3fhysQ=_axAf=23PtwaZs-yAyafmXC9g@mail.gmail.com/T/#t - extern types are required so kernel bpf verifier can verify program which uses external functions more precisely. This will make later link with actual external function no need to reverify. https://lore.kernel.org/bpf/87eez4odqp.fsf@toke.dk/T/#m8d5c3e87ffe7f2764e02d722cb0d8cbc136880ed This patch added clang support to emit debuginfo for extern variables with a TargetInfo hook to enable it. The debuginfo for the extern variable is emitted only if that extern variable is referenced in the current compilation unit. Currently, only BPF target enables to generate debug info for extern variables. The emission of such debuginfo is disabled for C++ at this moment since BPF only supports a subset of C language. Emission with C++ can be enabled later if an appropriate use case is identified. -fstandalone-debug permits us to see more debuginfo with the cost of bloated binary size. This patch did not add emission of extern variable debug info with -fstandalone-debug. This can be re-evaluated if there is a real need. Differential Revision: https://reviews.llvm.org/D70696
* Only Remove implicit conversion for the target that support fp16Jim Lin2019-12-101-1/+2
| | | | | | Remove implicit conversion that promotes half to double for the target that support fp16. If the target doesn't support fp16, fp16 will be converted to fp16 intrinsic.
* [OpenMP][NFCI] Introduce llvm/IR/OpenMPConstants.hJohannes Doerfert2019-12-104-3/+14
| | | | | | | | | | | | | | | | | | | Summary: The new OpenMPConstants.h is a location for all OpenMP related constants (and helpers) to live. This patch moves the directives there (the enum OpenMPDirectiveKind) and rewires Clang to use the new location. Initially part of D69785. Reviewers: kiranchandramohan, ABataev, RaviNarayanaswamy, gtbercea, grokos, sdmitriev, JonChesterfield, hfinkel, fghanim Subscribers: jholewinski, ppenzin, penzn, llvm-commits, cfe-commits, jfb, guansong, bollu, hiraditya, mgorny Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D69853
* Remove implicit conversion that promotes half to other larger precision ↵Jim Lin2019-12-101-1/+15
| | | | | | | | | | | | | | | | | | | | types for fp classification builtins Summary: It shouldn't promote half to double or any larger precision types for fp classification builtins. Because fp classification builtins would get incorrect result with promoted argument. For example, __builtin_isnormal with a subnormal half value should return false, but it is not. That the subnormal half value is promoted to a normal double value. Reviewers: aaron.ballman Reviewed By: aaron.ballman Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71049
* [c++20] Fix handling of unqualified lookups from a defaulted comparisonRichard Smith2019-12-094-40/+136
| | | | | | | | | | function. We need to perform unqualified lookups from the context of a defaulted comparison, but not until we implicitly define the function, at which point we can't do those lookups any more. So perform the lookup from the end of the class containing the =default declaration and store the lookup results on the defaulted function until we synthesize the body.
* [c++20] Defaulted comparison support for array members.Richard Smith2019-12-091-10/+131
|
* Also synthesize _cmd and self for propertiesPierre Habouzit2019-12-091-0/+6
| | | | | | Patch by: Pierre Habouzit Differential Revision: https://reviews.llvm.org/D71226
* [Attr] Move ParsedTargetAttr out of the TargetAttr classCraig Topper2019-12-092-8/+6
| | | | | | Need to forward declare it in ASTContext.h for D68627, so it can't be a nested struct. Differential Revision: https://reviews.llvm.org/D71159
* [c++20] Fix incorrect assumptions in checks for comparison category types.Richard Smith2019-12-091-19/+26
| | | | | | In the presence of modules, we can have multiple lookup results for the same entity, and we need to re-check for completeness each time we consider a type.
* Fix clang -Wcovered-switch-default after llvmorg-10-init-11484-g6626e5a06a9Fangrui Song2019-12-091-2/+2
| | | | | We need to place llvm_unreachable after switch to work around the GCC warning.
* Fix compilation warning from GCC7. NFC.Michael Liao2019-12-091-0/+2
|
* [c++20] Synthesis of defaulted comparison functions.Richard Smith2019-12-084-27/+469
| | | | | | Array members are not yet handled. In addition, defaulted comparisons can't yet find comparison operators by unqualified lookup (only by member lookup and ADL). These issues will be fixed in follow-on changes.
* [OpenMP] Require trivially copyable type for mappingJonas Hahnfeld2019-12-071-1/+1
| | | | | | | | | | | | | A trivially copyable type provides a trivial copy constructor and a trivial copy assignment operator. This is enough for the runtime to memcpy the data to the device. Additionally there must be no virtual functions or virtual base classes and the destructor is guaranteed to be trivial, ie performs no action. The runtime does not require trivial default constructors because on alloc the memory is undefined. Thus, weaken the warning to be only issued if the mapped type is not trivially copyable. Differential Revision: https://reviews.llvm.org/D71134
* [c++20] Determine whether a defaulted comparison should be deleted orRichard Smith2019-12-063-148/+557
| | | | constexpr.
* Revert "[Sema][X86] Consider target attribute into the checks in ↵Reid Kleckner2019-12-061-9/+4
| | | | | | | | | validateOutputSize and validateInputSize." This reverts commit e1578fd2b79fe5af5f80c0c166a8abd0f816c022. It introduces a dependency on Attr.h which I am removing from ASTContext.h.
* [Sema][X86] Consider target attribute into the checks in validateOutputSize ↵Craig Topper2019-12-061-4/+9
| | | | | | | | | | | | | | | | and validateInputSize. The validateOutputSize and validateInputSize need to check whether AVX or AVX512 are enabled. But this can be affected by the target attribute so we need to factor that in. This patch copies some of the code from CodeGen to create an appropriate feature map that we can pass to the function. Probably need some refactoring here to share more code with Codegen. Is there a good place to do that? Also need to support the cpu_specific attribute as well. Differential Revision: https://reviews.llvm.org/D68627
* [ObjC] Make sure that the implicit arguments for direct methods have been setupAlex Lorenz2019-12-061-0/+3
| | | | | | | | | | | | | | | | | | | | This commit sets the Self and Imp declarations for ObjC method declarations, in addition to the definitions. It also fixes a bunch of code in clang that had wrong assumptions about when getSelfDecl() would be set: - CGDebugInfo::getObjCMethodName and AnalysisConsumer::getFunctionName would assume that it was set for method declarations part of a protocol, which they never were, and that self would be a Class type, which it isn't as it is id for a protocol. Also use the Canonical Decl to index the set of Direct methods so that when calls and implementations interleave, the same llvm::Function is used and the same symbol name emitted. Radar-Id: rdar://problem/57661767 Patch by: Pierre Habouzit Differential Revision: https://reviews.llvm.org/D71091
* [OPENMP50]Add if clause in distribute simd directive.Alexey Bataev2019-12-061-1/+3
| | | | | | According to OpenMP 5.0, if clause can be used in for simd directive. If condition in the if clause if false, the non-vectorized version of the loop must be executed.
* Add `QualType::hasAddressSpace`. NFC.Michael Liao2019-12-065-11/+10
| | | | | - Add that as a shorthand of <T>.getQualifiers().hasAddressSpace(). - Simplify related code.
* [Concepts] Constraint Enforcement & DiagnosticsSaar Raz2019-12-067-103/+492
| | | | | | | | | Part of the C++20 concepts implementation effort. - Associated constraints (requires clauses, currently) are now enforced when instantiating/specializing templates and when considering partial specializations and function overloads. - Elaborated diagnostics give helpful insight as to why the constraints were not satisfied. Phabricator: D41569 Re-commit, after fixing some memory bugs.
* Properly convert all declaration non-type template arguments whenRichard Smith2019-12-051-88/+61
| | | | | | | | | | | | forming non-type template parameter values. This reverts commit 93cc9dddd82f9e971f382ade6acf6634c5914966, which reverted commit 11d10527852b4d3ed738aa90d8bec0f398160593. We now always form `&x` when forming a pointer to a function rather than trying to use function-to-pointer decay. This matches the behavior of the old code in this case, but not the intent as described by the comments.
* Set a source location for Objective-C accessor stubsAdrian Prantl2019-12-051-4/+6
| | | | | | | | | | | | even when there is no explicit synthesize statement. This fixes a regression introduced in https://reviews.llvm.org/D68108 that could lead to missing debug locations in cleanup code in synthesized Objective-C++ properties. rdar://57630879 Differential Revision: https://reviews.llvm.org/D71084
* [OpenMP50] Add parallel master constructcchen2019-12-052-0/+49
| | | | | | | | | | | | Reviewers: ABataev, jdoerfert Reviewed By: ABataev Subscribers: rnk, jholewinski, guansong, arphaman, jfb, cfe-commits, sandoval, dreachem Tags: #clang Differential Revision: https://reviews.llvm.org/D70726
* [OPENMP50]Add support for if clause for simd part in distribute parallel for ↵Alexey Bataev2019-12-051-1/+8
| | | | | | | simd directive. According to OpenMP 5.0, the if clause can be applied to simd subdirective in the combined directives.
* [OPENMP50]Add support for if clause for simd part in parallel master ↵Alexey Bataev2019-12-051-1/+13
| | | | | | | taskloop simd directive. According to OpenMP 5.0, the if clause can be applied to simd subdirective in the combined directives.
* [OPENMP50]Add support for if clause for simd part in master taskloop simd ↵Alexey Bataev2019-12-051-1/+3
| | | | | | | directive. According to OpenMP 5.0, the if clause can be applied to simd subdirective in the combined directives.
* [AST] Enable expression of OpenCL language address spaces an attributeVictor Lomuller2019-12-051-3/+13
| | | | | | | | | | | | | | | | | | Summary: Enable a way to set OpenCL language address space using attributes in addition to existing keywords. Signed-off-by: Victor Lomuller victor@codeplay.com Reviewers: aaron.ballman, Anastasia Subscribers: yaxunl, ebevhan, cfe-commits, Naghasan Tags: #clang Differential Revision: https://reviews.llvm.org/D71005 Signed-off-by: Alexey Bader <alexey.bader@intel.com>
* Reapply af57dbf12e54 "Add support for options -frounding-math, ↵Melanie Blower2019-12-051-0/+10
| | | | | | | | | | | | ftrapping-math, -ffp-model=, and -ffp-exception-behavior=" Patch was reverted because https://bugs.llvm.org/show_bug.cgi?id=44048 The original patch is modified to set the strictfp IR attribute explicitly in CodeGen instead of as a side effect of IRBuilder. In the 2nd attempt to reapply there was a windows lit test fail, the tests were fixed to use wildcard matching. Differential Revision: https://reviews.llvm.org/D62731
* Revert "Properly convert all declaration non-type template arguments when"David L. Jones2019-12-041-65/+88
| | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 11d10527852b4d3ed738aa90d8bec0f398160593. This change is problematic with function pointer template parameters. For example, building libcxxabi with futexes (-D_LIBCXXABI_USE_FUTEX) produces this diagnostic: In file included from .../llvm-project/libcxxabi/src/cxa_guard.cpp:15: .../llvm-project/libcxxabi/src/cxa_guard_impl.h:416:54: error: address of function 'PlatformThreadID' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] has_thread_id_support(this->thread_id_address && GetThreadIDArg), ~~ ^~~~~~~~~~~~~~ .../llvm-project/libcxxabi/src/cxa_guard.cpp:38:26: note: in instantiation of member function '__cxxabiv1::(anonymous namespace)::InitByteFutex<&__cxxabiv1::(anonymous namespace)::PlatformFutexWait, &__cxxabiv1::(anonymous namespace)::PlatformFutexWake, &__cxxabiv1::(anonymous namespace)::PlatformThreadID>::InitByteFutex' requested here SelectedImplementation imp(raw_guard_object); ^ .../llvm-project/libcxxabi/src/cxa_guard_impl.h:416:54: note: prefix with the address-of operator to silence this warning has_thread_id_support(this->thread_id_address && GetThreadIDArg), ^ & 1 error generated. The diagnostic is incorrect: adding the address-of operator also fails ("cannot take the address of an rvalue of type 'uint32_t (*)()' (aka 'unsigned int (*)()')").
* Properly convert all declaration non-type template arguments whenRichard Smith2019-12-041-88/+65
| | | | forming non-type template parameter values.
* [c++17] Fix assert / wrong code when passing a noexcept pointer toRichard Smith2019-12-041-4/+10
| | | | | member function to a non-noexcept pointer to member non-type template parameter.
* Revert "[OpenMP50] Add parallel master construct, by Chi Chun Chen."Reid Kleckner2019-12-042-49/+0
| | | | | | This reverts commit 713dab21e27c987b9114547ce7136bac2e775de9. Tests do not pass on Windows.
* [OPENMP50]Add support for if clause for simd part in taskloop simdAlexey Bataev2019-12-041-15/+26
| | | | | | | directive. According to OpenMP 5.0, the `if` clause can be applied to simd subdirective in the combined directive.
* Revert " Reapply af57dbf12e54 "Add support for options ↵Melanie Blower2019-12-041-10/+0
| | | | | | | -frounding-math, ftrapping-math, -ffp-model=, and -ffp-exception-behavior="" This reverts commit cdbed2dd856c14687efd741c2d8321686102acb8. Build break on Windows (lit fail)
* [OpenMP50] Add parallel master construct, by Chi Chun Chen.cchen2019-12-042-0/+49
| | | | | | | | | | | | Reviewers: ABataev, jdoerfert Reviewed By: ABataev Subscribers: jholewinski, guansong, arphaman, jfb, cfe-commits, sandoval, dreachem Tags: #clang Differential Revision: https://reviews.llvm.org/D70726
* Reapply af57dbf12e54 "Add support for options -frounding-math, ↵Melanie Blower2019-12-041-0/+10
| | | | | | | | | | ftrapping-math, -ffp-model=, and -ffp-exception-behavior=" Patch was reverted because https://bugs.llvm.org/show_bug.cgi?id=44048 The original patch is modified to set the strictfp IR attribute explicitly in CodeGen instead of as a side effect of IRBuilder Differential Revision: https://reviews.llvm.org/D62731
* [opencl] Fix address space deduction on array variables.Michael Liao2019-12-041-0/+19
| | | | | | | | | | | | | | Summary: - The deduced address space needs applying to its element type as well. Reviewers: Anastasia Subscribers: yaxunl, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70981
* Actually delay processing DelayedDllExportClasses until the outermost class ↵Hans Wennborg2019-12-042-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | is finished (PR40006) This was already the intention of DelayedDllExportClasses, but code such as this would break it: template<typename> struct Tmpl {}; struct Outer { struct Inner { __declspec(dllexport) Inner() = default; unsigned int x = 0; }; Tmpl<Inner> y; }; ActOnFinishCXXNonNestedClass() would get called when the instantiation of Templ<Inner> is finished, even though the compiler is still not finished with Outer, causing the compile fail. This hooks into Sema::{Push,Pop}ParsingClass() to avoid calling ActOnFinishCXXNonNestedClass() for template instantiations while a class is being parsed. Differential revision: https://reviews.llvm.org/D70905
* Reapply "Fix crash on switch conditions of non-integer types in templates"Elizabeth Andrews2019-12-031-0/+2
| | | | | | | | | | | | | | | | | | | | This patch reapplies commit 759948467ea. Patch was reverted due to a clang-tidy test fail on Windows. The test has been modified. There are no additional code changes. Patch was tested with ninja check-all on Windows and Linux. Summary of code changes: Clang currently crashes for switch statements inside a template when the condition is a non-integer field member because contextual implicit conversion is skipped when parsing the condition. This conversion is however later checked in an assert when the case statement is handled. The conversion is skipped when parsing the condition because the field member is set as type-dependent based on its containing class. This patch sets the type dependency based on the field's type instead. This patch fixes Bug 40982.
* [SYCL] Add sycl_kernel attribute for accelerated code outliningMariya Podchishchaeva2019-12-031-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SYCL is single source offload programming model relying on compiler to separate device code (i.e. offloaded to an accelerator) from the code executed on the host. Here is code example of the SYCL program to demonstrate compiler outlining work: ``` int foo(int x) { return ++x; } int bar(int x) { throw std::exception("CPU code only!"); } ... using namespace cl::sycl; queue Q; buffer<int, 1> a(range<1>{1024}); Q.submit([&](handler& cgh) { auto A = a.get_access<access::mode::write>(cgh); cgh.parallel_for<init_a>(range<1>{1024}, [=](id<1> index) { A[index] = index[0] + foo(42); }); } ... ``` SYCL device compiler must compile lambda expression passed to cl::sycl::handler::parallel_for method and function foo called from this lambda expression for an "accelerator". SYCL device compiler also must ignore bar function as it's not required for offloaded code execution. This patch adds the sycl_kernel attribute, which is used to mark code passed to cl::sycl::handler::parallel_for as "accelerated code". Attribute must be applied to function templates which parameters include at least "kernel name" and "kernel function object". These parameters will be used to establish an ABI between the host application and offloaded part. Reviewers: jlebar, keryell, Naghasan, ABataev, Anastasia, bader, aaron.ballman, rjmccall, rsmith Reviewed By: keryell, bader Subscribers: mgorny, OlegM, ArturGainullin, agozillon, aaron.ballman, ebevhan, Anastasia, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60455 Signed-off-by: Alexey Bader <alexey.bader@intel.com>
* [OpenCL] Use generic addr space for lambda call operatorAnastasia Stulova2019-12-034-14/+30
| | | | | | | | | | | | | | | 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
* Add FunctionDecl::getParameterSourceRange()Nicolas Manichon2019-12-031-0/+1
| | | | | This source range covers the list of parameters of the function declaration, including the ellipsis for a variadic function.
* [OpenCL] Fix mangling of single-overload builtinsSven van Haastregt2019-12-031-1/+2
| | | | | | Commit 9a8d477a0e0 ("[OpenCL] Add builtin function attribute handling", 2019-11-05) stopped Clang from mangling single-overload builtins, which is incorrect.
OpenPOWER on IntegriCloud