Skip to content

Commit 767b15f

Browse files
authored
[HLSL] Change clang Driver Options to not set CXXOperatorNames (#126758)
- Disable `CXXOperatorNames` for HLSL - Add tests to confirm we can use the alt names as functions
1 parent cbe879d commit 767b15f

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3397,7 +3397,7 @@ def fno_objc_weak : Flag<["-"], "fno-objc-weak">, Group<f_Group>,
33973397
def fno_omit_frame_pointer : Flag<["-"], "fno-omit-frame-pointer">, Group<f_Group>,
33983398
Visibility<[ClangOption, FlangOption]>;
33993399
defm operator_names : BoolFOption<"operator-names",
3400-
LangOpts<"CXXOperatorNames">, Default<cplusplus.KeyPath>,
3400+
LangOpts<"CXXOperatorNames">, Default<!strconcat(cplusplus.KeyPath, " && !",hlsl.KeyPath)>,
34013401
NegFlag<SetFalse, [], [ClangOption, CC1Option],
34023402
"Do not treat C++ operator name keywords as synonyms for operators">,
34033403
PosFlag<SetTrue>>;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library %s -ast-dump | FileCheck %s
2+
3+
// CHECK: -FunctionDecl {{.*}} and 'void ()'
4+
void and() {}
5+
6+
// CHECK: -FunctionDecl {{.*}} and_eq 'void ()'
7+
void and_eq() {}
8+
9+
// CHECK: -FunctionDecl {{.*}} bitand 'void ()'
10+
void bitand() {}
11+
12+
// CHECK: -FunctionDecl {{.*}} bitor 'void ()'
13+
void bitor() {}
14+
15+
// CHECK: -FunctionDecl {{.*}} compl 'void ()'
16+
void compl() {}
17+
18+
// CHECK: -FunctionDecl {{.*}} not 'void ()'
19+
void not() {}
20+
21+
// CHECK: -FunctionDecl {{.*}} not_eq 'void ()'
22+
void not_eq() {}
23+
24+
// CHECK: -FunctionDecl {{.*}} or 'void ()'
25+
void or() {}
26+
27+
// CHECK: -FunctionDecl {{.*}} or_eq 'void ()'
28+
void or_eq() {}
29+
30+
// CHECK: -FunctionDecl {{.*}} xor 'void ()'
31+
void xor() {}
32+
33+
// CHECK: -FunctionDecl {{.*}} xor_eq 'void ()'
34+
void xor_eq() {}

0 commit comments

Comments
 (0)