diff options
author | Erich Keane <erich.keane@intel.com> | 2021-04-23 08:22:35 -0700 |
---|---|---|
committer | Erich Keane <erich.keane@intel.com> | 2021-05-27 07:12:20 -0700 |
commit | eba69b59d1a30dead07da2c279c8ecfd2b62ba9f (patch) | |
tree | df24fabb423576b4a9a86173b65a9af0e7a4f061 /clang/lib/Sema/SemaExceptionSpec.cpp | |
parent | caf86d2959d5e900ed29af5e0ae2be23e3d299c5 (diff) | |
download | llvm-eba69b59d1a30dead07da2c279c8ecfd2b62ba9f.zip llvm-eba69b59d1a30dead07da2c279c8ecfd2b62ba9f.tar.gz llvm-eba69b59d1a30dead07da2c279c8ecfd2b62ba9f.tar.bz2 |
Reimplement __builtin_unique_stable_name-
The original version of this was reverted, and @rjmcall provided some
advice to architect a new solution. This is that solution.
This implements a builtin to provide a unique name that is stable across
compilations of this TU for the purposes of implementing the library
component of the unnamed kernel feature of SYCL. It does this by
running the Itanium mangler with a few modifications.
Because it is somewhat common to wrap non-kernel-related lambdas in
macros that aren't present on the device (such as for logging), this
uniquely generates an ID for all lambdas involved in the naming of a
kernel. It uses the lambda-mangling number to do this, except replaces
this with its own number (starting at 10000 for readabililty reasons)
for lambdas used to name a kernel.
Additionally, this implements itself as constexpr with a slight catch:
if a name would be invalidated by the use of this lambda in a later
kernel invocation, it is diagnosed as an error (see the Sema tests).
Differential Revision: https://reviews.llvm.org/D103112
Diffstat (limited to 'clang/lib/Sema/SemaExceptionSpec.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExceptionSpec.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp index f0b9e6a..fd6a494 100644 --- a/clang/lib/Sema/SemaExceptionSpec.cpp +++ b/clang/lib/Sema/SemaExceptionSpec.cpp @@ -1575,6 +1575,8 @@ CanThrowResult Sema::canThrow(const Stmt *S) { return mergeCanThrow(CT, canThrow(TS->getTryBody())); } + case Stmt::SYCLUniqueStableNameExprClass: + return CT_Cannot; case Stmt::NoStmtClass: llvm_unreachable("Invalid class for statement"); } |