diff --git a/tools/clang/lib/Headers/hlsl/dx/linalg.h b/tools/clang/lib/Headers/hlsl/dx/linalg.h index ff5e119fa37..fade7c575f7 100644 --- a/tools/clang/lib/Headers/hlsl/dx/linalg.h +++ b/tools/clang/lib/Headers/hlsl/dx/linalg.h @@ -9,6 +9,9 @@ // DirectX Shader Model 6.10 Linear Algebra objects and APIs. //===----------------------------------------------------------------------===// +#ifndef _HLSL_DX_LINALG_H_ +#define _HLSL_DX_LINALG_H_ + #include #include @@ -720,3 +723,5 @@ InterlockedAccumulate(RWByteAddressBuffer Res, uint StartOffset, #pragma dxc diagnostic pop #endif // SM 6.10 check and HV version check + +#endif // _HLSL_DX_LINALG_H_ diff --git a/tools/clang/test/SemaHLSL/hlsl/embedded_headers/include_guards.hlsl b/tools/clang/test/SemaHLSL/hlsl/embedded_headers/include_guards.hlsl new file mode 100644 index 00000000000..8c5b493cccd --- /dev/null +++ b/tools/clang/test/SemaHLSL/hlsl/embedded_headers/include_guards.hlsl @@ -0,0 +1,31 @@ +// REQUIRES: dxil-1-10 + +// RUN: %dxc -T cs_6_10 -E main -HV 2021 -enable-16bit-types -verify %s +// RUN: %dxc -DTEST_DXIL -T cs_6_10 -E main -HV 2021 -enable-16bit-types -verify %s +// RUN: %dxc %if spirv %{ -spirv -fspv-target-env=vulkan1.3 %} -T cs_6_2 -E main -HV 2021 -enable-16bit-types -verify %s + +// expected-no-diagnostics + +#include +#include +#include +#include +#include +#include + +#ifdef __spirv__ +#include +#include +#include +#include +// The public header also covers cooperative_matrix.impl. +#include +#include +#endif + +#ifdef TEST_DXIL +#include +#include +#endif + +[numthreads(1, 1, 1)] void main() {}