From 5f75dcf5719f8ba2819b73109888175cf92fe253 Mon Sep 17 00:00:00 2001 From: Chih-Ping Chen Date: Thu, 17 Dec 2020 11:08:46 -0500 Subject: [DebugInfo] Support Fortran 'use ' statement. The main change is to add a 'IsDecl' field to DIModule so that when IsDecl is set to true, the debug info entry generated for the module would be marked as a declaration. That way, the debugger would look up the definition of the module in the gloabl scope. Please see the comments in llvm/test/DebugInfo/X86/dimodule.ll for what the debug info entries would look like. Differential Revision: https://reviews.llvm.org/D93462 --- llvm/lib/Bitcode/Reader/MetadataLoader.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Bitcode/Reader/MetadataLoader.cpp') diff --git a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp index 3fc85b122fa8..8cdda62870ff 100644 --- a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp +++ b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp @@ -1565,19 +1565,20 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata( } case bitc::METADATA_MODULE: { - if (Record.size() < 5 || Record.size() > 8) + if (Record.size() < 5 || Record.size() > 9) return error("Invalid record"); - unsigned Offset = Record.size() >= 7 ? 2 : 1; + unsigned Offset = Record.size() >= 8 ? 2 : 1; IsDistinct = Record[0]; MetadataList.assignValue( GET_OR_DISTINCT( DIModule, - (Context, Record.size() >= 7 ? getMDOrNull(Record[1]) : nullptr, + (Context, Record.size() >= 8 ? 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])), + Record.size() <= 7 ? 0 : Record[7], + Record.size() <= 8 ? false : Record[8])), NextMetadataNo); NextMetadataNo++; break; -- cgit v1.2.3