Skip to content

Commit a5d8ad5

Browse files
committed
update mangling
Signed-off-by: Justin Stitt <[email protected]>
1 parent 4503ee5 commit a5d8ad5

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

clang/lib/AST/ItaniumMangle.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4641,7 +4641,13 @@ void CXXNameMangler::mangleType(const PipeType *T) {
46414641
}
46424642

46434643
void CXXNameMangler::mangleType(const OverflowBehaviorType *T) {
4644-
Out << "U9Obt_";
4644+
// Vender-extended type mangling for OverflowBehaviorType
4645+
// <type> ::= U <behavior> <underlying_type>
4646+
if (T->isWrapKind()) {
4647+
Out << "U11ObtWrap_";
4648+
} else {
4649+
Out << "U13ObtNoWrap_";
4650+
}
46454651
mangleType(T->getUnderlyingType());
46464652
}
46474653

clang/test/CodeGen/overflow-behavior-types-promotions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ typedef int __nowrap nowrap_int;
1010
typedef unsigned int __wrap u_wrap_int;
1111
typedef unsigned int __nowrap u_nowrap_int;
1212

13-
// CHECK-LABEL: define {{.*}} @_Z30conditional_operator_promotionbU9Obt_cU9Obt_ii
13+
// CHECK-LABEL: define {{.*}} @_Z30conditional_operator_promotionbU11ObtWrap_cU13ObtNoWrap_ii
1414
void conditional_operator_promotion(bool cond, wrap_char w, nowrap_int nw, int i) {
1515
// OBT wins over regular integer.
1616
// CHECK: cond.end:
@@ -31,7 +31,7 @@ void conditional_operator_promotion(bool cond, wrap_char w, nowrap_int nw, int i
3131
(void)(r2 + 2147483647);
3232
}
3333

34-
// CHECK-LABEL: define {{.*}} @_Z20promotion_rules_testU9Obt_iU9Obt_iU9Obt_jU9Obt_j
34+
// CHECK-LABEL: define {{.*}} @_Z20promotion_rules_testU11ObtWrap_iU13ObtNoWrap_iU11ObtWrap_jU13ObtNoWrap_j
3535
void promotion_rules_test(wrap_int sw, nowrap_int snw, u_wrap_int uw, u_nowrap_int unw) {
3636
// Unsigned is favored over signed for same-behavior OBTs.
3737
// CHECK: add i32

clang/test/CodeGen/overflow-behavior-types.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void test_members(char some) {
4949
(void)(foo.getA() + 1);
5050
}
5151

52-
// DEFAULT-LABEL: define {{.*}} @_Z9test_autoU9Obt_c
52+
// DEFAULT-LABEL: define {{.*}} @_Z9test_autoU11ObtWrap_c
5353
void test_auto(char __wrap a) {
5454
auto b = a;
5555

0 commit comments

Comments
 (0)