diff --git a/lld/test/COFF/pdb_char8_t.ll b/lld/test/COFF/pdb_char8_t.ll new file mode 100644 --- /dev/null +++ b/lld/test/COFF/pdb_char8_t.ll @@ -0,0 +1,45 @@ +; RUN: llc -mtriple x86_64-windows-msvc -filetype obj -o %t.obj %s +; RUN: lld-link /nodefaultlib /noentry /dll /debug /out:%t.exe /pdb:%t.pdb %t.obj +; RUN: llvm-pdbutil dump -type-index=0x7c %t.pdb + +; CHECK: 0x007C (char8_t) | char8_t + +define dso_local i32 @main() #0 !dbg !9 { + %1 = alloca i32, align 4 + %2 = alloca i8, align 1 + store i32 0, i32* %1, align 4 + call void @llvm.dbg.declare(metadata i8* %2, metadata !13, metadata !DIExpression()), !dbg !15 + store i8 0, i8* %2, align 1, !dbg !15 + %3 = load i8, i8* %2, align 1, !dbg !16 + %4 = zext i8 %3 to i32, !dbg !16 + ret i32 %4, !dbg !16 +} + +; Function Attrs: nofree nosync nounwind readnone speculatable willreturn +declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 + +attributes #0 = { mustprogress noinline norecurse nounwind optnone uwtable "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +attributes #1 = { nofree nosync nounwind readnone speculatable willreturn } + +!llvm.dbg.cu = !{!0} +!llvm.linker.options = !{} +!llvm.module.flags = !{!3, !4, !5, !6, !7} +!llvm.ident = !{!8} + +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 13.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None) +!1 = !DIFile(filename: "pdb_char8_t.cpp", directory: "C:\\src", checksumkind: CSK_MD5, checksum: "a00748d29f4e59003184945cd3e17ee3") +!2 = !{} +!3 = !{i32 2, !"CodeView", i32 1} +!4 = !{i32 2, !"Debug Info Version", i32 3} +!5 = !{i32 1, !"wchar_size", i32 2} +!6 = !{i32 7, !"PIC Level", i32 2} +!7 = !{i32 7, !"uwtable", i32 1} +!8 = !{!"clang version 13.0.0"} +!9 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 1, type: !10, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2) +!10 = !DISubroutineType(types: !11) +!11 = !{!12} +!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!13 = !DILocalVariable(name: "local", scope: !9, file: !1, line: 3, type: !14) +!14 = !DIBasicType(name: "char8_t", size: 8, encoding: DW_ATE_UTF) +!15 = !DILocation(line: 3, scope: !9) +!16 = !DILocation(line: 4, scope: !9) diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -749,6 +749,7 @@ eBasicTypeUnsignedWChar, eBasicTypeChar16, eBasicTypeChar32, + eBasicTypeChar8, eBasicTypeShort, eBasicTypeUnsignedShort, eBasicTypeInt, diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp --- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp @@ -704,6 +704,8 @@ return lldb::eBasicTypeChar16; case SimpleTypeKind::Character32: return lldb::eBasicTypeChar32; + case SimpleTypeKind::Character8: + return lldb::eBasicTypeChar8; case SimpleTypeKind::Complex80: return lldb::eBasicTypeLongDoubleComplex; case SimpleTypeKind::Complex64: @@ -796,6 +798,7 @@ case SimpleTypeKind::NarrowCharacter: case SimpleTypeKind::SignedCharacter: case SimpleTypeKind::SByte: + case SimpleTypeKind::Character8: return 1; case SimpleTypeKind::Void: default: diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp --- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp @@ -173,6 +173,8 @@ return "char16_t"; case SimpleTypeKind::Character32: return "char32_t"; + case SimpleTypeKind::Character8: + return "char8_t"; case SimpleTypeKind::Complex80: case SimpleTypeKind::Complex64: case SimpleTypeKind::Complex32: diff --git a/llvm/docs/PDB/TpiStream.rst b/llvm/docs/PDB/TpiStream.rst --- a/llvm/docs/PDB/TpiStream.rst +++ b/llvm/docs/PDB/TpiStream.rst @@ -131,6 +131,7 @@ WideCharacter = 0x0071, // wide char Character16 = 0x007a, // char16_t Character32 = 0x007b, // char32_t + Character8 = 0x007c, // char8_t SByte = 0x0068, // 8 bit signed int Byte = 0x0069, // 8 bit unsigned int diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeIndex.h b/llvm/include/llvm/DebugInfo/CodeView/TypeIndex.h --- a/llvm/include/llvm/DebugInfo/CodeView/TypeIndex.h +++ b/llvm/include/llvm/DebugInfo/CodeView/TypeIndex.h @@ -35,6 +35,7 @@ WideCharacter = 0x0071, // wide char Character16 = 0x007a, // char16_t Character32 = 0x007b, // char32_t + Character8 = 0x007c, // char8_t SByte = 0x0068, // 8 bit signed int Byte = 0x0069, // 8 bit unsigned int diff --git a/llvm/include/llvm/DebugInfo/PDB/PDBTypes.h b/llvm/include/llvm/DebugInfo/PDB/PDBTypes.h --- a/llvm/include/llvm/DebugInfo/PDB/PDBTypes.h +++ b/llvm/include/llvm/DebugInfo/PDB/PDBTypes.h @@ -352,7 +352,8 @@ BSTR = 30, HResult = 31, Char16 = 32, - Char32 = 33 + Char32 = 33, + Char8 = 34, }; /// These values correspond to the flags that can be combined to control the diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -1826,6 +1826,7 @@ break; case dwarf::DW_ATE_UTF: switch (ByteSize) { + case 1: STK = SimpleTypeKind::Character8; break; case 2: STK = SimpleTypeKind::Character16; break; case 4: STK = SimpleTypeKind::Character32; break; } diff --git a/llvm/lib/DebugInfo/CodeView/TypeIndex.cpp b/llvm/lib/DebugInfo/CodeView/TypeIndex.cpp --- a/llvm/lib/DebugInfo/CodeView/TypeIndex.cpp +++ b/llvm/lib/DebugInfo/CodeView/TypeIndex.cpp @@ -33,6 +33,7 @@ {"wchar_t*", SimpleTypeKind::WideCharacter}, {"char16_t*", SimpleTypeKind::Character16}, {"char32_t*", SimpleTypeKind::Character32}, + {"char8_t*", SimpleTypeKind::Character8}, {"__int8*", SimpleTypeKind::SByte}, {"unsigned __int8*", SimpleTypeKind::Byte}, {"short*", SimpleTypeKind::Int16Short}, diff --git a/llvm/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp b/llvm/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp --- a/llvm/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp @@ -205,6 +205,8 @@ return PDB_BuiltinType::Char16; case SimpleTypeKind::Character32: return PDB_BuiltinType::Char32; + case SimpleTypeKind::Character8: + return PDB_BuiltinType::Char8; case SimpleTypeKind::Int128: case SimpleTypeKind::Int128Oct: case SimpleTypeKind::Int16: diff --git a/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp b/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp --- a/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp @@ -67,6 +67,7 @@ {codeview::SimpleTypeKind::WideCharacter, PDB_BuiltinType::WCharT, 2}, {codeview::SimpleTypeKind::Character16, PDB_BuiltinType::Char16, 2}, {codeview::SimpleTypeKind::Character32, PDB_BuiltinType::Char32, 4}, + {codeview::SimpleTypeKind::Character8, PDB_BuiltinType::Char8, 1}, {codeview::SimpleTypeKind::SignedCharacter, PDB_BuiltinType::Char, 1}, {codeview::SimpleTypeKind::UnsignedCharacter, PDB_BuiltinType::UInt, 1}, {codeview::SimpleTypeKind::Float32, PDB_BuiltinType::Float, 4}, diff --git a/llvm/lib/DebugInfo/PDB/PDBExtras.cpp b/llvm/lib/DebugInfo/PDB/PDBExtras.cpp --- a/llvm/lib/DebugInfo/PDB/PDBExtras.cpp +++ b/llvm/lib/DebugInfo/PDB/PDBExtras.cpp @@ -63,6 +63,7 @@ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, HResult, OS) CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, Char16, OS) CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, Char32, OS) + CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, Char8, OS) } return OS; } diff --git a/llvm/tools/llvm-pdbutil/PrettyBuiltinDumper.cpp b/llvm/tools/llvm-pdbutil/PrettyBuiltinDumper.cpp --- a/llvm/tools/llvm-pdbutil/PrettyBuiltinDumper.cpp +++ b/llvm/tools/llvm-pdbutil/PrettyBuiltinDumper.cpp @@ -90,6 +90,8 @@ return "char16_t"; case PDB_BuiltinType::Char32: return "char32_t"; + case PDB_BuiltinType::Char8: + return "char8_t"; case PDB_BuiltinType::None: return "..."; }