Skip to content

Commit dc943d3

Browse files
authored
Fixed int16_t type name in debug info (#3804)
1 parent bb8ea37 commit dc943d3

5 files changed

Lines changed: 63 additions & 4 deletions

File tree

tools/clang/lib/AST/Type.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2497,13 +2497,13 @@ StringRef BuiltinType::getName(const PrintingPolicy &Policy) const {
24972497
case Char_S: return "char";
24982498
case Char_U: return "char";
24992499
case SChar: return "signed char";
2500-
case Short: return "short";
2500+
case Short: return /* "short" */ "int16_t" /* HLSL Change */;
25012501
case Int: return "int";
25022502
case Long: return "long";
25032503
case LongLong: return "long long";
25042504
case Int128: return "__int128";
25052505
case UChar: return "unsigned char";
2506-
case UShort: return "unsigned short";
2506+
case UShort: return /* "unsigned short" */ "uint16_t" /* HLSL Change */;
25072507
case UInt: return "unsigned int";
25082508
case ULong: return "unsigned long";
25092509
case ULongLong: return "unsigned long long";

tools/clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,13 +526,15 @@ llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) {
526526
BTName = "long int";
527527
break;
528528
case BuiltinType::LongLong:
529-
BTName = "long long int";
529+
// BTName = "long long int"; // HLSL Change
530+
BTName = "int64_t"; // HLSL Change
530531
break;
531532
case BuiltinType::ULong:
532533
BTName = "long unsigned int";
533534
break;
534535
case BuiltinType::ULongLong:
535-
BTName = "long long unsigned int";
536+
// BTName = "long long unsigned int"; // HLSL Change
537+
BTName = "uint64_t"; // HLSL Change
536538
break;
537539
default:
538540
BTName = BT->getName(CGM.getLangOpts());
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// RUN: %dxc -T cs_6_5 -enable-16bit-types /Zi /O0 %s | FileCheck %s -check-prefix=SHORT
2+
// RUN: %dxc -T cs_6_5 -enable-16bit-types /Zi /O0 %s | FileCheck %s
3+
4+
// SHORT-NOT: !{{[0-9]+}} = !DIBasicType(name: "short"
5+
// SHORT-NOT: !{{[0-9]+}} = !DIBasicType(name: "unsigned short"
6+
7+
// CHECK-DAG: !{{[0-9]+}} = !DIBasicType(name: "uint16_t"
8+
// CHECK-DAG: !{{[0-9]+}} = !DIBasicType(name: "int16_t"
9+
10+
ByteAddressBuffer buf;
11+
RWByteAddressBuffer buf2;
12+
13+
[numthreads(64, 1, 1)]
14+
void main(int3 tid : SV_DispatchThreadId) {
15+
uint16_t3x3 mat = buf.Load<uint16_t3x3>(tid.x);
16+
uint16_t3 v = buf.Load<uint16_t3>(tid.y);
17+
uint16_t3 w = mul(mat, v);
18+
int16_t3 ret = int16_t3(w.x, w.y, w.z);
19+
buf2.Store<int16_t3>(tid.z, ret);
20+
}
21+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// RUN: %dxc -T cs_6_0 /Zi /O0 %s | FileCheck %s -check-prefix=OLD_TYPE
2+
// RUN: %dxc -T cs_6_0 /Zi /O0 %s | FileCheck %s
3+
4+
// OLD_TYPE-NOT: !{{[0-9]+}} = !DIBasicType({{.+}}long
5+
6+
// CHECK-DAG: !{{[0-9]+}} = !DIDerivedType(tag: DW_TAG_typedef, name: "uint"
7+
// CHECK-DAG: !{{[0-9]+}} = !DIBasicType(name: "int"
8+
9+
ByteAddressBuffer buf;
10+
RWByteAddressBuffer buf2;
11+
12+
[numthreads(64, 1, 1)]
13+
void main(int3 tid : SV_DispatchThreadId) {
14+
uint v = buf.Load<uint>(tid.y) * 2;
15+
int w = (int)v / 2;
16+
buf2.Store<int>(tid.z, w);
17+
}
18+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// RUN: %dxc -T cs_6_0 /Zi /O0 %s | FileCheck %s -check-prefix=OLD_TYPE
2+
// RUN: %dxc -T cs_6_0 /Zi /O0 %s | FileCheck %s
3+
4+
// OLD_TYPE-NOT: !{{[0-9]+}} = !DIBasicType({{.+}}long long
5+
6+
// CHECK-DAG: !{{[0-9]+}} = !DIBasicType(name: "uint64_t"
7+
// CHECK-DAG: !{{[0-9]+}} = !DIBasicType(name: "int64_t"
8+
9+
ByteAddressBuffer buf;
10+
RWByteAddressBuffer buf2;
11+
12+
[numthreads(64, 1, 1)]
13+
void main(int3 tid : SV_DispatchThreadId) {
14+
uint64_t v = buf.Load<uint64_t>(tid.y) * 2;
15+
int64_t w = (int64_t)v / 3;
16+
buf2.Store<int64_t>(tid.z, w);
17+
}
18+

0 commit comments

Comments
 (0)