Index: clang/lib/Driver/ToolChains/Clang.cpp =================================================================== --- clang/lib/Driver/ToolChains/Clang.cpp +++ clang/lib/Driver/ToolChains/Clang.cpp @@ -4630,8 +4630,13 @@ TC.addClangWarningOptions(CmdArgs); // FIXME: Subclass ToolChain for SPIR and move this to addClangWarningOptions. - if (Triple.isSPIR() || Triple.isSPIRV()) + if (Triple.isSPIR() || Triple.isSPIRV()) { CmdArgs.push_back("-Wspir-compat"); + // SPIR-V support still needs pointer types in some cases as recovering + // type from pointer uses is not always possible e.g. for extern functions + // (see PR56660). + CmdArgs.push_back("-no-opaque-pointers"); + } // Select the appropriate action. RewriteKind rewriteKind = RK_None; Index: clang/test/Driver/spirv-toolchain.cl =================================================================== --- clang/test/Driver/spirv-toolchain.cl +++ clang/test/Driver/spirv-toolchain.cl @@ -6,6 +6,7 @@ // RUN: %clang -### --target=spirv64 -x c -c %s 2>&1 | FileCheck --check-prefix=SPV64 %s // SPV64: "-cc1" "-triple" "spirv64" +// SPV64-SAME: "-no-opaque-pointers" // SPV64-SAME: "-o" [[BC:".*bc"]] // SPV64: {{llvm-spirv.*"}} [[BC]] "-o" {{".*o"}} @@ -16,6 +17,7 @@ // RUN: %clang -### --target=spirv32 -x c -c %s 2>&1 | FileCheck --check-prefix=SPV32 %s // SPV32: "-cc1" "-triple" "spirv32" +// SPV32-SAME: "-no-opaque-pointers" // SPV32-SAME: "-o" [[BC:".*bc"]] // SPV32: {{llvm-spirv.*"}} [[BC]] "-o" {{".*o"}}