[DebugInfo] Support Fortran 'use <external module>' 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
This commit is contained in:
Chih-Ping Chen
2020-12-17 11:08:46 -05:00
parent 5e5ef53597
commit 5f75dcf571
14 changed files with 217 additions and 42 deletions

View File

@@ -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;