https://github.com/farzonl updated https://github.com/llvm/llvm-project/pull/126758
>From 3b7e458bfeb2abab799789d30ebaa4b214e4168e Mon Sep 17 00:00:00 2001 From: Farzon Lotfi <farzonlo...@microsoft.com> Date: Tue, 11 Feb 2025 11:07:23 -0500 Subject: [PATCH 1/3] [HLSL] Change clang Driver Options to not set CXXOperatorNames --- clang/include/clang/Driver/Options.td | 2 +- .../use-cxx-alt-operator-names.hlsl | 41 +++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 clang/test/CodeGenHLSL/use-cxx-alt-operator-names.hlsl diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 1cf62ab466134..618815db28434 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -3397,7 +3397,7 @@ def fno_objc_weak : Flag<["-"], "fno-objc-weak">, Group<f_Group>, def fno_omit_frame_pointer : Flag<["-"], "fno-omit-frame-pointer">, Group<f_Group>, Visibility<[ClangOption, FlangOption]>; defm operator_names : BoolFOption<"operator-names", - LangOpts<"CXXOperatorNames">, Default<cplusplus.KeyPath>, + LangOpts<"CXXOperatorNames">, Default<!strconcat(cplusplus.KeyPath, " && !",hlsl.KeyPath)>, NegFlag<SetFalse, [], [ClangOption, CC1Option], "Do not treat C++ operator name keywords as synonyms for operators">, PosFlag<SetTrue>>; diff --git a/clang/test/CodeGenHLSL/use-cxx-alt-operator-names.hlsl b/clang/test/CodeGenHLSL/use-cxx-alt-operator-names.hlsl new file mode 100644 index 0000000000000..8ae253a9f3c06 --- /dev/null +++ b/clang/test/CodeGenHLSL/use-cxx-alt-operator-names.hlsl @@ -0,0 +1,41 @@ + +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s \ +// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s + +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ +// RUN: spirv-unknown-vulkan-compute %s \ +// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s + +// CHECK-LABEL: and +void and() {} + +// CHECK-LABEL: and_eq +void and_eq() {} + +// CHECK-LABEL: bitand +void bitand() {} + +// CHECK-LABEL: bitor +void bitor() {} + +// CHECK-LABEL: compl +void compl() {} + +// CHECK-LABEL: not +void not() {} + +// CHECK-LABEL: not_eq +void not_eq() {} + +// CHECK-LABEL: or +void or() {} + +// CHECK-LABEL: or_eq +void or_eq() {} + +// CHECK-LABEL: xor +void xor() {} + +// CHECK-LABEL: xor_eq +void xor_eq() {} >From 68b78917adceda57e83e7ebfc68053ed30698635 Mon Sep 17 00:00:00 2001 From: Farzon Lotfi <farzonlo...@microsoft.com> Date: Tue, 11 Feb 2025 11:27:10 -0500 Subject: [PATCH 2/3] address pr feedback --- .../use-cxx-alt-operator-names.hlsl | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) rename clang/test/{CodeGenHLSL => SemaHLSL}/use-cxx-alt-operator-names.hlsl (55%) diff --git a/clang/test/CodeGenHLSL/use-cxx-alt-operator-names.hlsl b/clang/test/SemaHLSL/use-cxx-alt-operator-names.hlsl similarity index 55% rename from clang/test/CodeGenHLSL/use-cxx-alt-operator-names.hlsl rename to clang/test/SemaHLSL/use-cxx-alt-operator-names.hlsl index 8ae253a9f3c06..2ee7ae2a1b1fe 100644 --- a/clang/test/CodeGenHLSL/use-cxx-alt-operator-names.hlsl +++ b/clang/test/SemaHLSL/use-cxx-alt-operator-names.hlsl @@ -1,11 +1,4 @@ - -// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ -// RUN: dxil-pc-shadermodel6.3-library %s \ -// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s - -// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ -// RUN: spirv-unknown-vulkan-compute %s \ -// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library %s -ast-dump | FileCheck %s // CHECK-LABEL: and void and() {} >From 711cad3361365ed2ce0cd157879f22c73c11e13d Mon Sep 17 00:00:00 2001 From: Farzon Lotfi <farzonlo...@microsoft.com> Date: Tue, 11 Feb 2025 14:28:22 -0500 Subject: [PATCH 3/3] switch from checking name to checking for FunctionDecl --- .../SemaHLSL/use-cxx-alt-operator-names.hlsl | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/clang/test/SemaHLSL/use-cxx-alt-operator-names.hlsl b/clang/test/SemaHLSL/use-cxx-alt-operator-names.hlsl index 2ee7ae2a1b1fe..e93be2bbf4e69 100644 --- a/clang/test/SemaHLSL/use-cxx-alt-operator-names.hlsl +++ b/clang/test/SemaHLSL/use-cxx-alt-operator-names.hlsl @@ -1,34 +1,34 @@ // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library %s -ast-dump | FileCheck %s -// CHECK-LABEL: and +// CHECK: -FunctionDecl {{.*}} and 'void ()' void and() {} -// CHECK-LABEL: and_eq +// CHECK: -FunctionDecl {{.*}} and_eq 'void ()' void and_eq() {} -// CHECK-LABEL: bitand +// CHECK: -FunctionDecl {{.*}} bitand 'void ()' void bitand() {} -// CHECK-LABEL: bitor +// CHECK: -FunctionDecl {{.*}} bitor 'void ()' void bitor() {} -// CHECK-LABEL: compl +// CHECK: -FunctionDecl {{.*}} compl 'void ()' void compl() {} -// CHECK-LABEL: not +// CHECK: -FunctionDecl {{.*}} not 'void ()' void not() {} -// CHECK-LABEL: not_eq +// CHECK: -FunctionDecl {{.*}} not_eq 'void ()' void not_eq() {} -// CHECK-LABEL: or +// CHECK: -FunctionDecl {{.*}} or 'void ()' void or() {} -// CHECK-LABEL: or_eq +// CHECK: -FunctionDecl {{.*}} or_eq 'void ()' void or_eq() {} -// CHECK-LABEL: xor +// CHECK: -FunctionDecl {{.*}} xor 'void ()' void xor() {} -// CHECK-LABEL: xor_eq +// CHECK: -FunctionDecl {{.*}} xor_eq 'void ()' void xor_eq() {} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits