[all-commits] [llvm/llvm-project] e298fc: Add DISubrangeType (#126772)

Tom Tromey via All-commits all-commits at lists.llvm.org
Mon Feb 24 10:12:17 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e298fc2da97120a30ee2f120ac184ab209fc1eb4
      https://github.com/llvm/llvm-project/commit/e298fc2da97120a30ee2f120ac184ab209fc1eb4
  Author: Tom Tromey <tromey at adacore.com>
  Date:   2025-02-24 (Mon, 24 Feb 2025)

  Changed paths:
    M llvm/include/llvm-c/DebugInfo.h
    M llvm/include/llvm/Bitcode/LLVMBitCodes.h
    M llvm/include/llvm/IR/DIBuilder.h
    M llvm/include/llvm/IR/DebugInfoMetadata.h
    M llvm/include/llvm/IR/Metadata.def
    M llvm/lib/AsmParser/LLParser.cpp
    M llvm/lib/Bitcode/Reader/MetadataLoader.cpp
    M llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
    M llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
    M llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
    M llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
    M llvm/lib/IR/AsmWriter.cpp
    M llvm/lib/IR/DIBuilder.cpp
    M llvm/lib/IR/DebugInfoMetadata.cpp
    M llvm/lib/IR/LLVMContextImpl.h
    M llvm/lib/IR/Verifier.cpp
    A llvm/test/Bitcode/subrange_type.ll
    M llvm/unittests/IR/MetadataTest.cpp

  Log Message:
  -----------
  Add DISubrangeType (#126772)

An Ada program can have types that are subranges of other types. This
patch adds a new DIType node, DISubrangeType, to represent this concept.
    
I considered extending the existing DISubrange to do this, but as
DISubrange does not derive from DIType, that approach seemed more
disruptive.
    
A DISubrangeType can be used both as an ordinary type, but also as the
type of an array index. This is also important for Ada.

Ada subrange types can also be stored using a bias. Representing this in
the DWARF required the use of an extension. GCC has been emitting this
extension for years, so I've reused it here.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list