[DebugInfo] Add stringLocationExp field to DIStringType
authorChih-Ping Chen <chih-ping.chen@intel.com>
Tue, 18 Jan 2022 19:54:01 +0000 (14:54 -0500)
committerchih-ping.chen <cchen15@hds-clx-7.nh.intel.com>
Wed, 26 Jan 2022 16:56:57 +0000 (11:56 -0500)
commit28bfa57a7315c3161124c90b4d52f467616dc92e
tree82cdf9337a2176b7ad35ad831f9819abee0f73c4
parentaa418b91332ca9ea0686ae53ef916456dffcc31c
[DebugInfo] Add stringLocationExp field to DIStringType

DIStringType is used to encode the debug info of a character object
in Fortran. A Fortran deferred-length character object is typically
implemented as a pair of the following two pieces of info: An address
of the raw storage of the characters, and the length of the object.
The stringLocationExp field contains the DIExpression to get to the
raw storage.

This patch also enables the emission of DW_AT_data_location attribute
in a DW_TAG_string_type debug info entry based on stringLocationExp
in DIStringType.

A test is also added to ensure that the bitcode reader is backward
compatible with the old DIStringType format.

Differential Revision: https://reviews.llvm.org/D117586
12 files changed:
llvm/include/llvm/IR/DebugInfoMetadata.h
llvm/lib/AsmParser/LLParser.cpp
llvm/lib/Bitcode/Reader/MetadataLoader.cpp
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
llvm/lib/IR/AsmWriter.cpp
llvm/lib/IR/DebugInfoMetadata.cpp
llvm/lib/IR/LLVMContextImpl.h
llvm/test/Bitcode/distringtype-backward.ll [new file with mode: 0644]
llvm/test/Bitcode/distringtype-backward.ll.bc [new file with mode: 0644]
llvm/test/DebugInfo/X86/distringtype.ll
llvm/test/DebugInfo/fortran-string-type.ll