Skip to content

[HLSL] Change clang Driver Options to not set CXXOperatorNames #126758

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -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>>;
Expand Down
34 changes: 34 additions & 0 deletions clang/test/SemaHLSL/use-cxx-alt-operator-names.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library %s -ast-dump | FileCheck %s

// CHECK: -FunctionDecl {{.*}} and 'void ()'
void and() {}

// CHECK: -FunctionDecl {{.*}} and_eq 'void ()'
void and_eq() {}

// CHECK: -FunctionDecl {{.*}} bitand 'void ()'
void bitand() {}

// CHECK: -FunctionDecl {{.*}} bitor 'void ()'
void bitor() {}

// CHECK: -FunctionDecl {{.*}} compl 'void ()'
void compl() {}

// CHECK: -FunctionDecl {{.*}} not 'void ()'
void not() {}

// CHECK: -FunctionDecl {{.*}} not_eq 'void ()'
void not_eq() {}

// CHECK: -FunctionDecl {{.*}} or 'void ()'
void or() {}

// CHECK: -FunctionDecl {{.*}} or_eq 'void ()'
void or_eq() {}

// CHECK: -FunctionDecl {{.*}} xor 'void ()'
void xor() {}

// CHECK: -FunctionDecl {{.*}} xor_eq 'void ()'
void xor_eq() {}