[clang] Update remaining tests for usage of CLANG_RESOURCE_DIR (PR #202475)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 9 08:58:09 PDT 2026
https://github.com/dyung updated https://github.com/llvm/llvm-project/pull/202475
>From 0d682c92de9f30de85a4f25f5f64d66060ae3a8a Mon Sep 17 00:00:00 2001
From: Douglas Yung <douglas.yung at sony.com>
Date: Sun, 10 May 2026 10:25:21 -0700
Subject: [PATCH 1/5] Fix test clang/test/Driver/hexagon-toolchain-picolibc.c
when using CLANG_RESOURCE_DIR.
---
clang/test/Driver/hexagon-toolchain-picolibc.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/clang/test/Driver/hexagon-toolchain-picolibc.c b/clang/test/Driver/hexagon-toolchain-picolibc.c
index 8282a4da81636..77295c4347810 100644
--- a/clang/test/Driver/hexagon-toolchain-picolibc.c
+++ b/clang/test/Driver/hexagon-toolchain-picolibc.c
@@ -4,14 +4,14 @@
// Test standard include paths
// -----------------------------------------------------------------------------
// RUN: %clang -### --target=hexagon-none-elf --cstdlib=picolibc \
-// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin %s 2>&1 | FileCheck -check-prefix=CHECK-C-INCLUDES %s
-// CHECK-C-INCLUDES: "-cc1" {{.*}} "-internal-isystem" "{{.*}}{{/|\\\\}}lib{{/|\\\\}}clang{{/|\\\\}}{{[0-9]+}}{{/|\\\\}}include"
+// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin %s 2>&1 | FileCheck -check-prefix=CHECK-C-INCLUDES -DRESOURCE_DIR=%clang-resource-dir %s
+// CHECK-C-INCLUDES: "-cc1" {{.*}} "-internal-isystem" "[[RESOURCE_DIR]]/include"
// CHECK-C-INCLUDES: "-internal-externc-isystem" "{{.*}}{{/|\\\\}}Inputs{{/|\\\\}}hexagon_tree{{/|\\\\}}Tools{{/|\\\\}}bin{{/|\\\\}}..{{/|\\\\}}target{{/|\\\\}}picolibc{{/|\\\\}}hexagon-unknown-none-elf{{/|\\\\}}include"
// RUN: %clangxx -### --target=hexagon-none-elf --cstdlib=picolibc \
-// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin %s 2>&1 | FileCheck -check-prefix=CHECK-CXX-INCLUDES %s
+// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin %s 2>&1 | FileCheck -check-prefix=CHECK-CXX-INCLUDES -DRESOURCE_DIR=%clang-resource-dir %s
// CHECK-CXX-INCLUDES: "-cc1" {{.*}} "-internal-isystem" "{{.*}}{{/|\\\\}}Inputs{{/|\\\\}}hexagon_tree{{/|\\\\}}Tools{{/|\\\\}}bin{{/|\\\\}}..{{/|\\\\}}target{{/|\\\\}}picolibc{{/|\\\\}}hexagon-unknown-none-elf{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1"
-// CHECK-CXX-INCLUDES: "-internal-isystem" "{{.*}}{{/|\\\\}}lib{{/|\\\\}}clang{{/|\\\\}}{{[0-9]+}}{{/|\\\\}}include"
+// CHECK-CXX-INCLUDES: "-internal-isystem" "[[RESOURCE_DIR]]/include"
// CHECK-CXX-INCLUDES: "-internal-externc-isystem" "{{.*}}{{/|\\\\}}Inputs{{/|\\\\}}hexagon_tree{{/|\\\\}}Tools{{/|\\\\}}bin{{/|\\\\}}..{{/|\\\\}}target{{/|\\\\}}picolibc{{/|\\\\}}hexagon-unknown-none-elf{{/|\\\\}}include"
// -----------------------------------------------------------------------------
// Passing start files for Picolibc
@@ -128,14 +128,14 @@
// Test standard include paths for H2
// -----------------------------------------------------------------------------
// RUN: %clang -### --target=hexagon-h2-elf --cstdlib=picolibc \
-// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin %s 2>&1 | FileCheck -check-prefix=CHECK-H2-C-INCLUDES %s
-// CHECK-H2-C-INCLUDES: "-cc1" {{.*}} "-internal-isystem" "{{.*}}{{/|\\\\}}lib{{/|\\\\}}clang{{/|\\\\}}{{[0-9]+}}{{/|\\\\}}include"
+// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin %s 2>&1 | FileCheck -check-prefix=CHECK-H2-C-INCLUDES -DRESOURCE_DIR=%clang-resource-dir %s
+// CHECK-H2-C-INCLUDES: "-cc1" {{.*}} "-internal-isystem" "[[RESOURCE_DIR]]/include"
// CHECK-H2-C-INCLUDES: "-internal-externc-isystem" "{{.*}}{{/|\\\\}}Inputs{{/|\\\\}}hexagon_tree{{/|\\\\}}Tools{{/|\\\\}}bin{{/|\\\\}}..{{/|\\\\}}target{{/|\\\\}}picolibc{{/|\\\\}}hexagon-unknown-h2-elf{{/|\\\\}}include"
// RUN: %clangxx -### --target=hexagon-h2-elf --cstdlib=picolibc \
-// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin %s 2>&1 | FileCheck -check-prefix=CHECK-H2-CXX-INCLUDES %s
+// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin %s 2>&1 | FileCheck -check-prefix=CHECK-H2-CXX-INCLUDES -DRESOURCE_DIR=%clang-resource-dir %s
// CHECK-H2-CXX-INCLUDES: "-cc1" {{.*}} "-internal-isystem" "{{.*}}{{/|\\\\}}Inputs{{/|\\\\}}hexagon_tree{{/|\\\\}}Tools{{/|\\\\}}bin{{/|\\\\}}..{{/|\\\\}}target{{/|\\\\}}picolibc{{/|\\\\}}hexagon-unknown-h2-elf{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1"
-// CHECK-H2-CXX-INCLUDES: "-internal-isystem" "{{.*}}{{/|\\\\}}lib{{/|\\\\}}clang{{/|\\\\}}{{[0-9]+}}{{/|\\\\}}include"
+// CHECK-H2-CXX-INCLUDES: "-internal-isystem" "[[RESOURCE_DIR]]/include"
// CHECK-H2-CXX-INCLUDES: "-internal-externc-isystem" "{{.*}}{{/|\\\\}}Inputs{{/|\\\\}}hexagon_tree{{/|\\\\}}Tools{{/|\\\\}}bin{{/|\\\\}}..{{/|\\\\}}target{{/|\\\\}}picolibc{{/|\\\\}}hexagon-unknown-h2-elf{{/|\\\\}}include"
// -----------------------------------------------------------------------------
>From 7adcc906fa48a8ba6200cd0c8f62faf567642166 Mon Sep 17 00:00:00 2001
From: Douglas Yung <douglas.yung at sony.com>
Date: Sun, 10 May 2026 10:25:50 -0700
Subject: [PATCH 2/5] Fix test clang/test/Driver/hip-include-path.hip when
using CLANG_RESOURCE_DIR.
---
clang/test/Driver/hip-include-path.hip | 32 +++++++++++++-------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/clang/test/Driver/hip-include-path.hip b/clang/test/Driver/hip-include-path.hip
index 3c7384ab98354..726da8915fa68 100644
--- a/clang/test/Driver/hip-include-path.hip
+++ b/clang/test/Driver/hip-include-path.hip
@@ -2,50 +2,50 @@
// RUN: %clang -c -### --target=x86_64-unknown-linux-gnu --cuda-gpu-arch=gfx900 \
// RUN: -std=c++11 --rocm-path=%S/Inputs/rocm -nogpulib %s 2>&1 \
-// RUN: | FileCheck -check-prefixes=COMMON,CLANG,HIP %s
+// RUN: | FileCheck -check-prefixes=COMMON,CLANG,HIP -DRESOURCE_DIR=%clang-resource-dir %s
// RUN: %clang -c -### --target=x86_64-unknown-linux-gnu --cuda-gpu-arch=gfx900 \
// RUN: -std=c++11 --rocm-path=%S/Inputs/rocm -nobuiltininc -nogpulib %s 2>&1 \
-// RUN: | FileCheck -check-prefixes=COMMON,NOCLANG,HIP %s
+// RUN: | FileCheck -check-prefixes=COMMON,NOCLANG,HIP -DRESOURCE_DIR=%clang-resource-dir %s
// RUN: %clang -c -### --target=x86_64-unknown-linux-gnu --cuda-gpu-arch=gfx900 \
// RUN: -std=c++11 --rocm-path=%S/Inputs/rocm -nogpuinc -nogpulib %s 2>&1 \
-// RUN: | FileCheck -check-prefixes=COMMON,CLANG,NOHIP %s
+// RUN: | FileCheck -check-prefixes=COMMON,CLANG,NOHIP -DRESOURCE_DIR=%clang-resource-dir %s
// RUN: %clang -c -### --target=x86_64-unknown-linux-gnu --cuda-gpu-arch=gfx900 \
// RUN: -std=c++11 --rocm-path=%S/Inputs/rocm --no-offload-inc -nogpulib --offload-inc %s 2>&1 \
-// RUN: | FileCheck -check-prefixes=COMMON,CLANG,HIP %s
+// RUN: | FileCheck -check-prefixes=COMMON,CLANG,HIP -DRESOURCE_DIR=%clang-resource-dir %s
// COMMON-LABEL: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
-// CLANG-SAME: "-internal-isystem" "{{[^"]*}}/lib{{[^"]*}}/clang/{{[^"]*}}/include/cuda_wrappers"
-// NOCLANG-NOT: "{{[^"]*}}/lib{{[^"]*}}/clang/{{[^"]*}}/include/cuda_wrappers"
+// CLANG-SAME: "-internal-isystem" "[[RESOURCE_DIR]]/include/cuda_wrappers"
+// NOCLANG-NOT: "[[RESOURCE_DIR]]/include/cuda_wrappers"
// HIP-SAME: "-idirafter" "{{[^"]*}}Inputs/rocm/include"
// HIP-SAME: "-include" "__clang_hip_runtime_wrapper.h"
// NOHIP-NOT: "-include" "__clang_hip_runtime_wrapper.h"
// skip check of standard C++ include path
-// CLANG-SAME: "-internal-isystem" "{{[^"]*}}/lib{{[^"]*}}/clang/{{[^"]*}}/include"
-// NOCLANG-NOT: "{{[^"]*}}/lib{{[^"]*}}/clang/{{[^"]*}}/include"
+// CLANG-SAME: "-internal-isystem" "[[RESOURCE_DIR]]/include"
+// NOCLANG-NOT: [[RESOURCE_DIR]]/include"
// NOHIP-NOT: "{{.*}}Inputs/rocm/include"
// COMMON-LABEL: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
-// CLANG-SAME: "-internal-isystem" "{{[^"]*}}/lib{{[^"]*}}/clang/{{[^"]*}}/include/cuda_wrappers"
-// NOCLANG-NOT: "{{[^"]*}}/lib{{[^"]*}}/clang/{{[^"]*}}/include/cuda_wrappers"
+// CLANG-SAME: "-internal-isystem" "[[RESOURCE_DIR]]/include/cuda_wrappers"
+// NOCLANG-NOT: "[[RESOURCE_DIR]]/include/cuda_wrappers"
// HIP-SAME: "-idirafter" "{{[^"]*}}Inputs/rocm/include"
// HIP-SAME: "-include" "__clang_hip_runtime_wrapper.h"
// NOHIP-NOT: "-include" "__clang_hip_runtime_wrapper.h"
// skip check of standard C++ include path
-// CLANG-SAME: "-internal-isystem" "{{[^"]*}}/lib{{[^"]*}}/clang/{{[^"]*}}/include"
-// NOCLANG-NOT: "{{[^"]*}}/lib{{[^"]*}}/clang/{{[^"]*}}/include"
+// CLANG-SAME: "-internal-isystem" "[[RESOURCE_DIR]]/include"
+// NOCLANG-NOT: "[[RESOURCE_DIR]]/include"
// NOHIP-NOT: "{{.*}}Inputs/rocm/include"
// RUN: %clang -c -### --target=x86_64-unknown-linux-gnu --cuda-gpu-arch=gfx900 \
// RUN: -std=c++11 --rocm-path=%S/Inputs/rocm -nogpulib %s 2>&1 \
-// RUN: --hip-version=3.5 | FileCheck -check-prefixes=ROCM35 %s
+// RUN: --hip-version=3.5 | FileCheck -check-prefixes=ROCM35 -DRESOURCE_DIR=%clang-resource-dir %s
// ROCM35-LABEL: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
-// ROCM35-NOT: "{{[^"]*}}/lib{{[^"]*}}/clang/{{[^"]*}}/include/cuda_wrappers"
-// ROCM35-SAME: "-internal-isystem" "{{[^"]*}}/lib{{[^"]*}}/clang/{{[^"]*}}"
+// ROCM35-NOT: "[[RESOURCE_DIR]]/include/cuda_wrappers"
+// ROCM35-SAME: "-internal-isystem" "[[RESOURCE_DIR]]"
// ROCM35-SAME: "-idirafter" "{{[^"]*}}Inputs/rocm/include"
// ROCM35-NOT: "-include" "__clang_hip_runtime_wrapper.h"
// skip check of standard C++ include path
-// ROCM35-SAME: "-internal-isystem" "{{[^"]*}}/lib{{[^"]*}}/clang/{{[^"]*}}/include"
+// ROCM35-SAME: "-internal-isystem" "[[RESOURCE_DIR]]/include"
>From c81f31bdcfe0e6c85c85648627149195c222ca25 Mon Sep 17 00:00:00 2001
From: Douglas Yung <douglas.yung at sony.com>
Date: Sun, 10 May 2026 10:26:07 -0700
Subject: [PATCH 3/5] Fix test clang/test/Preprocessor/iwithprefix.c when using
CLANG_RESOURCE_DIR.
---
clang/test/Preprocessor/iwithprefix.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang/test/Preprocessor/iwithprefix.c b/clang/test/Preprocessor/iwithprefix.c
index 70d2abcd374ca..1eba5e3ed8134 100644
--- a/clang/test/Preprocessor/iwithprefix.c
+++ b/clang/test/Preprocessor/iwithprefix.c
@@ -5,10 +5,10 @@
// RUN: %clang_cc1 -triple x86_64-unknown-unknown \
// RUN: -iprefix %t.tmps/ -iwithprefix second \
// RUN: -isystem %t.tmps/first -v %s 2> %t.out
-// RUN: FileCheck %s < %t.out
+// RUN: FileCheck %s -DRESOURCE_DIR=%clang-resource-dir < %t.out
// CHECK: #include <...> search starts here:
// CHECK: {{.*}}.tmps/first
-// CHECK: {{/|\\}}clang{{/|\\}}{{[.0-9]+}}{{/|\\}}include
+// CHECK: [[RESOURCE_DIR]]{{[\/]}}include
// CHECK: {{.*}}.tmps/second
// CHECK-NOT: {{.*}}.tmps
>From 55b837bd43c1a53a5e32f63210d6c66579c6d7b5 Mon Sep 17 00:00:00 2001
From: Douglas Yung <douglas.yung at sony.com>
Date: Tue, 9 Jun 2026 11:55:27 -0400
Subject: [PATCH 4/5] Fix missing ".
---
clang/test/Driver/hip-include-path.hip | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/test/Driver/hip-include-path.hip b/clang/test/Driver/hip-include-path.hip
index 726da8915fa68..55acfc5e2b915 100644
--- a/clang/test/Driver/hip-include-path.hip
+++ b/clang/test/Driver/hip-include-path.hip
@@ -24,7 +24,7 @@
// NOHIP-NOT: "-include" "__clang_hip_runtime_wrapper.h"
// skip check of standard C++ include path
// CLANG-SAME: "-internal-isystem" "[[RESOURCE_DIR]]/include"
-// NOCLANG-NOT: [[RESOURCE_DIR]]/include"
+// NOCLANG-NOT: "[[RESOURCE_DIR]]/include"
// NOHIP-NOT: "{{.*}}Inputs/rocm/include"
// COMMON-LABEL: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
>From 3a43323cd5bbdca5bc2224f3aacf0b272fbcda6b Mon Sep 17 00:00:00 2001
From: Douglas Yung <douglas.yung at sony.com>
Date: Tue, 9 Jun 2026 11:57:44 -0400
Subject: [PATCH 5/5] Put original path separator regex back.
---
clang/test/Preprocessor/iwithprefix.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/test/Preprocessor/iwithprefix.c b/clang/test/Preprocessor/iwithprefix.c
index 1eba5e3ed8134..9c3d565785aed 100644
--- a/clang/test/Preprocessor/iwithprefix.c
+++ b/clang/test/Preprocessor/iwithprefix.c
@@ -9,6 +9,6 @@
// CHECK: #include <...> search starts here:
// CHECK: {{.*}}.tmps/first
-// CHECK: [[RESOURCE_DIR]]{{[\/]}}include
+// CHECK: [[RESOURCE_DIR]]{{/|\\}}include
// CHECK: {{.*}}.tmps/second
// CHECK-NOT: {{.*}}.tmps
More information about the cfe-commits
mailing list