diff options
author | Sourabh Singh Tomar <SourabhSingh.Tomar@amd.com> | 2020-05-08 11:31:41 +0530 |
---|---|---|
committer | Sourabh Singh Tomar <SourabhSingh.Tomar@amd.com> | 2020-05-13 12:52:30 +0530 |
commit | e59744fd9b4298c0527163748510a482a942eb54 (patch) | |
tree | 5451a474e95a213a3bc2d2f3ddea10ba75fe6dd1 /llvm/lib/Bitcode/Reader/MetadataLoader.cpp | |
parent | eef95f2746c3347b8dad19091ffb82a88d73acd3 (diff) | |
download | llvm-e59744fd9b4298c0527163748510a482a942eb54.zip llvm-e59744fd9b4298c0527163748510a482a942eb54.tar.gz llvm-e59744fd9b4298c0527163748510a482a942eb54.tar.bz2 |
[DebugInfo] Fortran module DebugInfo support in LLVM
This patch extends DIModule Debug metadata in LLVM to support
Fortran modules. DIModule is extended to contain File and Line
fields, these fields will be used by Flang FE to create debug
information necessary for representing Fortran modules at IR level.
Furthermore DW_TAG_module is also extended to contain these fields.
If these fields are missing, debuggers like GDB won't be able to
show Fortran modules information correctly.
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D79484
Diffstat (limited to 'llvm/lib/Bitcode/Reader/MetadataLoader.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Reader/MetadataLoader.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp index 735d802..33776bd 100644 --- a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp +++ b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp @@ -1428,15 +1428,19 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata( } case bitc::METADATA_MODULE: { - if (Record.size() < 5 || Record.size() > 7) + if (Record.size() < 5 || Record.size() > 8) return error("Invalid record"); + unsigned Offset = Record.size() >= 7 ? 2 : 1; IsDistinct = Record[0]; MetadataList.assignValue( - GET_OR_DISTINCT(DIModule, - (Context, getMDOrNull(Record[1]), - getMDString(Record[2]), getMDString(Record[3]), - getMDString(Record[4]), getMDString(Record[5]))), + GET_OR_DISTINCT( + DIModule, + (Context, Record.size() >= 7 ? getMDOrNull(Record[1]) : nullptr, + getMDOrNull(Record[0 + Offset]), getMDString(Record[1 + Offset]), + getMDString(Record[2 + Offset]), getMDString(Record[3 + Offset]), + getMDString(Record[4 + Offset]), + Record.size() <= 7 ? 0 : Record[7])), NextMetadataNo); NextMetadataNo++; break; |