Skip to content
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
5 changes: 1 addition & 4 deletions clang/lib/Driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,7 @@ std::string CUIDOptions::getCUID(StringRef InputFile,
else if (UseCUID == Kind::Hash) {
llvm::MD5 Hasher;
llvm::MD5::MD5Result Hash;
SmallString<256> RealPath;
llvm::sys::fs::real_path(InputFile, RealPath,
/*expand_tilde=*/true);
Hasher.update(RealPath);
Hasher.update(InputFile);
for (auto *A : Args) {
if (A->getOption().matches(options::OPT_INPUT))
continue;
Expand Down
15 changes: 11 additions & 4 deletions clang/test/Driver/hip-cuid-hash.hip
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
// Check CUID generated by hash.
// The same CUID is generated for the same file with the same options.

// This test requires relative paths for input files. Since the test may be
// done out of source tree, create the local directory structure and copy the
// input file from the source tree into that directory.
// RUN: mkdir -p %t/Inputs/hip_multiple_inputs
// RUN: cp %S/Inputs/hip_multiple_inputs/a.cu %t/Inputs/hip_multiple_inputs/a.cu
// RUN: cd %t

// RUN: %clang -### -x hip --target=x86_64-unknown-linux-gnu --no-offload-new-driver \
// RUN: --offload-arch=gfx906 -c -nogpuinc -nogpulib -fuse-cuid=hash \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu >%t.out 2>&1
// RUN: Inputs/hip_multiple_inputs/a.cu >%t.out 2>&1

// RUN: %clang -### -x hip --target=x86_64-unknown-linux-gnu --no-offload-new-driver \
// RUN: --offload-arch=gfx906 -c -nogpuinc -nogpulib -fuse-cuid=hash \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu >>%t.out 2>&1
// RUN: Inputs/hip_multiple_inputs/a.cu >>%t.out 2>&1

// RUN: FileCheck %s -check-prefixes=SAME -input-file %t.out

Expand All @@ -16,11 +23,11 @@

// RUN: %clang -### -x hip --target=x86_64-unknown-linux-gnu -DX=1 --no-offload-new-driver \
// RUN: --offload-arch=gfx906 -c -nogpuinc -nogpulib -fuse-cuid=hash \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu >%t.out 2>&1
// RUN: Inputs/hip_multiple_inputs/a.cu >%t.out 2>&1

// RUN: %clang -### -x hip --target=x86_64-unknown-linux-gnu -DX=2 --no-offload-new-driver \
// RUN: --offload-arch=gfx906 -c -nogpuinc -nogpulib -fuse-cuid=hash \
// RUN: %S/Inputs/../Inputs/hip_multiple_inputs/a.cu >>%t.out 2>&1
// RUN: Inputs/../Inputs/hip_multiple_inputs/a.cu >>%t.out 2>&1

// RUN: FileCheck %s -check-prefixes=DIFF -input-file %t.out

Expand Down