Skip to content

Commit c5eaf83

Browse files
jrtc27resistor
authored andcommitted
[AST][Sema] Support unsigned __intcap in getCorrespondingSignedType
This is used by the new __make_signed(T) builtin. Note (signed) __intcap is already handled by getCorrespondingUnsignedSignedType from many years ago. Fixes: 1a54ef1 ("[clang] adds unary type transformations as compiler built-ins")
1 parent 8f611d6 commit c5eaf83

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

clang/lib/AST/ASTContext.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12457,6 +12457,8 @@ QualType ASTContext::getCorrespondingSignedType(QualType T) const {
1245712457
return LongTy;
1245812458
case BuiltinType::ULongLong:
1245912459
return LongLongTy;
12460+
case BuiltinType::UIntCap:
12461+
return IntCapTy;
1246012462
case BuiltinType::UInt128:
1246112463
return Int128Ty;
1246212464
// wchar_t is special. It is either unsigned or not, but when it's unsigned,
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %cheri_cc1 -fsyntax-only -verify %s
2+
3+
// expected-no-diagnostics
4+
5+
_Static_assert(__is_same(__make_signed(__intcap), __intcap), "");
6+
_Static_assert(__is_same(__make_signed(signed __intcap), __intcap), "");
7+
_Static_assert(__is_same(__make_signed(unsigned __intcap), __intcap), "");
8+
9+
_Static_assert(__is_same(__make_unsigned(__intcap), unsigned __intcap), "");
10+
_Static_assert(__is_same(__make_unsigned(signed __intcap), unsigned __intcap), "");
11+
_Static_assert(__is_same(__make_unsigned(unsigned __intcap), unsigned __intcap), "");

0 commit comments

Comments
 (0)