diff options
author | Eric Christopher <echristo@gmail.com> | 2013-08-08 07:40:37 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2013-08-08 07:40:37 +0000 |
commit | dc1363f5af47542a602c80e726749bc06d8ef3f8 (patch) | |
tree | 1a40cc31a04e00da38310920dd3d125dbcf8b92c /lib/IR | |
parent | afdd1f8a851349e2b3cdc6d441043ac3f4cdb9b9 (diff) | |
download | llvm-dc1363f5af47542a602c80e726749bc06d8ef3f8.tar.gz llvm-dc1363f5af47542a602c80e726749bc06d8ef3f8.tar.bz2 llvm-dc1363f5af47542a602c80e726749bc06d8ef3f8.tar.xz |
Make sure that if we're going to attempt to add a type to a DIE that
the type exists.
Fix up cases where we weren't checking for optional types and add
an assert to addType to make sure we catch this in the future.
Fix up a testcase that was using the tag for DW_TAG_array_type
when it meant DW_TAG_enumeration_type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187963 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR')
-rw-r--r-- | lib/IR/DIBuilder.cpp | 1 | ||||
-rw-r--r-- | lib/IR/DebugInfo.cpp | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/IR/DIBuilder.cpp b/lib/IR/DIBuilder.cpp index 3005f77742..e36d028899 100644 --- a/lib/IR/DIBuilder.cpp +++ b/lib/IR/DIBuilder.cpp @@ -759,7 +759,6 @@ DICompositeType DIBuilder::createArrayType(uint64_t Size, uint64_t AlignInBits, /// createVectorType - Create debugging information entry for a vector. DICompositeType DIBuilder::createVectorType(uint64_t Size, uint64_t AlignInBits, DIType Ty, DIArray Subscripts) { - // A vector is an array type with the FlagVector flag applied. Value *Elts[] = { GetTagConstant(VMContext, dwarf::DW_TAG_array_type), diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp index a6f1c3413e..fc9324949d 100644 --- a/lib/IR/DebugInfo.cpp +++ b/lib/IR/DebugInfo.cpp @@ -483,6 +483,12 @@ bool DICompositeType::Verify() const { if (!fieldIsMDNode(DbgNode, 12)) return false; + // If this is an array type verify that we have a DIType in the derived type + // field as that's the type of our element. + if (getTag() == dwarf::DW_TAG_array_type) + if (!DIType(getTypeDerivedFrom())) + return false; + return DbgNode->getNumOperands() >= 10 && DbgNode->getNumOperands() <= 14; } |