aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
diff options
context:
space:
mode:
authorAlok Kumar Sharma <AlokKumar.Sharma@amd.com>2020-05-15 11:24:27 +0530
committerSourabh Singh Tomar <SourabhSingh.Tomar@amd.com>2020-05-15 11:33:17 +0530
commit4042ada1c1fe4a9cd546600602281686bb2270cd (patch)
tree2e7f9d3c48ab5b4964980cacde8b08d27a8863fe /llvm/lib/Bitcode/Reader/MetadataLoader.cpp
parenta2545c3499a03cc1fdbd5f638f88572b23adf570 (diff)
downloadllvm-4042ada1c1fe4a9cd546600602281686bb2270cd.zip
llvm-4042ada1c1fe4a9cd546600602281686bb2270cd.tar.gz
llvm-4042ada1c1fe4a9cd546600602281686bb2270cd.tar.bz2
[DebugInfo] support for DW_AT_data_location in llvm
This patch adds support for DWARF attribute DW_AT_data_location. Summary: Dynamic arrays in fortran are described by array descriptor and data allocation address. Former is mapped to DW_AT_location and later is mapped to DW_AT_data_location. Testing: unit test cases added (hand-written) check llvm check debug-info Reviewed By: aprantl Differential Revision: https://reviews.llvm.org/D79592
Diffstat (limited to 'llvm/lib/Bitcode/Reader/MetadataLoader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/MetadataLoader.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
index 33776bd..7338d17 100644
--- a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
+++ b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
@@ -1340,7 +1340,7 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
break;
}
case bitc::METADATA_COMPOSITE_TYPE: {
- if (Record.size() < 16 || Record.size() > 17)
+ if (Record.size() < 16 || Record.size() > 18)
return error("Invalid record");
// If we have a UUID and this is not a forward declaration, lookup the
@@ -1364,6 +1364,7 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
Metadata *VTableHolder = nullptr;
Metadata *TemplateParams = nullptr;
Metadata *Discriminator = nullptr;
+ Metadata *DataLocation = nullptr;
auto *Identifier = getMDString(Record[15]);
// If this module is being parsed so that it can be ThinLTO imported
// into another module, composite types only need to be imported
@@ -1386,13 +1387,15 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
TemplateParams = getMDOrNull(Record[14]);
if (Record.size() > 16)
Discriminator = getMDOrNull(Record[16]);
+ if (Record.size() > 17)
+ DataLocation = getMDOrNull(Record[17]);
}
DICompositeType *CT = nullptr;
if (Identifier)
CT = DICompositeType::buildODRType(
Context, *Identifier, Tag, Name, File, Line, Scope, BaseType,
SizeInBits, AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang,
- VTableHolder, TemplateParams, Discriminator);
+ VTableHolder, TemplateParams, Discriminator, DataLocation);
// Create a node if we didn't get a lazy ODR type.
if (!CT)
@@ -1400,7 +1403,7 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
(Context, Tag, Name, File, Line, Scope, BaseType,
SizeInBits, AlignInBits, OffsetInBits, Flags,
Elements, RuntimeLang, VTableHolder, TemplateParams,
- Identifier, Discriminator));
+ Identifier, Discriminator, DataLocation));
if (!IsNotUsedInTypeRef && Identifier)
MetadataList.addTypeRef(*Identifier, *cast<DICompositeType>(CT));