Author: Deric C. Date: 2026-02-20T17:49:59-08:00 New Revision: 3343a5bd81ddb0b76e703463292fabf655bfdf19
URL: https://github.com/llvm/llvm-project/commit/3343a5bd81ddb0b76e703463292fabf655bfdf19 DIFF: https://github.com/llvm/llvm-project/commit/3343a5bd81ddb0b76e703463292fabf655bfdf19.diff LOG: [HLSL] Enable `-Wconversion`, `-Wvector-conversion`, and `-Wmatrix-conversion` warnings for HLSL by default (#182607) Fixes #180038 by enabling `-Wconversion`, `-Wvector-conversion`, and `-Wmatrix-conversion` warnings for HLSL by default, both in the HLSL clang driver and when fixing up clang invocations under HLSL in CompilerInvocation.cpp (so that they are enabled even with clang -cc1). This PR also updates existing tests to expect warnings that weren't expected before, and removes the `-Wconversion` flags from existing HLSL tests since it is now redundant due to being enabled by default. Note that no existing HLSL tests use or exercise `-Wvector-conversion` or `-Wmatrix-conversion`. Added: clang/test/Driver/HLSL/conversion-warning-flags.hlsl clang/test/SemaHLSL/no-conversion-warnings.hlsl Modified: clang/lib/Driver/ToolChains/HLSL.cpp clang/lib/Frontend/CompilerInvocation.cpp clang/test/CodeGenHLSL/builtins/acos-overloads.hlsl clang/test/CodeGenHLSL/builtins/asin-overloads.hlsl clang/test/CodeGenHLSL/builtins/atan-overloads.hlsl clang/test/CodeGenHLSL/builtins/cosh-overloads.hlsl clang/test/CodeGenHLSL/builtins/degrees-overloads.hlsl clang/test/CodeGenHLSL/builtins/exp-overloads.hlsl clang/test/CodeGenHLSL/builtins/exp2-overloads.hlsl clang/test/CodeGenHLSL/builtins/floor-overloads.hlsl clang/test/CodeGenHLSL/builtins/frac-overloads.hlsl clang/test/CodeGenHLSL/builtins/isinf-overloads.hlsl clang/test/CodeGenHLSL/builtins/log-overloads.hlsl clang/test/CodeGenHLSL/builtins/log10-overloads.hlsl clang/test/CodeGenHLSL/builtins/log2-overloads.hlsl clang/test/CodeGenHLSL/builtins/normalize-overloads.hlsl clang/test/CodeGenHLSL/builtins/round-overloads.hlsl clang/test/CodeGenHLSL/builtins/rsqrt-overloads.hlsl clang/test/CodeGenHLSL/builtins/sin-overloads.hlsl clang/test/CodeGenHLSL/builtins/sinh-overloads.hlsl clang/test/CodeGenHLSL/builtins/sqrt-overloads.hlsl clang/test/CodeGenHLSL/builtins/step-overloads.hlsl clang/test/CodeGenHLSL/builtins/tan-overloads.hlsl clang/test/CodeGenHLSL/builtins/tanh-overloads.hlsl clang/test/CodeGenHLSL/builtins/trunc-overloads.hlsl clang/test/ParserHLSL/group_shared_202x.hlsl clang/test/SemaHLSL/BuiltIns/select-errors.hlsl clang/test/SemaHLSL/Language/ImpCastAddrSpace.hlsl clang/test/SemaHLSL/Language/InitIncompleteArrays.hlsl clang/test/SemaHLSL/Language/InitLists.hlsl clang/test/SemaHLSL/Language/OutputParameters.hlsl clang/test/SemaHLSL/Language/UsualArithmeticConversions.hlsl clang/test/SemaHLSL/ScalarOverloadResolution.hlsl clang/test/SemaHLSL/SplatOverloadResolution.hlsl clang/test/SemaHLSL/TruncationOverloadResolution.hlsl clang/test/SemaHLSL/Types/Arithmetic/literal_suffixes.hlsl clang/test/SemaHLSL/Types/Arithmetic/literal_suffixes_no_16bit.hlsl clang/test/SemaHLSL/VectorElementOverloadResolution.hlsl clang/test/SemaHLSL/matrix-member-access-errors.hlsl clang/test/SemaHLSL/parameter_modifiers.hlsl clang/test/SemaHLSL/standard_conversion_sequences.hlsl Removed: clang/test/Driver/HLSL/wconversion.hlsl ################################################################################ diff --git a/clang/lib/Driver/ToolChains/HLSL.cpp b/clang/lib/Driver/ToolChains/HLSL.cpp index 587481b5623e1..28835d5077db7 100644 --- a/clang/lib/Driver/ToolChains/HLSL.cpp +++ b/clang/lib/Driver/ToolChains/HLSL.cpp @@ -594,4 +594,6 @@ bool HLSLToolChain::isLastJob(DerivedArgList &Args, void HLSLToolChain::addClangWarningOptions(ArgStringList &CC1Args) const { CC1Args.push_back("-Wconversion"); + CC1Args.push_back("-Wvector-conversion"); + CC1Args.push_back("-Wmatrix-conversion"); } diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 6aa2afb6f5918..13472765a4f58 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -659,6 +659,18 @@ static bool FixupInvocation(CompilerInvocation &Invocation, Diags.Report(diag::warn_ignored_hip_only_option) << Args.getLastArg(OPT_gpu_max_threads_per_block_EQ)->getAsString(Args); + // HLSL invocations should always have -Wconversion, -Wvector-conversion, and + // -Wmatrix-conversion by default. + if (LangOpts.HLSL) { + auto &Warnings = Invocation.getDiagnosticOpts().Warnings; + if (!llvm::is_contained(Warnings, "conversion")) + Warnings.insert(Warnings.begin(), "conversion"); + if (!llvm::is_contained(Warnings, "vector-conversion")) + Warnings.insert(Warnings.begin(), "vector-conversion"); + if (!llvm::is_contained(Warnings, "matrix-conversion")) + Warnings.insert(Warnings.begin(), "matrix-conversion"); + } + // When these options are used, the compiler is allowed to apply // optimizations that may affect the final result. For example // (x+y)+z is transformed to x+(y+z) but may not give the same diff --git a/clang/test/CodeGenHLSL/builtins/acos-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/acos-overloads.hlsl index 45c0826eff811..ebcbddf1cc7eb 100644 --- a/clang/test/CodeGenHLSL/builtins/acos-overloads.hlsl +++ b/clang/test/CodeGenHLSL/builtins/acos-overloads.hlsl @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ // RUN: spirv-unknown-vulkan-compute %s -emit-llvm \ -// RUN: -Wdeprecated-declarations -Wconversion -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -Wdeprecated-declarations -o - | FileCheck %s --check-prefixes=CHECK \ // RUN: -DFNATTRS="hidden spir_func noundef nofpclass(nan inf)" // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple spirv-unknown-vulkan-compute %s \ // RUN: -verify -verify-ignore-unexpected=note diff --git a/clang/test/CodeGenHLSL/builtins/asin-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/asin-overloads.hlsl index eee2bde9e78c4..f4234cc31805c 100644 --- a/clang/test/CodeGenHLSL/builtins/asin-overloads.hlsl +++ b/clang/test/CodeGenHLSL/builtins/asin-overloads.hlsl @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ // RUN: spirv-unknown-vulkan-compute %s -emit-llvm \ -// RUN: -Wdeprecated-declarations -Wconversion -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -Wdeprecated-declarations -o - | FileCheck %s --check-prefixes=CHECK \ // RUN: -DFNATTRS="hidden spir_func noundef nofpclass(nan inf)" // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple spirv-unknown-vulkan-compute %s \ // RUN: -verify -verify-ignore-unexpected=note diff --git a/clang/test/CodeGenHLSL/builtins/atan-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/atan-overloads.hlsl index bc115f71be796..953f90d60180b 100644 --- a/clang/test/CodeGenHLSL/builtins/atan-overloads.hlsl +++ b/clang/test/CodeGenHLSL/builtins/atan-overloads.hlsl @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ // RUN: spirv-unknown-vulkan-compute %s -emit-llvm \ -// RUN: -Wdeprecated-declarations -Wconversion -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -Wdeprecated-declarations -o - | FileCheck %s --check-prefixes=CHECK \ // RUN: -DFNATTRS="hidden spir_func noundef nofpclass(nan inf)" // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple spirv-unknown-vulkan-compute %s \ // RUN: -verify -verify-ignore-unexpected=note diff --git a/clang/test/CodeGenHLSL/builtins/cosh-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/cosh-overloads.hlsl index a45631c754962..c4ed56e0073e2 100644 --- a/clang/test/CodeGenHLSL/builtins/cosh-overloads.hlsl +++ b/clang/test/CodeGenHLSL/builtins/cosh-overloads.hlsl @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ // RUN: spirv-unknown-vulkan-compute %s -emit-llvm \ -// RUN: -Wdeprecated-declarations -Wconversion -o - | \ +// RUN: -Wdeprecated-declarations -o - | \ // RUN: FileCheck %s --check-prefixes=CHECK -DFNATTRS="hidden spir_func noundef nofpclass(nan inf)" // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple spirv-unknown-vulkan-compute %s \ // RUN: -verify -verify-ignore-unexpected=note diff --git a/clang/test/CodeGenHLSL/builtins/degrees-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/degrees-overloads.hlsl index 0db116f80e6f2..d76ee2973be2c 100644 --- a/clang/test/CodeGenHLSL/builtins/degrees-overloads.hlsl +++ b/clang/test/CodeGenHLSL/builtins/degrees-overloads.hlsl @@ -1,10 +1,10 @@ // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm \ -// RUN: -Wdeprecated-declarations -Wconversion -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -Wdeprecated-declarations -o - | FileCheck %s --check-prefixes=CHECK \ // RUN: -DFNATTRS="hidden noundef nofpclass(nan inf)" -DTARGET=dx // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ // RUN: spirv-unknown-vulkan-compute %s -emit-llvm \ -// RUN: -Wdeprecated-declarations -Wconversion -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -Wdeprecated-declarations -o - | FileCheck %s --check-prefixes=CHECK \ // RUN: -DFNATTRS="hidden spir_func noundef nofpclass(nan inf)" -DTARGET=spv // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s \ // RUN: -verify -verify-ignore-unexpected=note diff --git a/clang/test/CodeGenHLSL/builtins/exp-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/exp-overloads.hlsl index 5c78342426d2f..80c9906555c3b 100644 --- a/clang/test/CodeGenHLSL/builtins/exp-overloads.hlsl +++ b/clang/test/CodeGenHLSL/builtins/exp-overloads.hlsl @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \ -// RUN: -Wdeprecated-declarations -Wconversion -emit-llvm -o - | \ +// RUN: -Wdeprecated-declarations -emit-llvm -o - | \ // RUN: FileCheck %s --check-prefixes=CHECK -DFNATTRS="hidden noundef nofpclass(nan inf)" // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \ // RUN: -verify -verify-ignore-unexpected=note diff --git a/clang/test/CodeGenHLSL/builtins/exp2-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/exp2-overloads.hlsl index 362d5346c4079..9585183ad46c3 100644 --- a/clang/test/CodeGenHLSL/builtins/exp2-overloads.hlsl +++ b/clang/test/CodeGenHLSL/builtins/exp2-overloads.hlsl @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \ -// RUN: -Wdeprecated-declarations -Wconversion -emit-llvm -o - | \ +// RUN: -Wdeprecated-declarations -emit-llvm -o - | \ // RUN: FileCheck %s --check-prefixes=CHECK -DFNATTRS="hidden noundef nofpclass(nan inf)" // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \ // RUN: -verify -verify-ignore-unexpected=note diff --git a/clang/test/CodeGenHLSL/builtins/floor-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/floor-overloads.hlsl index a76ff8e522203..23d71ef1d7254 100644 --- a/clang/test/CodeGenHLSL/builtins/floor-overloads.hlsl +++ b/clang/test/CodeGenHLSL/builtins/floor-overloads.hlsl @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm \ -// RUN: -Wdeprecated-declarations -Wconversion -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -Wdeprecated-declarations -o - | FileCheck %s --check-prefixes=CHECK \ // RUN: -DFNATTRS="hidden noundef nofpclass(nan inf)" // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s \ // RUN: -verify -verify-ignore-unexpected=note diff --git a/clang/test/CodeGenHLSL/builtins/frac-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/frac-overloads.hlsl index ad3c08d160b60..ba22408e57e1c 100644 --- a/clang/test/CodeGenHLSL/builtins/frac-overloads.hlsl +++ b/clang/test/CodeGenHLSL/builtins/frac-overloads.hlsl @@ -1,10 +1,10 @@ // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm \ -// RUN: -Wdeprecated-declarations -Wconversion -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -Wdeprecated-declarations -o - | FileCheck %s --check-prefixes=CHECK \ // RUN: -DFNATTRS="hidden noundef nofpclass(nan inf)" -DTARGET=dx // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ // RUN: spirv-unknown-vulkan-compute %s -emit-llvm \ -// RUN: -Wdeprecated-declarations -Wconversion -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -Wdeprecated-declarations -o - | FileCheck %s --check-prefixes=CHECK \ // RUN: -DFNATTRS="hidden spir_func noundef nofpclass(nan inf)" -DTARGET=spv // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s \ // RUN: -verify -verify-ignore-unexpected=note diff --git a/clang/test/CodeGenHLSL/builtins/isinf-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/isinf-overloads.hlsl index 6e7ac30e5c926..fa181cf4c4934 100644 --- a/clang/test/CodeGenHLSL/builtins/isinf-overloads.hlsl +++ b/clang/test/CodeGenHLSL/builtins/isinf-overloads.hlsl @@ -1,10 +1,10 @@ // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm \ -// RUN: -Wdeprecated-declarations -Wconversion -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -Wdeprecated-declarations -o - | FileCheck %s --check-prefixes=CHECK \ // RUN: -DFNATTRS="hidden noundef" -DTARGET=dx // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ // RUN: spirv-unknown-vulkan-compute %s -emit-llvm \ -// RUN: -Wdeprecated-declarations -Wconversion -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -Wdeprecated-declarations -o - | FileCheck %s --check-prefixes=CHECK \ // RUN: -DFNATTRS="hidden spir_func noundef" -DTARGET=spv // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s \ // RUN: -verify -verify-ignore-unexpected=note diff --git a/clang/test/CodeGenHLSL/builtins/log-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/log-overloads.hlsl index 5ca5a81dd4cdb..73d3497c3aaeb 100644 --- a/clang/test/CodeGenHLSL/builtins/log-overloads.hlsl +++ b/clang/test/CodeGenHLSL/builtins/log-overloads.hlsl @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm \ -// RUN: -Wdeprecated-declarations -Wconversion -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -Wdeprecated-declarations -o - | FileCheck %s --check-prefixes=CHECK \ // RUN: -DFNATTRS="hidden noundef nofpclass(nan inf)" // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s \ // RUN: -verify -verify-ignore-unexpected=note diff --git a/clang/test/CodeGenHLSL/builtins/log10-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/log10-overloads.hlsl index fa5bcadce5ed9..1a7b8ad637d49 100644 --- a/clang/test/CodeGenHLSL/builtins/log10-overloads.hlsl +++ b/clang/test/CodeGenHLSL/builtins/log10-overloads.hlsl @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \ -// RUN: -Wdeprecated-declarations -Wconversion -emit-llvm -o - | \ +// RUN: -Wdeprecated-declarations -emit-llvm -o - | \ // RUN: FileCheck %s --check-prefixes=CHECK -DFNATTRS="hidden noundef nofpclass(nan inf)" // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \ // RUN: -verify -verify-ignore-unexpected=note diff --git a/clang/test/CodeGenHLSL/builtins/log2-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/log2-overloads.hlsl index ef9f8efc7169d..a812af5195571 100644 --- a/clang/test/CodeGenHLSL/builtins/log2-overloads.hlsl +++ b/clang/test/CodeGenHLSL/builtins/log2-overloads.hlsl @@ -1,6 +1,6 @@ /// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm \ -// RUN: -Wdeprecated-declarations -Wconversion -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -Wdeprecated-declarations -o - | FileCheck %s --check-prefixes=CHECK \ // RUN: -DFNATTRS="hidden noundef nofpclass(nan inf)" // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s \ // RUN: -verify -verify-ignore-unexpected=note diff --git a/clang/test/CodeGenHLSL/builtins/normalize-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/normalize-overloads.hlsl index 306b710493d4e..3f592a83cfe48 100644 --- a/clang/test/CodeGenHLSL/builtins/normalize-overloads.hlsl +++ b/clang/test/CodeGenHLSL/builtins/normalize-overloads.hlsl @@ -1,10 +1,10 @@ // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm \ -// RUN: -Wdeprecated-declarations -Wconversion -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -Wdeprecated-declarations -o - | FileCheck %s --check-prefixes=CHECK \ // RUN: -DFNATTRS="hidden noundef nofpclass(nan inf)" -DTARGET=dx // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ // RUN: spirv-unknown-vulkan-compute %s -emit-llvm \ -// RUN: -Wdeprecated-declarations -Wconversion -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -Wdeprecated-declarations -o - | FileCheck %s --check-prefixes=CHECK \ // RUN: -DFNATTRS="hidden spir_func noundef nofpclass(nan inf)" -DTARGET=spv // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s \ // RUN: -verify -verify-ignore-unexpected=note diff --git a/clang/test/CodeGenHLSL/builtins/round-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/round-overloads.hlsl index 66414ef743d96..8ee14fc65ae88 100644 --- a/clang/test/CodeGenHLSL/builtins/round-overloads.hlsl +++ b/clang/test/CodeGenHLSL/builtins/round-overloads.hlsl @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm \ -// RUN: -Wdeprecated-declarations -Wconversion -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -Wdeprecated-declarations -o - | FileCheck %s --check-prefixes=CHECK \ // RUN: -DFNATTRS="hidden noundef nofpclass(nan inf)" // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s \ // RUN: -verify -verify-ignore-unexpected=note diff --git a/clang/test/CodeGenHLSL/builtins/rsqrt-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/rsqrt-overloads.hlsl index f9142ff9aebdb..eaf41c3d92831 100644 --- a/clang/test/CodeGenHLSL/builtins/rsqrt-overloads.hlsl +++ b/clang/test/CodeGenHLSL/builtins/rsqrt-overloads.hlsl @@ -1,10 +1,10 @@ // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm \ -// RUN: -Wdeprecated-declarations -Wconversion -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -Wdeprecated-declarations -o - | FileCheck %s --check-prefixes=CHECK \ // RUN: -DFNATTRS="hidden noundef nofpclass(nan inf)" -DTARGET=dx // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ // RUN: spirv-unknown-vulkan-compute %s -emit-llvm \ -// RUN: -Wdeprecated-declarations -Wconversion -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -Wdeprecated-declarations -o - | FileCheck %s --check-prefixes=CHECK \ // RUN: -DFNATTRS="hidden spir_func noundef nofpclass(nan inf)" -DTARGET=spv // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s \ // RUN: -verify -verify-ignore-unexpected=note diff --git a/clang/test/CodeGenHLSL/builtins/sin-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/sin-overloads.hlsl index 16d29aadd924f..f497bf3e25758 100644 --- a/clang/test/CodeGenHLSL/builtins/sin-overloads.hlsl +++ b/clang/test/CodeGenHLSL/builtins/sin-overloads.hlsl @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm \ -// RUN: -Wdeprecated-declarations -Wconversion -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -Wdeprecated-declarations -o - | FileCheck %s --check-prefixes=CHECK \ // RUN: -DFNATTRS="hidden noundef nofpclass(nan inf)" // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s \ // RUN: -verify -verify-ignore-unexpected=note diff --git a/clang/test/CodeGenHLSL/builtins/sinh-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/sinh-overloads.hlsl index 6db821faf468d..f5c10428f5f93 100644 --- a/clang/test/CodeGenHLSL/builtins/sinh-overloads.hlsl +++ b/clang/test/CodeGenHLSL/builtins/sinh-overloads.hlsl @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \ -// RUN: -Wdeprecated-declarations -Wconversion -emit-llvm -o - | \ +// RUN: -Wdeprecated-declarations -emit-llvm -o - | \ // RUN: FileCheck %s --check-prefixes=CHECK -DFNATTRS="hidden noundef nofpclass(nan inf)" // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \ // RUN: -verify -verify-ignore-unexpected=note diff --git a/clang/test/CodeGenHLSL/builtins/sqrt-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/sqrt-overloads.hlsl index 12cc743f48d93..2acdcdc88bd93 100644 --- a/clang/test/CodeGenHLSL/builtins/sqrt-overloads.hlsl +++ b/clang/test/CodeGenHLSL/builtins/sqrt-overloads.hlsl @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm \ -// RUN: -Wdeprecated-declarations -Wconversion -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -Wdeprecated-declarations -o - | FileCheck %s --check-prefixes=CHECK \ // RUN: -DFNATTRS="hidden noundef nofpclass(nan inf)" // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s \ // RUN: -verify -verify-ignore-unexpected=note diff --git a/clang/test/CodeGenHLSL/builtins/step-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/step-overloads.hlsl index cdc655ca85937..2e85005a5a9f4 100644 --- a/clang/test/CodeGenHLSL/builtins/step-overloads.hlsl +++ b/clang/test/CodeGenHLSL/builtins/step-overloads.hlsl @@ -1,10 +1,10 @@ // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm \ -// RUN: -Wdeprecated-declarations -Wconversion -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -Wdeprecated-declarations -o - | FileCheck %s --check-prefixes=CHECK \ // RUN: -DFNATTRS="hidden noundef nofpclass(nan inf)" -DTARGET=dx // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ // RUN: spirv-unknown-vulkan-compute %s -emit-llvm \ -// RUN: -Wdeprecated-declarations -Wconversion -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -Wdeprecated-declarations -o - | FileCheck %s --check-prefixes=CHECK \ // RUN: -DFNATTRS="hidden spir_func noundef nofpclass(nan inf)" -DTARGET=spv // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s \ // RUN: -verify -verify-ignore-unexpected=note diff --git a/clang/test/CodeGenHLSL/builtins/tan-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/tan-overloads.hlsl index 7186deed43f73..9c602598bbe90 100644 --- a/clang/test/CodeGenHLSL/builtins/tan-overloads.hlsl +++ b/clang/test/CodeGenHLSL/builtins/tan-overloads.hlsl @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ // RUN: spirv-unknown-vulkan-compute %s -emit-llvm \ -// RUN: -Wdeprecated-declarations -Wconversion -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -Wdeprecated-declarations -o - | FileCheck %s --check-prefixes=CHECK \ // RUN: -DFNATTRS="hidden spir_func noundef nofpclass(nan inf)" // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple spirv-unknown-vulkan-compute %s \ // RUN: -verify -verify-ignore-unexpected=note diff --git a/clang/test/CodeGenHLSL/builtins/tanh-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/tanh-overloads.hlsl index a24721e3d9e63..249342c056952 100644 --- a/clang/test/CodeGenHLSL/builtins/tanh-overloads.hlsl +++ b/clang/test/CodeGenHLSL/builtins/tanh-overloads.hlsl @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ // RUN: spirv-unknown-vulkan-compute %s -emit-llvm \ -// RUN: -Wdeprecated-declarations -Wconversion -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -Wdeprecated-declarations -o - | FileCheck %s --check-prefixes=CHECK \ // RUN: -DFNATTRS="hidden spir_func noundef nofpclass(nan inf)" -DTARGET=spv // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple spirv-unknown-vulkan-compute %s \ // RUN: -verify -verify-ignore-unexpected=note diff --git a/clang/test/CodeGenHLSL/builtins/trunc-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/trunc-overloads.hlsl index 226ee137783c3..cbc87cd16f141 100644 --- a/clang/test/CodeGenHLSL/builtins/trunc-overloads.hlsl +++ b/clang/test/CodeGenHLSL/builtins/trunc-overloads.hlsl @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm \ -// RUN: -Wdeprecated-declarations -Wconversion -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -Wdeprecated-declarations -o - | FileCheck %s --check-prefixes=CHECK \ // RUN: -DFNATTRS="hidden noundef nofpclass(nan inf)" // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s \ // RUN: -verify -verify-ignore-unexpected=note diff --git a/clang/test/Driver/HLSL/conversion-warning-flags.hlsl b/clang/test/Driver/HLSL/conversion-warning-flags.hlsl new file mode 100644 index 0000000000000..a22f93e762124 --- /dev/null +++ b/clang/test/Driver/HLSL/conversion-warning-flags.hlsl @@ -0,0 +1,17 @@ +// RUN: %clang_dxc -T lib_6_7 %s -### %s 2>&1 | FileCheck %s --check-prefixes=CONV +// RUN: %clang_dxc -T lib_6_7 -Wno-conversion -Wno-vector-conversion -Wno-matrix-conversion %s -### %s 2>&1 | FileCheck %s --check-prefixes=NOCONV + +// make sure we generate -Wconversion by default +// CONV: "-Wconversion" +// make sure -Wno-conversion still works +// NOCONV: "-Wno-conversion" + +// make sure we generate -Wvector-conversion by default +// CONV: "-Wvector-conversion" +// make sure -Wno-vector-conversion still works +// NOCONV: "-Wno-vector-conversion" + +// make sure we generate -Wmatrix-conversion by default +// CONV: "-Wmatrix-conversion" +// make sure -Wno-matrix-conversion still works +// NOCONV: "-Wno-matrix-conversion" diff --git a/clang/test/Driver/HLSL/wconversion.hlsl b/clang/test/Driver/HLSL/wconversion.hlsl deleted file mode 100644 index 1857a3dfe386e..0000000000000 --- a/clang/test/Driver/HLSL/wconversion.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -// RUN: %clang_dxc -T lib_6_7 %s -### %s 2>&1 | FileCheck %s --check-prefixes=CONV -// RUN: %clang_dxc -T lib_6_7 -Wno-conversion %s -### %s 2>&1 | FileCheck %s --check-prefixes=NOCONV - -// make sure we generate -Wconversion by default -// CONV: "-Wconversion" -// make sure -Wno-conversion still works -// NOCONV: "-Wno-conversion" diff --git a/clang/test/ParserHLSL/group_shared_202x.hlsl b/clang/test/ParserHLSL/group_shared_202x.hlsl index bbbb5e75b9fe1..eea39128bf3a0 100644 --- a/clang/test/ParserHLSL/group_shared_202x.hlsl +++ b/clang/test/ParserHLSL/group_shared_202x.hlsl @@ -24,7 +24,7 @@ const float cf = f; // expected-error@#func{{'auto' return without trailing return type; deduced return types are a C++14 extension}} // expected-warning@#func{{'auto' type specifier is a HLSL 202y extension}} auto func() { // #func - return f; + return f; // expected-warning{{implicit conversion turns floating-point number into integer: 'float' to 'int'}} } void other() { diff --git a/clang/test/SemaHLSL/BuiltIns/select-errors.hlsl b/clang/test/SemaHLSL/BuiltIns/select-errors.hlsl index b2f45051a9bd8..3a95870317fc5 100644 --- a/clang/test/SemaHLSL/BuiltIns/select-errors.hlsl +++ b/clang/test/SemaHLSL/BuiltIns/select-errors.hlsl @@ -2,7 +2,7 @@ int test_select_first_arg_wrong_type(int1 p0, int t0, int f0) { - return select(p0, t0, f0); // No diagnostic expected. + return select(p0, t0, f0); // expected-warning{{implicit conversion turns vector to scalar: 'int1' (aka 'vector<int, 1>') to 'bool'}} } int1 test_select_bool_vals_ diff _vecs(bool p0, int1 t0, int1 f0) { @@ -15,7 +15,7 @@ int2 test_select_vector_vals_not_vecs(bool2 p0, int t0, } int1 test_select_vector_vals_wrong_size(bool2 p0, int1 t0, int1 f0) { - return select<int1>(p0, t0, f0); // No diagnostic expected. + return select<int1>(p0, t0, f0); // expected-warning{{implicit conversion turns vector to scalar: 'bool2' (aka 'vector<bool, 2>') to 'bool'}} } int test_select_no_args() { diff --git a/clang/test/SemaHLSL/Language/ImpCastAddrSpace.hlsl b/clang/test/SemaHLSL/Language/ImpCastAddrSpace.hlsl index 61e71b219b721..3336bdf731268 100644 --- a/clang/test/SemaHLSL/Language/ImpCastAddrSpace.hlsl +++ b/clang/test/SemaHLSL/Language/ImpCastAddrSpace.hlsl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -finclude-default-header -Wconversion -fnative-half-type %s -verify +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -finclude-default-header -fnative-half-type %s -verify static double D = 2.0; static int I = D; // expected-warning{{implicit conversion turns floating-point number into integer: 'double' to 'int'}} diff --git a/clang/test/SemaHLSL/Language/InitIncompleteArrays.hlsl b/clang/test/SemaHLSL/Language/InitIncompleteArrays.hlsl index 169c52b0033ac..98eba8e6d0699 100644 --- a/clang/test/SemaHLSL/Language/InitIncompleteArrays.hlsl +++ b/clang/test/SemaHLSL/Language/InitIncompleteArrays.hlsl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -finclude-default-header -verify -Wdouble-promotion -Wconversion %s +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -finclude-default-header -verify -Wdouble-promotion %s // Some helpers! template <typename T, typename U> diff --git a/clang/test/SemaHLSL/Language/InitLists.hlsl b/clang/test/SemaHLSL/Language/InitLists.hlsl index a02b6f9d5a767..c31c0fde33f30 100644 --- a/clang/test/SemaHLSL/Language/InitLists.hlsl +++ b/clang/test/SemaHLSL/Language/InitLists.hlsl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -finclude-default-header -verify -Wdouble-promotion -Wconversion %s +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -finclude-default-header -verify -Wdouble-promotion %s struct TwoFloats { float X, Y; diff --git a/clang/test/SemaHLSL/Language/OutputParameters.hlsl b/clang/test/SemaHLSL/Language/OutputParameters.hlsl index e4d370e4ba4a0..cbabc81ec9f01 100644 --- a/clang/test/SemaHLSL/Language/OutputParameters.hlsl +++ b/clang/test/SemaHLSL/Language/OutputParameters.hlsl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -finclude-default-header -verify -Wdouble-promotion -Wconversion %s +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -finclude-default-header -verify -Wdouble-promotion %s void OutVecFn(out float3) {} void InOutVecFn(inout float3) {} diff --git a/clang/test/SemaHLSL/Language/UsualArithmeticConversions.hlsl b/clang/test/SemaHLSL/Language/UsualArithmeticConversions.hlsl index 3c6710a50270c..ba3141582d689 100644 --- a/clang/test/SemaHLSL/Language/UsualArithmeticConversions.hlsl +++ b/clang/test/SemaHLSL/Language/UsualArithmeticConversions.hlsl @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -finclude-default-header -fnative-half-type %s -DERRORS -Wconversion -Wdouble-promotion -verify -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -std=hlsl2018 -finclude-default-header -fnative-half-type %s -DERRORS -Wconversion -Wdouble-promotion -verify +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -finclude-default-header -fnative-half-type %s -DERRORS -Wdouble-promotion -verify +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -std=hlsl2018 -finclude-default-header -fnative-half-type %s -DERRORS -Wdouble-promotion -verify // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -finclude-default-header -fnative-half-type %s -ast-dump | FileCheck %s #if __HLSL_VERSION <= 2021 diff --git a/clang/test/SemaHLSL/ScalarOverloadResolution.hlsl b/clang/test/SemaHLSL/ScalarOverloadResolution.hlsl index 77090b7fda257..507d779086750 100644 --- a/clang/test/SemaHLSL/ScalarOverloadResolution.hlsl +++ b/clang/test/SemaHLSL/ScalarOverloadResolution.hlsl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -fnative-half-type -finclude-default-header -Wconversion -verify -o - -DERROR=1 %s +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -fnative-half-type -finclude-default-header -verify -o - -DERROR=1 %s // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -fnative-half-type -finclude-default-header -ast-dump %s | FileCheck %s // This test verifies floating point type implicit conversion ranks for overload diff --git a/clang/test/SemaHLSL/SplatOverloadResolution.hlsl b/clang/test/SemaHLSL/SplatOverloadResolution.hlsl index f0798dfc72497..0d9fb043dab59 100644 --- a/clang/test/SemaHLSL/SplatOverloadResolution.hlsl +++ b/clang/test/SemaHLSL/SplatOverloadResolution.hlsl @@ -99,7 +99,7 @@ void Case3(float F) { // CHECK: CallExpr {{.*}} 'void' // CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(half)' <FunctionToPointerDecay> // CHECK-NEXT: DeclRefExpr {{.*}} 'void (half)' lvalue Function {{.*}} 'HalfV' 'void (half)' - HalfV(F); + HalfV(F); // expected-warning{{implicit conversion loses floating-point precision: 'float' to 'half'}} } #if ERROR @@ -147,7 +147,7 @@ void Case5(half3 H3, float3 F3, double3 D3, half4 H4, float4 F4, double4 D4) { // CHECK: CallExpr {{.*}} 'void' // CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(float2)' <FunctionToPointerDecay> // CHECK-NEXT: DeclRefExpr {{.*}} 'void (float2)' lvalue Function {{.*}} 'FloatV24' 'void (float2)' - FloatV24(D3); // expected-warning{{implicit conversion truncates vector: 'double3' (aka 'vector<double, 3>') to 'vector<float, 2>' (vector of 2 'float' values)}} + FloatV24(D3); // expected-warning{{implicit conversion truncates vector: 'double3' (aka 'vector<double, 3>') to 'vector<float, 2>' (vector of 2 'float' values)}} expected-warning{{implicit conversion loses floating-point precision: 'double3' (aka 'vector<double, 3>') to 'vector<float, 2>' (vector of 2 'float' values)}} // CHECK: CallExpr {{.*}} 'void' // CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(float4)' <FunctionToPointerDecay> @@ -162,5 +162,5 @@ void Case5(half3 H3, float3 F3, double3 D3, half4 H4, float4 F4, double4 D4) { // CHECK: CallExpr {{.*}} 'void' // CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(float4)' <FunctionToPointerDecay> // CHECK-NEXT: DeclRefExpr {{.*}} 'void (float4)' lvalue Function {{.*}} 'FloatV24' 'void (float4)' - FloatV24(D4); + FloatV24(D4); // expected-warning{{implicit conversion loses floating-point precision: 'double4' (aka 'vector<double, 4>') to 'vector<float, 4>' (vector of 4 'float' values)}} } diff --git a/clang/test/SemaHLSL/TruncationOverloadResolution.hlsl b/clang/test/SemaHLSL/TruncationOverloadResolution.hlsl index 0192c27860f14..f6f5c1f261ed9 100644 --- a/clang/test/SemaHLSL/TruncationOverloadResolution.hlsl +++ b/clang/test/SemaHLSL/TruncationOverloadResolution.hlsl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -fnative-half-type -finclude-default-header -fsyntax-only -Wconversion %s -DERROR=1 -verify +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -fnative-half-type -finclude-default-header -fsyntax-only %s -DERROR=1 -verify // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -fnative-half-type -finclude-default-header -ast-dump %s | FileCheck %s // Case 1: Prefer conversion over exact match truncation. diff --git a/clang/test/SemaHLSL/Types/Arithmetic/literal_suffixes.hlsl b/clang/test/SemaHLSL/Types/Arithmetic/literal_suffixes.hlsl index 91324e57ce69e..00a1856fd9c17 100644 --- a/clang/test/SemaHLSL/Types/Arithmetic/literal_suffixes.hlsl +++ b/clang/test/SemaHLSL/Types/Arithmetic/literal_suffixes.hlsl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.2-library -fnative-half-type -Wconversion -verify %s +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.2-library -fnative-half-type -verify %s void literal_assignments() { half h; diff --git a/clang/test/SemaHLSL/Types/Arithmetic/literal_suffixes_no_16bit.hlsl b/clang/test/SemaHLSL/Types/Arithmetic/literal_suffixes_no_16bit.hlsl index f7e3e6ba577d6..c378817cc0b3b 100644 --- a/clang/test/SemaHLSL/Types/Arithmetic/literal_suffixes_no_16bit.hlsl +++ b/clang/test/SemaHLSL/Types/Arithmetic/literal_suffixes_no_16bit.hlsl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.2-library -Wconversion -verify %s +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.2-library -verify %s void literal_assignments() { half h; diff --git a/clang/test/SemaHLSL/VectorElementOverloadResolution.hlsl b/clang/test/SemaHLSL/VectorElementOverloadResolution.hlsl index a980cbd252965..9ed33aa2d58b7 100644 --- a/clang/test/SemaHLSL/VectorElementOverloadResolution.hlsl +++ b/clang/test/SemaHLSL/VectorElementOverloadResolution.hlsl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -fnative-half-type -finclude-default-header -Wconversion -verify -o - %s -DERROR=1 +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -fnative-half-type -finclude-default-header -verify -o - %s -DERROR=1 // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -fnative-half-type -finclude-default-header -Wno-conversion -ast-dump %s | FileCheck %s // This test verifies floating point type implicit conversion ranks for overload diff --git a/clang/test/SemaHLSL/matrix-member-access-errors.hlsl b/clang/test/SemaHLSL/matrix-member-access-errors.hlsl index bba038651f210..b604823f8fd73 100644 --- a/clang/test/SemaHLSL/matrix-member-access-errors.hlsl +++ b/clang/test/SemaHLSL/matrix-member-access-errors.hlsl @@ -4,8 +4,8 @@ typedef vector<float, 5> float5; void foo() { float3x3 A; - float r = A._m00; // read is ok - float good1 = A._11; + float r = A._m00; // read is ok + float good1 = A._11; float good2 = A._33; float bad0 = A._m44; // expected-error {{matrix row element accessor is out of bounds of zero based indexing}} expected-error {{matrix column element accessor is out of bounds of zero based indexing}} diff --git a/clang/test/SemaHLSL/no-conversion-warnings.hlsl b/clang/test/SemaHLSL/no-conversion-warnings.hlsl new file mode 100644 index 0000000000000..abee35f9aa8dc --- /dev/null +++ b/clang/test/SemaHLSL/no-conversion-warnings.hlsl @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library -Wno-conversion -Wno-vector-conversion -Wno-matrix-conversion -verify %s + +// expected-no-diagnostics + +void test() { + // vector truncation + float3 F3 = 1.0; + float2 F2 = F2; + + // matrix truncation + int4x4 I4x4 = 1; + int3x3 I3x3 = I4x4; + + // matrix to scalar + float4x4 M4x4 = 2.0; + float F = M4x4; + + // floating-point precision loss + double4 D4 = F3.xyzx; + float2 F2_2 = D4; + + // float to int + int2 I2 = F2; + + // integer precision loss + vector<long, 4> I64_4 = D4; + int2 I2_2 = I64_4; +} diff --git a/clang/test/SemaHLSL/parameter_modifiers.hlsl b/clang/test/SemaHLSL/parameter_modifiers.hlsl index 68b3d5ac2de5e..bff1704741766 100644 --- a/clang/test/SemaHLSL/parameter_modifiers.hlsl +++ b/clang/test/SemaHLSL/parameter_modifiers.hlsl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.6-library %s -verify -Wconversion +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.6-library %s -verify void fn(in out float f); // #fn // expected-error@#fn2{{duplicate parameter modifier 'in'}} diff --git a/clang/test/SemaHLSL/standard_conversion_sequences.hlsl b/clang/test/SemaHLSL/standard_conversion_sequences.hlsl index 59779708d9137..48772cfd36335 100644 --- a/clang/test/SemaHLSL/standard_conversion_sequences.hlsl +++ b/clang/test/SemaHLSL/standard_conversion_sequences.hlsl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -Wconversion -verify -o - %s +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -verify -o - %s // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -Wno-conversion -DNO_ERR -ast-dump %s | FileCheck %s void test() { _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
