llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Farzon Lotfi (farzonl) <details> <summary>Changes</summary> - Disable `CXXOperatorNames` for HLSL - Add tests to confirm we can use the alt names as functions --- Full diff: https://github.com/llvm/llvm-project/pull/126758.diff 2 Files Affected: - (modified) clang/include/clang/Driver/Options.td (+1-1) - (added) clang/test/CodeGenHLSL/use-cxx-alt-operator-names.hlsl (+41) ``````````diff diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 1cf62ab46613456..618815db2843404 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 000000000000000..8ae253a9f3c06cb --- /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() {} `````````` </details> https://github.com/llvm/llvm-project/pull/126758 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits