Skip to content

Commit 2bae7b4

Browse files
committed
Address review comment and update failing tests
stdcpp_compat.cpp was malformed with the options used layout_accessors_host.cpp was expecting output from 3 compilations, which is now down to 2.
1 parent 315a535 commit 2bae7b4

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

clang/include/clang/Driver/Driver.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ class Driver {
651651
/// A list of inputs and their corresponding integration headers. These
652652
/// files are generated during the device compilation and are consumed
653653
/// by the host compilation.
654-
mutable llvm::StringMap<const char *> IntegrationFileList;
654+
mutable llvm::StringMap<StringRef> IntegrationFileList;
655655

656656
public:
657657
/// GetReleaseVersion - Parse (([0-9]+)(.([0-9]+)(.([0-9]+)?))?)? and
@@ -697,7 +697,7 @@ class Driver {
697697
IntegrationFileList.insert({FileName, IntHeaderName});
698698
}
699699
/// getIntegrationHeader - Get the integration header file
700-
const char *getIntegrationHeader(const std::string &FileName) const {
700+
StringRef getIntegrationHeader(const std::string &FileName) const {
701701
return IntegrationFileList[FileName];
702702
}
703703
};

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6622,15 +6622,15 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
66226622
// performing the host side compilation.
66236623
if (!IsSYCLOffloadDevice) {
66246624
// Add the integration header option to generate the header.
6625-
const char *Header = D.getIntegrationHeader(Input.getBaseInput());
6625+
StringRef Header = D.getIntegrationHeader(Input.getBaseInput());
66266626
if (types::getPreprocessedType(InputType) != types::TY_INVALID &&
6627-
Header) {
6627+
!Header.empty()) {
66286628
CmdArgs.push_back("-include");
6629-
CmdArgs.push_back(Header);
6629+
CmdArgs.push_back(Args.MakeArgString(Header));
66306630
// When creating dependency information, filter out the generated
66316631
// header file.
66326632
CmdArgs.push_back("-dependency-filter");
6633-
CmdArgs.push_back(Header);
6633+
CmdArgs.push_back(Args.MakeArgString(Header));
66346634
}
66356635
// Let the FE know we are doing a SYCL offload compilation, but we are
66366636
// doing the host pass.
@@ -6653,7 +6653,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
66536653
}
66546654
if (IsSYCLOffloadDevice) {
66556655
// Add the integration header option to generate the header.
6656-
if (const char *Header = D.getIntegrationHeader(Input.getBaseInput())) {
6656+
StringRef Header(D.getIntegrationHeader(Input.getBaseInput()));
6657+
if (!Header.empty()) {
66576658
SmallString<128> HeaderOpt("-fsycl-int-header=");
66586659
HeaderOpt.append(Header);
66596660
CmdArgs.push_back(Args.MakeArgString(HeaderOpt));

sycl/test/abi/layout_accessors_host.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void hostAcc(accessor<int, 1, access::mode::read, access::target::host_buffer> A
5656
(void)Acc.get_size();
5757
}
5858

59-
// CHECK-COUNT-3: 0 | class sycl::accessor<int, 1, sycl::access::mode::read, sycl::access::target::host_buffer, sycl::access::placeholder::false_t>
59+
// CHECK-COUNT-2: 0 | class sycl::accessor<int, 1, sycl::access::mode::read, sycl::access::target::host_buffer, sycl::access::placeholder::false_t>
6060
// CHECK-NEXT: 0 | class sycl::detail::AccessorBaseHost (base)
6161
// CHECK-NEXT: 0 | class std::shared_ptr<class sycl::detail::AccessorImplHost> impl
6262
// CHECK-NEXT: 0 | class std::__shared_ptr<class sycl::detail::AccessorImplHost, __gnu_cxx::_S_atomic> (base)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note,warning %s -c -o %t.out
2-
// RUN: %clangxx -std=c++14 -fsyntax-only -Xclang -verify -I %sycl_include -Xclang -verify-ignore-unexpected=note,warning %s -o -c %t.out
3-
// RUN: %clangxx -std=c++17 -fsyntax-only -Xclang -verify -I %sycl_include -Xclang -verify-ignore-unexpected=note,warning %s -o -c %t.out
4-
// RUN: %clangxx -std=c++20 -fsyntax-only -Xclang -verify -I %sycl_include -Xclang -verify-ignore-unexpected=note,warning %s -o -c %t.out
2+
// RUN: %clangxx -std=c++14 -fsyntax-only -Xclang -verify -I %sycl_include -Xclang -verify-ignore-unexpected=note,warning %s -c -o %t.out
3+
// RUN: %clangxx -std=c++17 -fsyntax-only -Xclang -verify -I %sycl_include -Xclang -verify-ignore-unexpected=note,warning %s -c -o %t.out
4+
// RUN: %clangxx -std=c++20 -fsyntax-only -Xclang -verify -I %sycl_include -Xclang -verify-ignore-unexpected=note,warning %s -c -o %t.out
55
// expected-no-diagnostics
66

77
#include <CL/sycl.hpp>

0 commit comments

Comments
 (0)