Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang][SYCL] Emit canonical types in integration footer #16161

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions clang/lib/Sema/SemaSYCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6969,6 +6969,7 @@ bool SYCLIntegrationFooter::emit(raw_ostream &OS) {
Policy.adjustForCPlusPlusFwdDecl();
Policy.SuppressTypedefs = true;
Policy.SuppressUnwrittenScope = true;
Policy.PrintCanonicalTypes = true;

llvm::SmallSet<const VarDecl *, 8> Visited;
bool EmittedFirstSpecConstant = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// RUN: %clang_cc1 -fsycl-is-device -internal-isystem %S/Inputs -triple spir64-unknown-unknown -fsycl-int-footer=%t.footer.h -emit-llvm %s -o -
// RUN: FileCheck -input-file=%t.footer.h %s --check-prefix=CHECK-FOOTER

Fznamznon marked this conversation as resolved.
Show resolved Hide resolved
// This test checks that integration footer is emitted correctly when a
// device_global has an explicit template specialization in template arguments.

#include "sycl.hpp"

namespace sycl {
template <typename T> struct X {};
template <> struct X<int> {};
namespace detail {
struct Y {};
} // namespace detail
template <> struct X<detail::Y> {};
} // namespace sycl

using namespace sycl;
template <typename T, typename = X<detail::Y>> struct Arg1 { T val; };

using namespace sycl::ext::oneapi;
template <typename properties_t>
device_global<properties_t> dev_global;

SYCL_EXTERNAL auto foo() {
(void)dev_global<Arg1<int>>;
}

// CHECK-FOOTER: __sycl_device_global_registration::__sycl_device_global_registration() noexcept {
// CHECK-FOOTER-NEXT: device_global_map::add((void *)&::dev_global<Arg1<int, sycl::X<sycl::detail::Y>>>, "_Z10dev_globalI4Arg1IiN4sycl1XINS1_6detail1YEEEEE");
// CHECK-FOOTER-NEXT: }
// CHECK-FOOTER-NEXT: } // namespace (unnamed)
Loading