diff options
author | Anders Waldenborg <anders@0x63.nu> | 2015-04-14 09:18:17 +0000 |
---|---|---|
committer | Anders Waldenborg <anders@0x63.nu> | 2015-04-14 09:18:17 +0000 |
commit | 1433fd4699dede45378cbc17f89b3a15caf11915 (patch) | |
tree | 50d1f425d826b479003ec7b23fdf1a599904fa49 /llvm/lib | |
parent | 72a7581743c5bc707eb36739e3d93a2e38dfe6b6 (diff) | |
download | bcm5719-llvm-1433fd4699dede45378cbc17f89b3a15caf11915.tar.gz bcm5719-llvm-1433fd4699dede45378cbc17f89b3a15caf11915.zip |
Fix crash in DebugInfoFinder when adding a module with forward declared composite type
The testcase that is included in the patch caused a crash when doing DebugInfoFinder::processModule
on the module due to DCT->getElements() returning nullptr in DebugInfoFinder::processType.
By doing "DCT->getElements()" instead of "DCT->getElements()->operands()" one gets a DIArray
instead of a raw MDTuple. The former has code to handle null as a 0-element array and
therefore avoids the crash.
Differential Revision: http://reviews.llvm.org/D9008
llvm-svn: 234875
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/IR/DebugInfo.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index d289f8079bd..ca7a4f4801b 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -182,7 +182,7 @@ void DebugInfoFinder::processType(DIType DT) { processType(Ref.resolve(TypeIdentifierMap)); return; } - for (Metadata *D : DCT->getElements()->operands()) { + for (Metadata *D : DCT->getElements()) { if (DIType T = dyn_cast<MDType>(D)) processType(T); else if (DISubprogram SP = dyn_cast<MDSubprogram>(D)) |