[PATCH] D104800: [OpenCL] Do not include default header for preprocessor output as input
Yaxun Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 25 07:29:21 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3193133add7e: [OpenCL] Do not include default header for preprocessor output as input (authored by yaxunl).
Herald added a subscriber: ldrumm.
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104800/new/
https://reviews.llvm.org/D104800
Files:
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/amdgpu-toolchain-opencl.cl
Index: clang/test/Driver/amdgpu-toolchain-opencl.cl
===================================================================
--- clang/test/Driver/amdgpu-toolchain-opencl.cl
+++ clang/test/Driver/amdgpu-toolchain-opencl.cl
@@ -7,6 +7,12 @@
// RUN: %clang -### -target amdgcn-amd-amdhsa-opencl -x cl -c -emit-llvm -mcpu=fiji -Og %s 2>&1 | FileCheck -check-prefix=CHECK_Og %s
// RUN: %clang -### -target amdgcn-amd-amdhsa-opencl -x cl -c -emit-llvm -mcpu=fiji -Ofast %s 2>&1 | FileCheck -check-prefix=CHECK_Ofast %s
// RUN: %clang -### -target amdgcn-amd-amdhsa-opencl -x cl -c -emit-llvm -mcpu=fiji %s 2>&1 | FileCheck -check-prefix=CHECK_O_DEFAULT %s
+
+// Check default include file is not included for preprocessor output.
+
+// RUN: %clang -### -target amdgcn-amd-amdhsa-opencl -x cl -c -emit-llvm -mcpu=fiji %s 2>&1 | FileCheck -check-prefix=CHK-INC %s
+// RUN: %clang -### -target amdgcn-amd-amdhsa-opencl -x cl -c -emit-llvm -mcpu=fiji -save-temps %s 2>&1 | FileCheck -check-prefix=CHK-INC %s
+
// CHECK_O0: clang{{.*}} "-O0"
// CHECK_O1: clang{{.*}} "-O1"
// CHECK_O2: clang{{.*}} "-O2"
@@ -17,3 +23,5 @@
// CHECK_Ofast: {{.*}}clang{{.*}} "-Ofast"
// CHECK_O_DEFAULT: clang{{.*}} "-O3"
+// CHK-INC: clang{{.*}} "-cc1" {{.*}}"-finclude-default-header" "-fdeclare-opencl-builtins" {{.*}}"-x" "cl"
+// CHK-INC-NOT: clang{{.*}} "-cc1" {{.*}}"-finclude-default-header" "-fdeclare-opencl-builtins" {{.*}}"-x" "cpp-output"
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -3286,7 +3286,8 @@
CmdArgs.push_back(Args.MakeArgString(A->getOption().getPrefixedName()));
// Only add the default headers if we are compiling OpenCL sources.
- if ((types::isOpenCL(InputType) || Args.hasArg(options::OPT_cl_std_EQ)) &&
+ if ((types::isOpenCL(InputType) ||
+ (Args.hasArg(options::OPT_cl_std_EQ) && types::isSrcFile(InputType))) &&
!Args.hasArg(options::OPT_cl_no_stdinc)) {
CmdArgs.push_back("-finclude-default-header");
CmdArgs.push_back("-fdeclare-opencl-builtins");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104800.354494.patch
Type: text/x-patch
Size: 2152 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210625/df3be395/attachment.bin>
More information about the cfe-commits
mailing list