
I discovered when merging the __builtin_sycl_unique_stable_name into my downstream that it is actually possible for the cc1 invocation to have more than 1 Sema instance, if you pass it multiple input files, each gets its own Sema instance and thus ASTContext instance. The result was that the call to Filter the SYCL kernels was using an ItaniumMangleContext stored via a 'magic static', so it had an invalid reference to ASTContext when processing the 2nd failure. The failure is unfortunately flakey/transient, but the test that fails was added anyway. The magic-static was switched to a unique_ptr member variable in ASTContext that is initialized when needed.
19 lines
602 B
C++
19 lines
602 B
C++
// RUN: %clang_cc1 %s %s -std=c++17 -triple x86_64-linux-gnu -fsycl-is-device -verify -fsyntax-only -Wno-unused
|
|
|
|
// This would crash due to the double-inputs, since the 'magic static' use in
|
|
// the AST Context SCYL Filtering would end up caching an old version of the
|
|
// ASTContext object, which no longer exists in the second file's invocation.
|
|
//
|
|
// expected-no-diagnostics
|
|
class Empty {};
|
|
template <typename, typename F> __attribute__((sycl_kernel)) void kernel(F) {
|
|
__builtin_sycl_unique_stable_name(F);
|
|
}
|
|
|
|
void use() {
|
|
[](Empty) {
|
|
auto lambda = []{};
|
|
kernel<class i>(lambda);
|
|
};
|
|
}
|