Skip to content

Commit a509170

Browse files
committed
[Driver][SYCL] Remove real_path workaround for integration header
We applied a workaround for integration header usage on Windows that corrected the directory name in case it did not match expectations of the file system (lowercase/uppercase like things). The workaround is not needed anymore as community has addressed the non-portable path warning directly for Windows.
1 parent ffdadc2 commit a509170

File tree

2 files changed

+4
-19
lines changed

2 files changed

+4
-19
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6289,24 +6289,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
62896289
// Host-side SYCL compilation receives the integration header file as
62906290
// Inputs[1]. Include the header with -include
62916291
if (!IsSYCLOffloadDevice && SYCLDeviceInput) {
6292-
SmallString<128> RealPath;
6293-
#if defined(_WIN32)
6294-
// Fixup the header path name in case there are discrepancies in the
6295-
// string used for the temporary directory environment variable and
6296-
// actual path expectations.
6297-
//
6298-
// While generating the driver commands, we're most often working
6299-
// with non-existing files. The Unix implementation of LLVM's real_path
6300-
// returns an empty path for a non-existing file if it's expected to be
6301-
// placed in the current directory. This becomes a problem when we're
6302-
// saving intermediate compilation results via -save-temps.
6303-
// Since the header file path fix-up is Windows-specific, the real_path
6304-
// call is not necessary for a Unix-based OS (case-sensitive filesystem).
6305-
llvm::sys::fs::real_path(SYCLDeviceInput->getFilename(), RealPath);
6306-
#else // _WIN32
6307-
RealPath.assign(StringRef(SYCLDeviceInput->getFilename()));
6308-
#endif // _WIN32
6309-
const char *IntHeaderPath = Args.MakeArgString(RealPath);
6292+
const char *IntHeaderPath =
6293+
Args.MakeArgString(SYCLDeviceInput->getFilename());
63106294
CmdArgs.push_back("-include");
63116295
CmdArgs.push_back(IntHeaderPath);
63126296
// When creating dependency information, filter out the generated

clang/test/Driver/sycl-offload-header-check.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
// RUN: env TMP=%t_dirname \
1010
// RUN: %clang -### -fsycl %s 2>&1 | \
1111
// RUN: FileCheck --check-prefix=CHECK-HEADER %s
12+
// CHECK-HEADER-NOT: non-portable path
1213
// CHECK-HEADER: clang{{.*}} "-fsycl-int-header=[[HEADER:.+\.h]]"
1314
// CHECK-HEADER: {{.*}} "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include{{[/\\]+}}sycl"
1415
// CHECK-HEADER-NOT: clang{{.*}} "-include" "[[HEADER]]"
15-
// CHECK-HEADER: clang{{.*}} "-include" "{{.*}}_DiRnAmE{{.+}}.h"
16+
// CHECK-HEADER: clang{{.*}} "-include" "{{.*}}_dirname{{.+}}.h"

0 commit comments

Comments
 (0)