Index: llvm/docs/LangRef.rst =================================================================== --- llvm/docs/LangRef.rst +++ llvm/docs/LangRef.rst @@ -5323,6 +5323,7 @@ DW_TAG_volatile_type = 53 DW_TAG_restrict_type = 55 DW_TAG_atomic_type = 71 + DW_TAG_immutable_type = 75 .. _DIDerivedTypeMember: @@ -5339,8 +5340,8 @@ ``DW_TAG_typedef`` is used to provide a name for the ``baseType:``. ``DW_TAG_pointer_type``, ``DW_TAG_reference_type``, ``DW_TAG_const_type``, -``DW_TAG_volatile_type``, ``DW_TAG_restrict_type`` and ``DW_TAG_atomic_type`` -are used to qualify the ``baseType:``. +``DW_TAG_volatile_type``, ``DW_TAG_restrict_type``, ``DW_TAG_atomic_type`` and +``DW_TAG_immutable_type`` are used to qualify the ``baseType:``. Note that the ``void *`` type is expressed as a type derived from NULL. Index: llvm/docs/SourceLevelDebugging.rst =================================================================== --- llvm/docs/SourceLevelDebugging.rst +++ llvm/docs/SourceLevelDebugging.rst @@ -1881,6 +1881,7 @@ * DW_TAG_subrange_type * DW_TAG_base_type * DW_TAG_const_type +* DW_TAG_immutable_type * DW_TAG_file_type * DW_TAG_namelist * DW_TAG_packed_type Index: llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp =================================================================== --- llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp +++ llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp @@ -155,7 +155,8 @@ if (Tag != dwarf::DW_TAG_member && Tag != dwarf::DW_TAG_typedef && Tag != dwarf::DW_TAG_const_type && Tag != dwarf::DW_TAG_volatile_type && - Tag != dwarf::DW_TAG_restrict_type && Tag != dwarf::DW_TAG_atomic_type) + Tag != dwarf::DW_TAG_restrict_type && Tag != dwarf::DW_TAG_atomic_type && + Tag != dwarf::DW_TAG_immutable_type) return DDTy->getSizeInBits(); DIType *BaseType = DDTy->getBaseType(); @@ -210,7 +211,8 @@ return true; assert(T == dwarf::DW_TAG_typedef || T == dwarf::DW_TAG_const_type || T == dwarf::DW_TAG_volatile_type || - T == dwarf::DW_TAG_restrict_type || T == dwarf::DW_TAG_atomic_type); + T == dwarf::DW_TAG_restrict_type || T == dwarf::DW_TAG_atomic_type || + T == dwarf::DW_TAG_immutable_type); assert(DTy->getBaseType() && "Expected valid base type"); return isUnsignedDIType(DTy->getBaseType()); } Index: llvm/lib/DWARFLinker/DWARFLinker.cpp =================================================================== --- llvm/lib/DWARFLinker/DWARFLinker.cpp +++ llvm/lib/DWARFLinker/DWARFLinker.cpp @@ -124,6 +124,7 @@ case dwarf::DW_TAG_interface_type: case dwarf::DW_TAG_unspecified_type: case dwarf::DW_TAG_shared_type: + case dwarf::DW_TAG_immutable_type: return true; default: break; Index: llvm/lib/DebugInfo/DWARF/DWARFContext.cpp =================================================================== --- llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +++ llvm/lib/DebugInfo/DWARF/DWARFContext.cpp @@ -1098,6 +1098,7 @@ return PointerSize; } case DW_TAG_const_type: + case DW_TAG_immutable_type: case DW_TAG_volatile_type: case DW_TAG_restrict_type: case DW_TAG_typedef: { Index: llvm/lib/IR/Verifier.cpp =================================================================== --- llvm/lib/IR/Verifier.cpp +++ llvm/lib/IR/Verifier.cpp @@ -1058,6 +1058,7 @@ N.getTag() == dwarf::DW_TAG_reference_type || N.getTag() == dwarf::DW_TAG_rvalue_reference_type || N.getTag() == dwarf::DW_TAG_const_type || + N.getTag() == dwarf::DW_TAG_immutable_type || N.getTag() == dwarf::DW_TAG_volatile_type || N.getTag() == dwarf::DW_TAG_restrict_type || N.getTag() == dwarf::DW_TAG_atomic_type || Index: llvm/test/DebugInfo/dwarfdump-immutable.ll =================================================================== --- /dev/null +++ llvm/test/DebugInfo/dwarfdump-immutable.ll @@ -0,0 +1,36 @@ +;; This test checks whether DWARF tag DW_TAG_immutable_type +;; is accepted and processed. +; REQUIRES: x86_64-linux + +; RUN: llc -mtriple=x86_64-pc-linux-gnu %s -filetype=obj -o - | llvm-dwarfdump - | FileCheck %s + +;; Test whether DW_TAG_immutable_type is accepted. + +; CHECK-LABEL: DW_TAG_immutable_type + +; ModuleID = 'immutable.d' +source_filename = "immutable.d" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-pc-linux-gnu" + +@_D9immutable1aya = constant i8 97, align 1, !dbg !0 ; [#uses = 0] + +!llvm.module.flags = !{!5} +!llvm.dbg.cu = !{!6} +!llvm.ident = !{!13} + +!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) +!1 = distinct !DIGlobalVariable(name: "a", linkageName: "_D9immutable1aya", scope: !2, file: !3, line: 1, type: !4, isLocal: false, isDefinition: true) +!2 = !DIModule(scope: !3, name: "immutable") +!3 = !DIFile(filename: "immutable.d", directory: "/home/luis/Temp") +!4 = !DIDerivedType(tag: DW_TAG_immutable_type, baseType: !14) +!5 = !{i32 2, !"Debug Info Version", i32 3} +!6 = distinct !DICompileUnit(language: DW_LANG_D, file: !3, producer: "LDC 1.28.0 (LLVM 13.0.0)", isOptimized: false, runtimeVersion: 1, emissionKind: FullDebug, enums: !7, globals: !8, imports: !9) +!7 = !{} +!8 = !{!0} +!9 = !{!10} +!10 = !DIImportedEntity(tag: DW_TAG_imported_module, scope: !2, entity: !11, file: !3) +!11 = !DIModule(scope: !12, name: "object") +!12 = !DIFile(filename: "usr/include/dlang/ldc/object.d", directory: "/") +!13 = !{!"ldc version 1.28.0"} +!14 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_UTF)