Fix crash in DebugInfoFinder when adding a module with forward declared composite...
authorAnders Waldenborg <anders@0x63.nu>
Tue, 14 Apr 2015 09:18:17 +0000 (09:18 +0000)
committerAnders Waldenborg <anders@0x63.nu>
Tue, 14 Apr 2015 09:18:17 +0000 (09:18 +0000)
commit6ee10307c01520542aa81531b2afbf755624961e
tree4de119e18d7a15027c8032b0c6618ff1f7448839
parent9cecacd16af2ec8a5c01f751850cf212b037d779
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234875 91177308-0d34-0410-b5e6-96231b3b80d8
lib/IR/DebugInfo.cpp
test/DebugInfo/debuginfofinder-forward-declaration.ll [new file with mode: 0644]